public ExecutionPluginForMethodFeeTest()
 {
     _blockchainService = GetRequiredService <IBlockchainService>();
     _transactionSizeFeeSymbolsProvider = GetRequiredService <ITransactionSizeFeeSymbolsProvider>();
     _blockStateSetManger             = GetRequiredService <IBlockStateSetManger>();
     _totalTransactionFeesMapProvider = GetRequiredService <ITotalTransactionFeesMapProvider>();
 }
 public BlockValidationProviderTests()
 {
     _blockValidationProvider       = GetRequiredService <BlockValidationProvider>();
     _blockTransactionLimitProvider = GetRequiredService <IBlockTransactionLimitProvider>();
     _kernelTestHelper    = GetRequiredService <KernelTestHelper>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
 }
 public BlockchainStateServiceTests()
 {
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockchainExecutedDataService = GetRequiredService <IBlockchainExecutedDataService>();
 }
 public SmartContractRegistrationProviderTests()
 {
     _blockchainService = GetRequiredService <IBlockchainService>();
     _smartContractRegistrationProvider = GetRequiredService <ISmartContractRegistrationProvider>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _smartContractHelper = GetRequiredService <SmartContractHelper>();
 }
示例#5
0
 public BlockchainStateService(IBlockchainService blockchainService,
                               IBlockStateSetManger blockStateSetManger)
 {
     _blockchainService   = blockchainService;
     _blockStateSetManger = blockStateSetManger;
     Logger = NullLogger <BlockchainStateService> .Instance;
 }
示例#6
0
 public CrossChainIndexingTransactionGeneratorTest()
 {
     _crossChainIndexingTransactionGenerator = GetRequiredService <ISystemTransactionGenerator>();
     _smartContractAddressService            = GetRequiredService <ISmartContractAddressService>();
     _crossChainTestHelper = GetRequiredService <CrossChainTestHelper>();
     _blockStateSetManger  = GetRequiredService <IBlockStateSetManger>();
 }
 public BlockTransactionLimitTests()
 {
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockTransactionLimitProvider = GetRequiredService <IBlockTransactionLimitProvider>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
 }
        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());
        }
示例#9
0
 public BlockchainExecutedDataManagerTests()
 {
     _blockStateSetManger           = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateService        = GetRequiredService <IBlockchainStateService>();
     _blockchainService             = GetRequiredService <IBlockchainService>();
     _blockchainExecutedDataManager = GetRequiredService <IBlockchainExecutedDataManager>();
     _kernelTestHelper = GetRequiredService <KernelTestHelper>();
 }
示例#10
0
 public CacheProviderTests()
 {
     _providerFactory     = GetRequiredService <IStateProviderFactory>();
     _innerProvider       = _providerFactory.CreateStateProvider() as ScopedStateProvider;
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _smartContractHelper = GetRequiredService <SmartContractHelper>();
     _hostSmartContractBridgeContextService = GetRequiredService <IHostSmartContractBridgeContextService>();
 }
        protected TransactionFeeTestBase()
        {
            var serviceProvider = Application.ServiceProvider;

            BlockStateSetManger    = serviceProvider.GetRequiredService <IBlockStateSetManger>();
            BlockchainStateService = serviceProvider.GetRequiredService <IBlockchainStateService>();
            BlockchainService      = serviceProvider.GetRequiredService <IBlockchainService>();
            KernelTestHelper       = serviceProvider.GetRequiredService <KernelTestHelper>();
        }
 public SmartContractBridgeServiceTests()
 {
     _blockchainService          = GetRequiredService <IBlockchainService>();
     _smartContractBridgeService = GetRequiredService <ISmartContractBridgeService>();
     _kernelTestHelper           = GetRequiredService <KernelTestHelper>();
     _chainOptions        = GetRequiredService <IOptionsSnapshot <ChainOptions> >().Value;
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _smartContractHelper = GetRequiredService <SmartContractHelper>();
 }
