Beispiel #1
0
 public DebugModuleFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IJsonRpcConfig jsonRpcConfig,
     IBlockValidator blockValidator,
     IBlockPreprocessorStep recoveryStep,
     IRewardCalculatorSource rewardCalculator,
     IReceiptStorage receiptStorage,
     IReceiptsMigration receiptsMigration,
     IConfigProvider configProvider,
     ISpecProvider specProvider,
     ILogManager logManager)
 {
     _dbProvider             = dbProvider ?? throw new ArgumentNullException(nameof(dbProvider));
     _blockTree              = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _jsonRpcConfig          = jsonRpcConfig ?? throw new ArgumentNullException(nameof(jsonRpcConfig));
     _blockValidator         = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
     _recoveryStep           = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _rewardCalculatorSource = rewardCalculator ?? throw new ArgumentNullException(nameof(rewardCalculator));
     _receiptStorage         = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
     _receiptsMigration      = receiptsMigration ?? throw new ArgumentNullException(nameof(receiptsMigration));
     _configProvider         = configProvider ?? throw new ArgumentNullException(nameof(configProvider));
     _specProvider           = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _logManager             = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _logger = logManager.GetClassLogger();
 }
 public MergeRewardCalculatorSource(
     IRewardCalculatorSource?beforeTheMerge,
     IPoSSwitcher poSSwitcher)
 {
     _beforeTheMerge = beforeTheMerge ?? throw new ArgumentNullException(nameof(beforeTheMerge));
     _poSSwitcher    = poSSwitcher ?? throw new ArgumentNullException(nameof(poSSwitcher));
 }
        public BeamBlockchainProcessor(
            IReadOnlyDbProvider readOnlyDbProvider,
            IBlockTree blockTree,
            ISpecProvider specProvider,
            ILogManager logManager,
            IBlockValidator blockValidator,
            IBlockPreprocessorStep recoveryStep,
            IRewardCalculatorSource rewardCalculatorSource,
            IBlockProcessingQueue processingQueue,
            ISyncModeSelector syncModeSelector)
        {
            _readOnlyDbProvider              = readOnlyDbProvider ?? throw new ArgumentNullException(nameof(readOnlyDbProvider));
            _blockValidator                  = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
            _recoveryStep                    = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
            _rewardCalculatorSource          = rewardCalculatorSource ?? throw new ArgumentNullException(nameof(rewardCalculatorSource));
            _standardProcessorQueue          = processingQueue ?? throw new ArgumentNullException(nameof(processingQueue));
            _syncModeSelector                = syncModeSelector ?? throw new ArgumentNullException(nameof(syncModeSelector));
            _specProvider                    = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _logManager                      = logManager ?? throw new ArgumentNullException(nameof(logManager));
            _readOnlyBlockTree               = new ReadOnlyBlockTree(blockTree);
            blockTree.NewBestSuggestedBlock += OnNewBlock;
            _logger      = logManager.GetClassLogger();
            _blockAction = BeamProcess;

            _syncModeSelector.Preparing += SyncModeSelectorOnPreparing;
            _syncModeSelector.Changing  += SyncModeSelectorOnChanging;
            _syncModeSelector.Changed   += SyncModeSelectorOnChanged;
        }
        public BlockProducerEnvFactory(
            IDbProvider dbProvider,
            IBlockTree blockTree,
            IReadOnlyTrieStore readOnlyTrieStore,
            ISpecProvider specProvider,
            IBlockValidator blockValidator,
            IRewardCalculatorSource rewardCalculatorSource,
            IReceiptStorage receiptStorage,
            IBlockPreprocessorStep blockPreprocessorStep,
            ITxPool txPool,
            ITransactionComparerProvider transactionComparerProvider,
            IMiningConfig miningConfig,
            ILogManager logManager)
        {
            _dbProvider             = dbProvider;
            _blockTree              = blockTree;
            _readOnlyTrieStore      = readOnlyTrieStore;
            _specProvider           = specProvider;
            _blockValidator         = blockValidator;
            _rewardCalculatorSource = rewardCalculatorSource;
            _receiptStorage         = receiptStorage;
            _blockPreprocessorStep  = blockPreprocessorStep;
            _txPool = txPool;
            _transactionComparerProvider = transactionComparerProvider;
            _miningConfig = miningConfig;
            _logManager   = logManager;

            TransactionsExecutorFactory = new BlockProducerTransactionsExecutorFactory(specProvider, logManager);
        }
 private BlockProcessor CreateBlockProcessor(
     ReadOnlyTxProcessingEnv readOnlyTxProcessingEnv,
     ISpecProvider specProvider,
     IBlockValidator blockValidator,
     IRewardCalculatorSource rewardCalculatorSource,
     ITxPool txPool,
     IReceiptStorage receiptStorage,
     ILogManager logManager) =>
 public MulticallModuleFactory(IDbProvider dbProvider, IBlockTree blockTree, IJsonRpcConfig jsonRpcConfig, IReadOnlyTrieStore trieNodeResolver, IBlockPreprocessorStep recoveryStep, IRewardCalculatorSource rewardCalculatorSource, IReceiptStorage receiptFinder, ISpecProvider specProvider, ILogManager logManager)
 {
     this.dbProvider             = dbProvider.AsReadOnly(false);
     this.blockTree              = blockTree.AsReadOnly();
     this.jsonRpcConfig          = jsonRpcConfig;
     this.trieNodeResolver       = trieNodeResolver;
     this.recoveryStep           = recoveryStep;
     this.rewardCalculatorSource = rewardCalculatorSource;
     this.receiptFinder          = receiptFinder;
     this.specProvider           = specProvider;
     this.logManager             = logManager;
 }
