Example #1
0
 public BlockExecutingService(ILocalParallelTransactionExecutingService executingService,
                              IBlockchainStateService blockchainStateService)
 {
     _executingService       = executingService;
     _blockchainStateService = blockchainStateService;
     EventBus = NullLocalEventBus.Instance;
 }
Example #2
0
 public NewIrreversibleBlockFoundEventHandler(ITaskQueueManager taskQueueManager,
                                              IBlockchainStateService blockchainStateService)
 {
     _taskQueueManager       = taskQueueManager;
     _blockchainStateService = blockchainStateService;
     Logger = NullLogger <NewIrreversibleBlockFoundEventHandler> .Instance;
 }
 public BlockTransactionLimitTests()
 {
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockTransactionLimitProvider = GetRequiredService <IBlockTransactionLimitProvider>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
 }
 public BlockchainStateServiceTests()
 {
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockchainExecutedDataService = GetRequiredService <IBlockchainExecutedDataService>();
 }
 public BlockExecutingService(ITransactionExecutingService transactionExecutingService,
                              IBlockchainStateService blockchainStateService)
 {
     _transactionExecutingService = transactionExecutingService;
     _blockchainStateService      = blockchainStateService;
     EventBus = NullLocalEventBus.Instance;
 }
 public BlockParallelExecutingService(ITransactionExecutingService transactionExecutingService,
                                      IBlockchainStateService blockchainStateService, ITransactionResultService transactionResultService,
                                      ISystemTransactionExtraDataProvider systemTransactionExtraDataProvider) : base(
         transactionExecutingService, blockchainStateService, transactionResultService,
         systemTransactionExtraDataProvider)
 {
 }
        public async Task GlobalSetup()
        {
            _chains = GetRequiredService <IBlockchainStore <Chain> >();
            _chainStateInfoCollection = GetRequiredService <IStateStore <ChainStateInfo> >();
            _blockchainStateService   = GetRequiredService <IBlockchainStateService>();
            _blockStateSetManger      = GetRequiredService <IBlockStateSetManger>();
            _blockchainService        = GetRequiredService <IBlockchainService>();
            _osTestHelper             = GetRequiredService <OSTestHelper>();
            _chainManager             = GetRequiredService <IChainManager>();
            _blockManager             = GetRequiredService <IBlockManager>();
            _transactionManager       = GetRequiredService <ITransactionManager>();
            _transactionPoolService   = GetRequiredService <ITransactionPoolService>();


            _blockStateSets = new List <BlockStateSet>();
            _blocks         = new List <Block>();

            _chain = await _blockchainService.GetChainAsync();

            var blockHash = _chain.BestChainHash;

            while (true)
            {
                var blockState = await _blockStateSetManger.GetBlockStateSetAsync(blockHash);

                _blockStateSets.Add(blockState);

                var blockHeader = await _blockchainService.GetBlockHeaderByHashAsync(blockHash);

                blockHash = blockHeader.PreviousBlockHash;
                if (blockHash == _chain.LastIrreversibleBlockHash)
                {
                    break;
                }
            }

            await _blockchainStateService.MergeBlockStateAsync(_chain.BestChainHeight, _chain.BestChainHash);

            for (var i = 0; i < BlockCount; i++)
            {
                var transactions = await _osTestHelper.GenerateTransferTransactions(TransactionCount);

                await _osTestHelper.BroadcastTransactions(transactions);

                var block = await _osTestHelper.MinedOneBlock();

                _blocks.Add(block);

                var blockState = await _blockStateSetManger.GetBlockStateSetAsync(block.GetHash());

                _blockStateSets.Add(blockState);
            }

            var chain = await _blockchainService.GetChainAsync();

            await _chainManager.SetIrreversibleBlockAsync(chain, chain.BestChainHash);

            _chainStateInfo = await _chainStateInfoCollection.GetAsync(chain.Id.ToStorageKey());
        }
Example #8
0
 public BlockchainExecutedDataManagerTests()
 {
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockchainExecutedDataManager = GetRequiredService <IBlockchainExecutedDataManager>();
     _kernelTestHelper = GetRequiredService <KernelTestHelper>();
 }
        protected TransactionFeeTestBase()
        {
            var serviceProvider = Application.ServiceProvider;

            BlockStateSetManger    = serviceProvider.GetRequiredService <IBlockStateSetManger>();
            BlockchainStateService = serviceProvider.GetRequiredService <IBlockchainStateService>();
            BlockchainService      = serviceProvider.GetRequiredService <IBlockchainService>();
            KernelTestHelper       = serviceProvider.GetRequiredService <KernelTestHelper>();
        }
 public BlockExecutingService(ITransactionExecutingService transactionExecutingService,
                              IBlockchainStateService blockchainStateService,
                              ITransactionResultService transactionResultService,
                              ISystemTransactionExtraDataProvider systemTransactionExtraDataProvider)
 {
     _transactionExecutingService        = transactionExecutingService;
     _blockchainStateService             = blockchainStateService;
     _transactionResultService           = transactionResultService;
     _systemTransactionExtraDataProvider = systemTransactionExtraDataProvider;
     EventBus = NullLocalEventBus.Instance;
 }
 public CachedBlockchainExecutedDataServiceTests()
 {
     _blockStateSetManger                      = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateService                   = GetRequiredService <IBlockchainStateService>();
     _blockchainService                        = GetRequiredService <IBlockchainService>();
     _chainBlockchainExecutedDataService       = GetRequiredService <ICachedBlockchainExecutedDataService <Chain> >();
     _transactionBlockchainExecutedDataService =
         GetRequiredService <ICachedBlockchainExecutedDataService <Transaction> >();
     _transactionResultBlockchainExecutedDataService =
         GetRequiredService <ICachedBlockchainExecutedDataService <TransactionResult> >();
     _kernelTestHelper = GetRequiredService <KernelTestHelper>();
 }
