private void Initialize() { _transactionManager = new TransactionManager(_dataStore, _logger); _transactionReceiptManager = new TransactionReceiptManager(_database); _smartContractManager = new SmartContractManager(_dataStore); _transactionResultManager = new TransactionResultManager(_dataStore); _transactionTraceManager = new TransactionTraceManager(_dataStore); _functionMetadataService = new FunctionMetadataService(_dataStore, _logger); _chainManagerBasic = new ChainManagerBasic(_dataStore); _chainService = new ChainService(_chainManagerBasic, new BlockManagerBasic(_dataStore), _transactionManager, _transactionTraceManager, _dataStore, StateStore); _smartContractRunnerFactory = new SmartContractRunnerFactory(); /*var runner = new SmartContractRunner("../../../../AElf.SDK.CSharp/bin/Debug/netstandard2.0/"); * _smartContractRunnerFactory.AddRunner(0, runner);*/ var runner = new SmartContractRunner(ContractCodes.TestContractFolder); _smartContractRunnerFactory.AddRunner(0, runner); _concurrencyExecutingService = new SimpleExecutingService( new SmartContractService(_smartContractManager, _smartContractRunnerFactory, StateStore, _functionMetadataService), _transactionTraceManager, StateStore, new ChainContextService(_chainService)); _chainCreationService = new ChainCreationService(_chainService, new SmartContractService(new SmartContractManager(_dataStore), _smartContractRunnerFactory, StateStore, _functionMetadataService), _logger); _binaryMerkleTreeManager = new BinaryMerkleTreeManager(_dataStore); _chainContextService = new ChainContextService(_chainService); _stateStore = new StateStore(_database); }
public Benchmarks(IStateStore stateStore, IChainCreationService chainCreationService, IChainContextService chainContextService, ISmartContractService smartContractService, ILogger logger, IFunctionMetadataService functionMetadataService, BenchmarkOptions options, IExecutingService executingService) { ChainId = Hash.Generate(); _stateStore = stateStore; _chainCreationService = chainCreationService; _smartContractService = smartContractService; _logger = logger; _options = options; _executingService = executingService; _servicePack = new ServicePack { ChainContextService = chainContextService, SmartContractService = _smartContractService, ResourceDetectionService = new ResourceUsageDetectionService(functionMetadataService), StateStore = _stateStore }; _dataGenerater = new TransactionDataGenerator(options); byte[] code; using (FileStream file = File.OpenRead(Path.GetFullPath(options.DllDir + "/" + options.ContractDll))) { code = file.ReadFully(); } _contractHash = Prepare(code).Result; }
public SimpleExecutingService(ISmartContractService smartContractService, ITransactionTraceManager transactionTraceManager, IStateStore stateStore, IChainContextService chainContextService) { _smartContractService = smartContractService; _transactionTraceManager = transactionTraceManager; _chainContextService = chainContextService; _stateStore = stateStore; }
public ContractTest(IStateStore stateStore, IChainCreationService chainCreationService, IChainService chainService, ITransactionManager transactionManager, ISmartContractManager smartContractManager, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory) { _stateStore = stateStore; _chainCreationService = chainCreationService; _chainService = chainService; _transactionManager = transactionManager; _smartContractManager = smartContractManager; _chainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; _smartContractService = new SmartContractService(_smartContractManager, _smartContractRunnerFactory, stateStore, _functionMetadataService); }
public MockSetup(IDataStore dataStore, IChainCreationService chainCreationService, IChainService chainService, IActorEnvironment actorEnvironment, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory, ILogger logger, IStateStore stateStore, HashManager hashManager, TransactionManager transactionManager) { _logger = logger; _stateStore = stateStore; ActorEnvironment = actorEnvironment; if (!ActorEnvironment.Initialized) { ActorEnvironment.InitActorSystem(); } _hashManager = hashManager; _transactionManager = transactionManager; _chainCreationService = chainCreationService; _chainService = chainService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); ServicePack = new ServicePack() { ChainContextService = chainContextService, SmartContractService = SmartContractService, ResourceDetectionService = new NewMockResourceUsageDetectionService(), StateStore = _stateStore }; // These are only required for workertest // other tests use ActorEnvironment var workers = new[] { "/user/worker1", "/user/worker2" }; Worker1 = Sys.ActorOf(Props.Create <Worker>(), "worker1"); Worker2 = Sys.ActorOf(Props.Create <Worker>(), "worker2"); Router = Sys.ActorOf(Props.Empty.WithRouter(new TrackedGroup(workers)), "router"); Worker1.Tell(new LocalSerivcePack(ServicePack)); Worker2.Tell(new LocalSerivcePack(ServicePack)); Requestor = Sys.ActorOf(AElf.Execution.Execution.Requestor.Props(Router)); }
public MockSetup(IStateStore stateStore, IChainCreationService chainCreationService, IDataStore dataStore, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory) { StateStore = stateStore; _chainCreationService = chainCreationService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, _functionMetadataService); ServicePack = new ServicePack() { ChainContextService = chainContextService, SmartContractService = SmartContractService, ResourceDetectionService = null, StateStore = StateStore }; }
public BlockChainTests_MockSetup(IDataStore dataStore, IChainCreationService chainCreationService, IChainService chainService, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory, ILogger logger, IStateStore stateStore, HashManager hashManager, TransactionManager transactionManager) { _logger = logger; _stateStore = stateStore; _hashManager = hashManager; _transactionManager = transactionManager; _chainCreationService = chainCreationService; ChainService = chainService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); }
public Miner(IMinerConfig config, ITxHub txHub, IChainService chainService, IExecutingService executingService, ITransactionResultManager transactionResultManager, ILogger logger, ClientManager clientManager, IBinaryMerkleTreeManager binaryMerkleTreeManager, ServerManager serverManager, IBlockValidationService blockValidationService, IChainContextService chainContextService, IChainManagerBasic chainManagerBasic, IStateStore stateStore) { Config = config; _txHub = txHub; _chainService = chainService; _executingService = executingService; _transactionResultManager = transactionResultManager; _logger = logger; _clientManager = clientManager; _binaryMerkleTreeManager = binaryMerkleTreeManager; _serverManager = serverManager; _blockValidationService = blockValidationService; _chainContextService = chainContextService; _chainManagerBasic = chainManagerBasic; _txFilter = new TransactionFilter(); _dpoSInfoProvider = new DPoSInfoProvider(stateStore); _maxMineTime = ConsensusConfig.Instance.DPoSMiningInterval * NodeConfig.Instance.RatioMine; }