Beispiel #7
0
        protected BlockProducerContext GetProducerChain(IBlockTree blockTree,
                                                        IDbProvider dbProvider,
                                                        IReadOnlyTrieStore readOnlyTrieStore,
                                                        IBlockPreprocessorStep blockPreprocessor,
                                                        ITxPool txPool,
                                                        IBlockValidator blockValidator,
                                                        IRewardCalculatorSource rewardCalculatorSource,
                                                        IReceiptStorage receiptStorage,
                                                        ISpecProvider specProvider,
                                                        IMiningConfig miningConfig,
                                                        ILogManager logManager)
        {
            ReadOnlyDbProvider readOnlyDbProvider = dbProvider.AsReadOnly(false);
            ReadOnlyBlockTree  readOnlyBlockTree  = blockTree.AsReadOnly();

            ReadOnlyTxProcessingEnv txProcessingEnv =
                new(readOnlyDbProvider, readOnlyTrieStore, readOnlyBlockTree, specProvider, logManager);
            ITransactionComparerProvider transactionComparerProvider = new TransactionComparerProvider(specProvider, blockTree);

            BlockProcessor blockProcessor =
                CreateBlockProcessor(txProcessingEnv,
                                     specProvider,
                                     blockValidator,
                                     rewardCalculatorSource,
                                     txPool,
                                     receiptStorage,
                                     logManager);

            IBlockchainProcessor blockchainProcessor =
                new BlockchainProcessor(
                    readOnlyBlockTree,
                    blockProcessor,
                    blockPreprocessor,
                    logManager,
                    BlockchainProcessor.Options.NoReceipts);

            OneTimeChainProcessor chainProcessor = new(
                readOnlyDbProvider,
                blockchainProcessor);

            return(new BlockProducerContext
            {
                ChainProcessor = chainProcessor,
                ReadOnlyStateProvider = txProcessingEnv.StateProvider,
                TxSource = CreateTxSourceForProducer(txProcessingEnv, txPool, specProvider, logManager, miningConfig, transactionComparerProvider),
                ReadOnlyTxProcessingEnv = txProcessingEnv
            });
        }
 public TraceModuleFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IBlockDataRecoveryStep recoveryStep,
     IRewardCalculatorSource rewardCalculatorSource,
     IReceiptStorage receiptStorage,
     ISpecProvider specProvider,
     ILogManager logManager)
 {
     _dbProvider             = dbProvider ?? throw new ArgumentNullException(nameof(dbProvider));
     _blockTree              = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _recoveryStep           = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _rewardCalculatorSource = rewardCalculatorSource ?? throw new ArgumentNullException(nameof(rewardCalculatorSource));
     _receiptStorage         = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
     _specProvider           = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _logManager             = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _logger = logManager.GetClassLogger();
 }