Example #12
0
 public NewIrreversibleBlockFoundEventHandler(ITaskQueueManager taskQueueManager,
                                              IBlockchainStateService blockchainStateService,
                                              IBlockchainService blockchainService,
                                              ITransactionBlockIndexService transactionBlockIndexService,
                                              IForkCacheService forkCacheService,
                                              IChainBlockLinkService chainBlockLinkService)
 {
     _taskQueueManager             = taskQueueManager;
     _blockchainStateService       = blockchainStateService;
     _blockchainService            = blockchainService;
     _transactionBlockIndexService = transactionBlockIndexService;
     _forkCacheService             = forkCacheService;
     _chainBlockLinkService        = chainBlockLinkService;
     Logger = NullLogger <NewIrreversibleBlockFoundEventHandler> .Instance;
 }
Example #13
0
 public NewIrreversibleBlockFoundEventHandler(ITaskQueueManager taskQueueManager,
                                              IBlockchainStateService blockchainStateService,
                                              IBlockchainService blockchainService,
                                              ITransactionBlockIndexService transactionBlockIndexService,
                                              IChainBlockLinkService chainBlockLinkService,
                                              ISmartContractExecutiveService smartContractExecutiveService)
 {
     _taskQueueManager              = taskQueueManager;
     _blockchainStateService        = blockchainStateService;
     _blockchainService             = blockchainService;
     _transactionBlockIndexService  = transactionBlockIndexService;
     _chainBlockLinkService         = chainBlockLinkService;
     _smartContractExecutiveService = smartContractExecutiveService;
     Logger        = NullLogger <NewIrreversibleBlockFoundEventHandler> .Instance;
     LocalEventBus = NullLocalEventBus.Instance;
 }
Example #14
0
 public ParallelTests()
 {
     _blockchainService        = GetRequiredService <IBlockchainService>();
     _blockExecutingService    = GetRequiredService <IBlockExecutingService>();
     _transactionResultManager = GetRequiredService <ITransactionResultManager>();
     _grouper = GetRequiredService <ITransactionGrouper>();
     _blockchainStateService = GetRequiredService <IBlockchainStateService>();
     _txHub = GetRequiredService <ITxHub>();
     _blockAttachService              = GetRequiredService <IBlockAttachService>();
     _accountService                  = GetRequiredService <IAccountService>();
     _parallelTestHelper              = GetRequiredService <ParallelTestHelper>();
     _smartContractAddressService     = GetRequiredService <ISmartContractAddressService>();
     _blockchainStateManager          = GetRequiredService <IBlockchainStateManager>();
     _versionedStates                 = GetRequiredService <IStateStore <VersionedState> >();
     _nonparallelContractCodeProvider = GetRequiredService <INonparallelContractCodeProvider>();
     _blockStateSetManger             = GetRequiredService <IBlockStateSetManger>();
 }
        public void Setup(BenchmarkContext context)
        {
            _blockchainStateService = GetRequiredService <IBlockchainStateService>();
            _blockchainService      = GetRequiredService <IBlockchainService>();
            _osTestHelper           = GetRequiredService <OSTestHelper>();
            _chainManager           = GetRequiredService <IChainManager>();

            _counter = context.GetCounter("TestCounter");

            AsyncHelper.RunSync(async() =>
            {
                var transactions = await _osTestHelper.GenerateTransferTransactions(1000);
                await _osTestHelper.BroadcastTransactions(transactions);
                await _osTestHelper.MinedOneBlock();

                var chain = await _blockchainService.GetChainAsync();
                await _chainManager.SetIrreversibleBlockAsync(chain, chain.BestChainHash);
            });
        }
Example #16
0
 public BlockExecutingWithParallelService(ILocalParallelTransactionExecutingService executingService,
                                          IBlockchainStateService blockchainStateService) : base(executingService, blockchainStateService)
 {
 }
 public BlockchainStateServiceTests()
 {
     _blockchainStateManager = GetRequiredService <IBlockchainStateManager>();
     _blockchainStateService = GetRequiredService <IBlockchainStateService>();
 }
Example #18
0
 public BlockParallelExecutingService(ITransactionExecutingService transactionExecutingService,
                                      IBlockchainStateService blockchainStateService) : base(transactionExecutingService, blockchainStateService)
 {
 }