public TxHubTests() { _txHub = GetRequiredService <ITxHub>(); _blockchainService = GetRequiredService <IBlockchainService>(); _kernelTestHelper = GetRequiredService <KernelTestHelper>(); _eventBus = GetRequiredService <ILocalEventBus>(); }
public OSTestHelper(IOsBlockchainNodeContextService osBlockchainNodeContextService, IAccountService accountService, IMinerService minerService, IBlockchainService blockchainService, ITxHub txHub, ISmartContractAddressService smartContractAddressService, IBlockAttachService blockAttachService, IStaticChainInformationProvider staticChainInformationProvider, ITransactionResultService transactionResultService, IOptionsSnapshot <ChainOptions> chainOptions) { _chainOptions = chainOptions.Value; _osBlockchainNodeContextService = osBlockchainNodeContextService; _accountService = accountService; _minerService = minerService; _blockchainService = blockchainService; _smartContractAddressService = smartContractAddressService; _blockAttachService = blockAttachService; _txHub = txHub; _staticChainInformationProvider = staticChainInformationProvider; _transactionResultService = transactionResultService; BestBranchBlockList = new List <Block>(); ForkBranchBlockList = new List <Block>(); UnlinkedBranchBlockList = new List <Block>(); }
public PoTC(IMiner miner, ITxHub txHub) { _miner = miner; _txHub = txHub; _logger = LogManager.GetLogger(nameof(PoTC)); }
public MinerService(IMiningService miningService, ITxHub txHub) { _miningService = miningService; _txHub = txHub; EventBus = NullLocalEventBus.Instance; }
public async Task GlobalSetup() { _chains = GetRequiredService <IBlockchainStore <Chain> >(); _chainStateInfoCollection = GetRequiredService <IStateStore <ChainStateInfo> >(); _blockchainStateManager = GetRequiredService <IBlockchainStateManager>(); _blockchainStateService = GetRequiredService <IBlockchainStateService>(); _blockchainService = GetRequiredService <IBlockchainService>(); _osTestHelper = GetRequiredService <OSTestHelper>(); _chainManager = GetRequiredService <IChainManager>(); _blockManager = GetRequiredService <IBlockManager>(); _transactionManager = GetRequiredService <ITransactionManager>(); _transactionResultManager = GetRequiredService <ITransactionResultManager>(); _txHub = GetRequiredService <ITxHub>(); _blockStateSets = new List <BlockStateSet>(); _blocks = new List <Block>(); _chain = await _blockchainService.GetChainAsync(); var blockHash = _chain.BestChainHash; while (true) { var blockState = await _blockchainStateManager.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 _blockchainStateManager.GetBlockStateSetAsync(block.GetHash()); _blockStateSets.Add(blockState); } var chain = await _blockchainService.GetChainAsync(); await _chainManager.SetIrreversibleBlockAsync(chain, chain.BestChainHash); _chainStateInfo = await _chainStateInfoCollection.GetAsync(chain.Id.ToStorageKey()); }
internal IMiner GetMiner(IMinerConfig config, ITxHub hub, ClientManager clientManager = null) { var miner = new AElf.Miner.Miner.Miner(config, hub, _chainService, _concurrencyExecutingService, _transactionResultManager, _logger, clientManager, _binaryMerkleTreeManager, null, MockBlockValidationService().Object, _chainContextService, _chainManagerBasic, _stateStore); return(miner); }
public async Task GlobalSetup() { _blockchainService = GetRequiredService <IBlockchainService>(); _osTestHelper = GetRequiredService <OSTestHelper>(); _transactionManager = GetRequiredService <ITransactionManager>(); _txHub = GetRequiredService <ITxHub>(); _chain = await _blockchainService.GetChainAsync(); }
public MinerService(IMiningService miningService, ITxHub txHub, IBlockTransactionLimitProvider blockTransactionLimitProvider) { _miningService = miningService; _txHub = txHub; _blockTransactionLimitProvider = blockTransactionLimitProvider; Logger = NullLogger <MinerService> .Instance; }
public BlockChainAppService(IBlockchainService blockchainService, ITxHub txHub, IBlockStateSetManger blockStateSetManger) { _blockchainService = blockchainService; _txHub = txHub; _blockStateSetManger = blockStateSetManger; Logger = NullLogger <BlockChainAppService> .Instance; LocalEventBus = NullLocalEventBus.Instance; }
public BlockChainAppServiceTest(ITestOutputHelper outputHelper) : base(outputHelper) { _blockchainService = GetRequiredService <IBlockchainService>(); _smartContractAddressService = GetRequiredService <ISmartContractAddressService>(); _txHub = GetRequiredService <ITxHub>(); _blockchainStateMergingService = GetRequiredService <IBlockchainStateMergingService>(); _blockchainStateManager = GetRequiredService <IBlockchainStateManager>(); _osTestHelper = GetRequiredService <OSTestHelper>(); _accountService = GetRequiredService <IAccountService>(); }
public MainchainNodeService(IStateStore stateStore, ITxHub hub, IChainCreationService chainCreationService, IBlockSynchronizer blockSynchronizer, IChainService chainService, IMiner miner, ILogger logger) { _stateStore = stateStore; _chainCreationService = chainCreationService; _chainService = chainService; _txHub = hub; _logger = logger; _miner = miner; _blockSynchronizer = blockSynchronizer; }
public MinerService(IMiningService miningService, ITxHub txHub, IBlockTransactionLimitProvider blockTransactionLimitProvider, IOptionsMonitor <TransactionPackingOptions> transactionPackingOptions) { _miningService = miningService; _txHub = txHub; _blockTransactionLimitProvider = blockTransactionLimitProvider; _transactionPackingOptions = transactionPackingOptions.CurrentValue; Logger = NullLogger <MinerService> .Instance; }
public ChainControllerRpcServiceServerTest(ITestOutputHelper outputHelper) : base(outputHelper) { Logger = GetService <ILogger <ChainControllerRpcServiceServerTest> >() ?? NullLogger <ChainControllerRpcServiceServerTest> .Instance; _blockchainService = GetRequiredService <IBlockchainService>(); _txHub = GetRequiredService <ITxHub>(); _accountService = GetRequiredService <IAccountService>(); _smartContractAddressService = GetRequiredService <ISmartContractAddressService>(); _osTestHelper = GetRequiredService <OSTestHelper>(); }
public BlockExecutor(IChainService chainService, IExecutingService executingService, ITransactionResultManager transactionResultManager, ClientManager clientManager, IBinaryMerkleTreeManager binaryMerkleTreeManager, ITxHub txHub, IChainManagerBasic chainManagerBasic, IStateStore stateStore) { _chainService = chainService; _executingService = executingService; _transactionResultManager = transactionResultManager; _clientManager = clientManager; _binaryMerkleTreeManager = binaryMerkleTreeManager; _txHub = txHub; _chainManagerBasic = chainManagerBasic; _stateStore = stateStore; _dpoSInfoProvider = new DPoSInfoProvider(_stateStore); _logger = LogManager.GetLogger(nameof(BlockExecutor)); MessageHub.Instance.Subscribe <DPoSStateChanged>(inState => _isMining = inState.IsMining); _executing = false; _prepareTerminated = false; _terminated = false; MessageHub.Instance.Subscribe <TerminationSignal>(signal => { if (signal.Module == TerminatedModuleEnum.BlockExecutor) { if (!_executing) { _terminated = true; MessageHub.Instance.Publish(new TerminatedModule(TerminatedModuleEnum.BlockExecutor)); } else { _prepareTerminated = true; } } }); MessageHub.Instance.Subscribe <StateEvent>(inState => { if (inState == StateEvent.RollbackFinished) { _isLimitExecutionTime = false; } if (inState == StateEvent.MiningStart) { _isLimitExecutionTime = true; } _logger?.Trace($"Current Event: {inState.ToString()} ,IsLimitExecutionTime: {_isLimitExecutionTime}"); }); }
public BlockchainNodeContextService( IBlockchainService blockchainService, IChainCreationService chainCreationService, ITxHub txHub, ISmartContractAddressUpdateService smartContractAddressUpdateService, IDefaultContractZeroCodeProvider defaultContractZeroCodeProvider, IConsensusService consensusService) { _blockchainService = blockchainService; _chainCreationService = chainCreationService; _txHub = txHub; _smartContractAddressUpdateService = smartContractAddressUpdateService; _defaultContractZeroCodeProvider = defaultContractZeroCodeProvider; _consensusService = consensusService; }
public void Setup(BenchmarkContext context) { _osTestHelper = GetRequiredService <OSTestHelper>(); _txHub = GetRequiredService <ITxHub>(); _counter = context.GetCounter("TestCounter"); AsyncHelper.RunSync(async() => { _transactions = await _osTestHelper.GenerateTransferTransactions(1000); }); }
public ParallelTests() { _blockchainService = GetRequiredService <IBlockchainService>(); _blockExecutingService = GetRequiredService <IBlockExecutingService>(); _minerService = GetRequiredService <IMinerService>(); _transactionResultManager = GetRequiredService <ITransactionResultManager>(); _grouper = GetRequiredService <ITransactionGrouper>(); _codeRemarksManager = GetRequiredService <ICodeRemarksManager>(); _txHub = GetRequiredService <ITxHub>(); _blockAttachService = GetRequiredService <IBlockAttachService>(); _accountService = GetRequiredService <IAccountService>(); _parallelTestHelper = GetRequiredService <ParallelTestHelper>(); }
public ParallelTests() { _blockchainService = GetRequiredService <IBlockchainService>(); _blockExecutingService = GetRequiredService <IBlockExecutingService>(); _transactionResultManager = GetRequiredService <ITransactionResultManager>(); _grouper = GetRequiredService <ITransactionGrouper>(); _contractRemarksService = GetRequiredService <IContractRemarksService>(); _txHub = GetRequiredService <ITxHub>(); _blockAttachService = GetRequiredService <IBlockAttachService>(); _accountService = GetRequiredService <IAccountService>(); _parallelTestHelper = GetRequiredService <ParallelTestHelper>(); _smartContractAddressService = GetRequiredService <ISmartContractAddressService>(); }
public async Task GlobalSetup() { _blockchainService = GetRequiredService <IBlockchainService>(); _osTestHelper = GetRequiredService <OSTestHelper>(); _minerService = GetRequiredService <IMinerService>(); _transactionResultManager = GetRequiredService <ITransactionResultManager>(); _blockStateSets = GetRequiredService <INotModifiedCachedStateStore <BlockStateSet> >(); _transactionManager = GetRequiredService <ITransactionManager>(); _txHub = GetRequiredService <ITxHub>(); _transactions = new List <Transaction>(); _chain = await _blockchainService.GetChainAsync(); }
public TransactionResultTest(ITxPoolConfig txPoolConfig, IChainService chainService, ITxSignatureVerifier signatureVerifier, ITxRefBlockValidator refBlockValidator, ITransactionResultManager transactionResultManager, ITxHub txHub) { ChainConfig.Instance.ChainId = Hash.Generate().DumpHex(); NodeConfig.Instance.NodeAccount = Address.Generate().DumpHex(); _transactionResultManager = transactionResultManager; _signatureVerifier = signatureVerifier; _refBlockValidator = refBlockValidator; _txHub = txHub; // _transactionResultService = new TransactionResultService( // new TxPool(logger, // new NewTxHub(transactionManager, chainService, signatureVerifier, refBlockValidator)), transactionResultManager); _transactionResultService = new TransactionResultService(_txHub, _transactionResultManager); }
public ParallelTestHelper(IOsBlockchainNodeContextService osBlockchainNodeContextService, IAccountService accountService, IMinerService minerService, IBlockchainService blockchainService, ITxHub txHub, ISmartContractAddressService smartContractAddressService, IBlockAttachService blockAttachService, IStaticChainInformationProvider staticChainInformationProvider, ITransactionResultService transactionResultService, IOptionsSnapshot <ChainOptions> chainOptions) : base(osBlockchainNodeContextService, accountService, minerService, blockchainService, txHub, smartContractAddressService, blockAttachService, staticChainInformationProvider, transactionResultService, chainOptions) { _accountService = accountService; _staticChainInformationProvider = staticChainInformationProvider; }
public void Setup(BenchmarkContext context) { _blockchainService = GetRequiredService <IBlockchainService>(); _osTestHelper = GetRequiredService <OSTestHelper>(); _minerService = GetRequiredService <IMinerService>(); _txHub = GetRequiredService <ITxHub>(); _blockAttachService = GetRequiredService <IBlockAttachService>(); _counter = context.GetCounter("TestCounter"); AsyncHelper.RunSync(async() => { var transactions = await _osTestHelper.GenerateTransferTransactions(1000); await _osTestHelper.BroadcastTransactions(transactions); }); }
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 MockSetup(IDataStore dataStore, IStateStore stateStore, ITxHub txHub) { _dataStore = dataStore; _stateStore = stateStore; _smartContractManager = new SmartContractManager(_dataStore); _transactionManager = new TransactionManager(_dataStore); _transactionTraceManager = new TransactionTraceManager(_dataStore); _transactionResultManager = new TransactionResultManager(_dataStore); _smartContractRunnerFactory = new SmartContractRunnerFactory(); _concurrencyExecutingService = new SimpleExecutingService( new SmartContractService(_smartContractManager, _smartContractRunnerFactory, _stateStore, _functionMetadataService), _transactionTraceManager, _stateStore, new ChainContextService(GetChainService())); _txHub = txHub; _chainManagerBasic = new ChainManagerBasic(dataStore); }
public void Setup(BenchmarkContext context) { _osTestHelper = GetRequiredService <OSTestHelper>(); _txHub = GetRequiredService <ITxHub>(); _blockchainService = GetRequiredService <IBlockchainService>(); _counter = context.GetCounter("TestCounter"); AsyncHelper.RunSync(async() => { var transactions = await _osTestHelper.GenerateTransferTransactions(1000); await _txHub.HandleTransactionsReceivedAsync(new TransactionsReceivedEvent { Transactions = transactions }); await _osTestHelper.MinedOneBlock(); }); }
public BlockChainAppService(IBlockchainService blockchainService, ISmartContractAddressService smartContractAddressService, ITransactionReadOnlyExecutionService transactionReadOnlyExecutionService, ITransactionManager transactionManager, ITransactionResultQueryService transactionResultQueryService, ITxHub txHub, IBlockchainStateManager blockchainStateManager ) { _blockchainService = blockchainService; _smartContractAddressService = smartContractAddressService; _transactionReadOnlyExecutionService = transactionReadOnlyExecutionService; _transactionManager = transactionManager; _transactionResultQueryService = transactionResultQueryService; _txHub = txHub; _blockchainStateManager = blockchainStateManager; Logger = NullLogger <BlockChainAppService> .Instance; LocalEventBus = NullLocalEventBus.Instance; }
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; }
public TransactionResultService(ITxHub txHub, ITransactionResultManager transactionResultManager) { _txHub = txHub; _transactionResultManager = transactionResultManager; }
public TxPoolInterestedEventsHandler(ITxHub txHub) { _txHub = txHub; }
public DPoS(IStateStore stateStore, ITxHub txHub, IMiner miner, IChainService chainService) { _txHub = txHub; _miner = miner; _chainService = chainService; _prepareTerminated = false; _terminated = false; _logger = LogManager.GetLogger(nameof(DPoS)); Helper = new AElfDPoSHelper(Hash.LoadHex(ChainConfig.Instance.ChainId), Miners, ContractAddress, stateStore); Provider = new DPoSInfoProvider(stateStore); var count = MinersConfig.Instance.Producers.Count; GlobalConfig.BlockProducerNumber = count; GlobalConfig.BlockNumberOfEachRound = count + 1; _logger?.Info("Block Producer nodes count:" + GlobalConfig.BlockProducerNumber); _logger?.Info("Blocks of one round:" + GlobalConfig.BlockNumberOfEachRound); if (GlobalConfig.BlockProducerNumber == 1 && NodeConfig.Instance.IsMiner) { AElfDPoSObserver.RecoverMining(); } MessageHub.Instance.Subscribe <UpdateConsensus>(async option => { if (option == UpdateConsensus.Update) { _logger?.Trace("UpdateConsensus - Update"); await Update(); } if (option == UpdateConsensus.Dispose) { _logger?.Trace("UpdateConsensus - Dispose"); Stop(); } }); MessageHub.Instance.Subscribe <LockMining>(async inState => { if (inState.Lock) { IncrementLockNumber(); } else { await Start(); } }); MessageHub.Instance.Subscribe <TerminationSignal>(signal => { if (signal.Module == TerminatedModuleEnum.Mining) { _prepareTerminated = true; } }); MessageHub.Instance.Subscribe <FSMStateChanged>(inState => { CurrentState = inState.CurrentState; }); }