Beispiel #9
0
        public override Eth2BlockProducer Create(
            IBlockTree blockTree,
            IDbProvider dbProvider,
            IReadOnlyTrieStore readOnlyTrieStore,
            IBlockPreprocessorStep blockPreprocessor,
            ITxPool txPool,
            IBlockValidator blockValidator,
            IRewardCalculatorSource rewardCalculatorSource,
            IReceiptStorage receiptStorage,
            IBlockProcessingQueue blockProcessingQueue,
            ISpecProvider specProvider,
            ISigner engineSigner,
            IMiningConfig miningConfig,
            ILogManager logManager)
        {
            BlockProducerContext producerContext = GetProducerChain(
                blockTree,
                dbProvider,
                readOnlyTrieStore,
                blockPreprocessor,
                txPool,
                blockValidator,
                rewardCalculatorSource,
                receiptStorage,
                specProvider,
                miningConfig,
                logManager);

            return(new Eth2TestBlockProducer(
                       producerContext.TxSource,
                       producerContext.ChainProcessor,
                       blockTree,
                       blockProcessingQueue,
                       producerContext.ReadOnlyStateProvider,
                       new TargetAdjustedGasLimitCalculator(specProvider, miningConfig),
                       engineSigner,
                       specProvider,
                       logManager));
        }
Beispiel #10
0
 public TraceModuleFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IReadOnlyTrieStore trieNodeResolver,
     IJsonRpcConfig jsonRpcConfig,
     IBlockPreprocessorStep recoveryStep,
     IRewardCalculatorSource rewardCalculatorSource,
     IReceiptStorage receiptFinder,
     ISpecProvider specProvider,
     ILogManager logManager)
 {
     _dbProvider             = dbProvider.AsReadOnly(false);
     _blockTree              = blockTree.AsReadOnly();
     _trieNodeResolver       = trieNodeResolver;
     _jsonRpcConfig          = jsonRpcConfig ?? throw new ArgumentNullException(nameof(jsonRpcConfig));
     _recoveryStep           = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _rewardCalculatorSource =
         rewardCalculatorSource ?? throw new ArgumentNullException(nameof(rewardCalculatorSource));
     _receiptStorage = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder));
     _specProvider   = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _logManager     = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _logger         = logManager.GetClassLogger();
 }
 public BeamBlockchainProcessor(
     IReadOnlyDbProvider readOnlyDbProvider,
     IBlockTree blockTree,
     ISpecProvider specProvider,
     ILogManager logManager,
     IBlockValidator blockValidator,
     IBlockDataRecoveryStep recoveryStep,
     IRewardCalculatorSource rewardCalculatorSource,
     IBlockProcessingQueue blockchainProcessor)
 {
     _readOnlyDbProvider     = readOnlyDbProvider ?? throw new ArgumentNullException(nameof(readOnlyDbProvider));
     _blockValidator         = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
     _recoveryStep           = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _rewardCalculatorSource = rewardCalculatorSource ?? throw new ArgumentNullException(nameof(rewardCalculatorSource));
     _blockchainProcessor    = blockchainProcessor ?? throw new ArgumentNullException(nameof(blockchainProcessor));
     _blockTree         = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     _specProvider      = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _logManager        = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _readOnlyBlockTree = new ReadOnlyBlockTree(_blockTree);
     _logger            = logManager.GetClassLogger();
     _blockTree.NewBestSuggestedBlock += OnNewBlock;
     _blockTree.NewHeadBlock          += BlockTreeOnNewHeadBlock;
 }