Exemplo n.º 1
0
 public SmartContractService(ISmartContractManager smartContractManager, ISmartContractRunnerFactory smartContractRunnerFactory, IStateStore stateStore,
                             IFunctionMetadataService functionMetadataService)
 {
     _smartContractManager       = smartContractManager;
     _smartContractRunnerFactory = smartContractRunnerFactory;
     _stateStore = stateStore;
     _functionMetadataService = functionMetadataService;
 }
Exemplo n.º 2
0
 public SmartContractService(
     ISmartContractRunnerContainer smartContractRunnerContainer,
     IFunctionMetadataService functionMetadataService, IBlockchainService chainService,
     ISmartContractAddressService smartContractAddressService,
     ISmartContractExecutiveService smartContractExecutiveService)
 {
     _smartContractRunnerContainer = smartContractRunnerContainer;
     _functionMetadataService      = functionMetadataService;
     _chainService = chainService;
     _smartContractAddressService   = smartContractAddressService;
     _smartContractExecutiveService = smartContractExecutiveService;
 }
Exemplo n.º 3
0
 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);
 }
Exemplo n.º 4
0
 public MockSetup(IStateStore stateStore, IChainCreationService chainCreationService, IDataStore dataStore, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory)
 {
     StateStore                  = stateStore;
     _chainCreationService       = chainCreationService;
     _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();
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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
            };
        }
Exemplo n.º 7
0
 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 ResourceUsageDetectionService(IFunctionMetadataService functionMetadataService)
 {
     _functionMetadataService = functionMetadataService;
 }
 public ResourceUsageDetectionServiceTest(IDataStore dataStore, IFunctionMetadataService functionMetadataService)
 {
     _dataStore = dataStore;
     _functionMetadataService = functionMetadataService;
 }
Exemplo n.º 10
0
 public FunctionMetadataServiceTest(IFunctionMetadataService functionMetadataService, IDataStore dataStore, ISmartContractRunnerFactory smartContractRunnerFactory)
 {
     _functionMetadataService = functionMetadataService;
     _dataStore = dataStore;
     _smartContractRunnerFactory = smartContractRunnerFactory;
 }
Exemplo n.º 11
0
 public ChainFunctionMetadataTest(IDataStore templateStore, ISmartContractRunnerFactory smartContractRunnerFactory, IFunctionMetadataService functionMetadataService)
 {
     _dataStore = templateStore ?? throw new ArgumentNullException(nameof(templateStore));
     _smartContractRunnerFactory = smartContractRunnerFactory ?? throw new ArgumentException(nameof(smartContractRunnerFactory));
     _functionMetadataService    = functionMetadataService ?? throw new ArgumentException(nameof(functionMetadataService));
 }