示例#13
0
 public NonparallelContractCodeProviderTests()
 {
     _blockchainService = GetRequiredService <IBlockchainService>();
     _nonparallelContractCodeProvider     = GetRequiredService <INonparallelContractCodeProvider>();
     _blockStateSetManger                 = GetRequiredService <IBlockStateSetManger>();
     _blockchainExecutedDataCacheProvider =
         GetRequiredService <IBlockchainExecutedDataCacheProvider <NonparallelContractCode> >();
     _cleanBlockExecutedDataChangeHeightEventHandler =
         GetRequiredService <CleanBlockExecutedDataChangeHeightEventHandler>();
 }
示例#14
0
        public BlockChainAppService(IBlockchainService blockchainService,
                                    ITxHub txHub, IBlockStateSetManger blockStateSetManger)
        {
            _blockchainService   = blockchainService;
            _txHub               = txHub;
            _blockStateSetManger = blockStateSetManger;

            Logger        = NullLogger <BlockChainAppService> .Instance;
            LocalEventBus = NullLocalEventBus.Instance;
        }
示例#15
0
 public BlockExecutingServiceTests()
 {
     _blockExecutingService              = GetRequiredService <BlockExecutingService>();
     _kernelTestHelper                   = GetRequiredService <KernelTestHelper>();
     _smartContractExecutionHelper       = GetRequiredService <SmartContractExecutionHelper>();
     _smartContractAddressService        = GetRequiredService <ISmartContractAddressService>();
     _blockStateSetManger                = GetRequiredService <IBlockStateSetManger>();
     _transactionResultManager           = GetRequiredService <ITransactionResultManager>();
     _systemTransactionExtraDataProvider = GetRequiredService <ISystemTransactionExtraDataProvider>();
 }
示例#16
0
 public FullBlockchainExecutingServiceTests()
 {
     _fullBlockchainExecutingService = GetRequiredService <FullBlockchainExecutingService>();
     _blockchainService            = GetRequiredService <IBlockchainService>();
     _kernelTestHelper             = GetRequiredService <KernelTestHelper>();
     _smartContractExecutionHelper = GetRequiredService <SmartContractExecutionHelper>();
     _blockExecutingService        = GetRequiredService <IBlockExecutingService>();
     _smartContractAddressService  = GetRequiredService <ISmartContractAddressService>();
     _blockStateSetManger          = GetRequiredService <IBlockStateSetManger>();
 }
示例#17
0
 public MinerServiceTests()
 {
     _transactionPoolService           = GetRequiredService <ITransactionPoolService>();
     _blockTransactionLimitProvider    = GetRequiredService <IBlockTransactionLimitProvider>();
     _transactionPackingOptionProvider = GetRequiredService <ITransactionPackingOptionProvider>();
     _minerService        = GetRequiredService <IMinerService>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _blockchainService   = GetRequiredService <IBlockchainService>();
     _kernelTestHelper    = GetRequiredService <KernelTestHelper>();
 }
 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>();
 }
        public BlockChainAppService(IBlockchainService blockchainService,
                                    IBlockStateSetManger blockStateSetManger,
                                    ITransactionPoolService transactionPoolService,
                                    IObjectMapper <ChainApplicationWebAppAElfModule> objectMapper)
        {
            _blockchainService      = blockchainService;
            _blockStateSetManger    = blockStateSetManger;
            _transactionPoolService = transactionPoolService;
            _objectMapper           = objectMapper;

            Logger        = NullLogger <BlockChainAppService> .Instance;
            LocalEventBus = NullLocalEventBus.Instance;
        }
        public FullBlockchainExecutingService(IBlockchainService blockchainService,
                                              IBlockValidationService blockValidationService,
                                              IBlockExecutingService blockExecutingService,
                                              ITransactionResultService transactionResultService, IBlockStateSetManger blockStateSetManger)
        {
            _blockchainService        = blockchainService;
            _blockValidationService   = blockValidationService;
            _blockExecutingService    = blockExecutingService;
            _transactionResultService = transactionResultService;
            _blockStateSetManger      = blockStateSetManger;

            LocalEventBus = NullLocalEventBus.Instance;
        }
示例#21
0
 public SmartContractHelper(ITransactionExecutingService transactionExecutingService,
                            IDefaultContractZeroCodeProvider defaultContractZeroCodeProvider, IBlockStateSetManger blockStateSetManger,
                            IBlockchainService blockchainService, ITransactionResultManager transactionResultManager,
                            KernelTestHelper kernelTestHelper)
 {
     _transactionExecutingService     = transactionExecutingService;
     _defaultContractZeroCodeProvider = defaultContractZeroCodeProvider;
     _blockStateSetManger             = blockStateSetManger;
     _blockchainService        = blockchainService;
     _transactionResultManager = transactionResultManager;
     _kernelTestHelper         = kernelTestHelper;
     Codes = ContractsDeployer.GetContractCodes <SmartContractTestAElfModule>();
 }
示例#22
0
        public KernelTestHelper(IBlockchainService blockchainService,
                                ITransactionResultService transactionResultService,
                                IChainManager chainManager, IBlockStateSetManger blockStateSetManger)
        {
            BestBranchBlockList    = new List <Block>();
            LongestBranchBlockList = new List <Block>();
            ForkBranchBlockList    = new List <Block>();
            NotLinkedBlockList     = new List <Block>();

            _blockchainService        = blockchainService;
            _transactionResultService = transactionResultService;
            _chainManager             = chainManager;
            _blockStateSetManger      = blockStateSetManger;
        }
 public BlockchainStateManagerTests()
 {
     _blockStateSetManger    = GetRequiredService <IBlockStateSetManger>();
     _blockchainStateManager = GetRequiredService <IBlockchainStateManager>();
     _tv = new List <TestPair>();
     for (var i = 0; i < 200; i++)
     {
         _tv.Add(new TestPair()
         {
             BlockHash   = Hash.FromRawBytes(new[] { Convert.ToByte(i) }),
             BlockHeight = i,
             Key         = $"key{i}",
             Value       = ByteString.CopyFromUtf8($"value{i}")
         });
     }
 }
示例#24
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 TransactionPackingOptionProviderTests()
 {
     _transactionPackingOptionProvider = GetRequiredService <ITransactionPackingOptionProvider>();
     _kernelTestHelper    = GetRequiredService <KernelTestHelper>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
 }
示例#26
0
 public BlockTransactionLimitConfigurationProcessorTests()
 {
     _blockTransactionLimitProvider = GetRequiredService <IBlockTransactionLimitProvider>();
     _blockTransactionLimitConfigurationProcessor = GetRequiredService <IConfigurationProcessor>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
 }
 public StateSizeLimitProviderTests()
 {
     _stateSizeLimitProvider = GetRequiredService <IStateSizeLimitProvider>();
     _blockStateSetManger    = GetRequiredService <IBlockStateSetManger>();
 }
示例#28
0
 public ExecutionObserverThresholdProviderTests()
 {
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _executionObserverThresholdProvider = GetRequiredService <IExecutionObserverThresholdProvider>();
 }
 public SmartContractAddressProviderTests()
 {
     _smartContractAddressProvider = GetRequiredService <ISmartContractAddressProvider>();
     _blockStateSetManger          = GetRequiredService <IBlockStateSetManger>();
     _smartContractHelper          = GetRequiredService <SmartContractHelper>();
 }
示例#30
0
 public BlockchainExecutedDataManager(IStateStore <VersionedState> versionedStates,
                                      INotModifiedCachedStateStore <BlockStateSet> blockStateSets, IBlockStateSetManger blockStateSetManger) :
     base(versionedStates, blockStateSets)
 {
     _blockStateSetManger = blockStateSetManger;
 }