Ejemplo n.º 1
0
 public DebugModuleFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IJsonRpcConfig jsonRpcConfig,
     IBlockValidator blockValidator,
     IBlockPreprocessorStep recoveryStep,
     IRewardCalculatorSource rewardCalculator,
     IReceiptStorage receiptStorage,
     IReceiptsMigration receiptsMigration,
     IReadOnlyTrieStore trieStore,
     IConfigProvider configProvider,
     ISpecProvider specProvider,
     ILogManager logManager)
 {
     _dbProvider             = dbProvider.AsReadOnly(false);
     _blockTree              = blockTree.AsReadOnly();
     _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));
     _trieStore              = (trieStore ?? throw new ArgumentNullException(nameof(trieStore)));
     _configProvider         = configProvider ?? throw new ArgumentNullException(nameof(configProvider));
     _specProvider           = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _logManager             = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _logger = logManager.GetClassLogger();
 }
Ejemplo n.º 2
0
        public UserOperationSimulator(
            IUserOperationTxBuilder userOperationTxBuilder,
            IStateProvider stateProvider,
            IStateReader stateReader,
            AbiDefinition entryPointContractAbi,
            Address create2FactoryAddress,
            Address entryPointContractAddress,
            ISpecProvider specProvider,
            IBlockTree blockTree,
            IDbProvider dbProvider,
            IReadOnlyTrieStore trieStore,
            ITimestamper timestamper,
            ILogManager logManager)
        {
            _userOperationTxBuilder    = userOperationTxBuilder;
            _stateProvider             = stateProvider;
            _stateReader               = stateReader;
            _entryPointContractAbi     = entryPointContractAbi;
            _create2FactoryAddress     = create2FactoryAddress;
            _entryPointContractAddress = entryPointContractAddress;
            _specProvider              = specProvider;
            _blockTree   = blockTree;
            _dbProvider  = dbProvider.AsReadOnly(false);
            _trieStore   = trieStore;
            _timestamper = timestamper;
            _logManager  = logManager;

            _abiEncoder = new AbiEncoder();
        }
 public ReadOnlyTxProcessingEnv(
     IDbProvider?dbProvider,
     IReadOnlyTrieStore?trieStore,
     IBlockTree?blockTree,
     ISpecProvider?specProvider,
     ILogManager?logManager)
     : this(dbProvider?.AsReadOnly(false), trieStore, blockTree?.AsReadOnly(), specProvider, logManager)
 {
 }
 public ReadOnlyTxProcessingEnv(
     IDbProvider dbProvider,
     IReadOnlyTrieStore trieStore,
     IBlockTree blockTree,
     ISpecProvider specProvider,
     ILogManager logManager)
     : this(dbProvider.AsReadOnly(false), trieStore, blockTree.AsReadOnly(), specProvider, 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;
 }
Ejemplo n.º 6
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
            });
        }
Ejemplo n.º 7
0
 public ProofModuleFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IReadOnlyTrieStore trieStore,
     IBlockPreprocessorStep recoveryStep,
     IReceiptFinder receiptFinder,
     ISpecProvider specProvider,
     ILogManager logManager)
 {
     _logManager    = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _recoveryStep  = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _receiptFinder = receiptFinder ?? throw new ArgumentNullException(nameof(receiptFinder));
     _specProvider  = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _dbProvider    = dbProvider.AsReadOnly(false);
     _blockTree     = blockTree.AsReadOnly();
     _trieStore     = trieStore;
 }
Ejemplo n.º 8
0
 public TracerFactory(
     IDbProvider dbProvider,
     IBlockTree blockTree,
     IReadOnlyTrieStore trieStore,
     IBlockPreprocessorStep recoveryStep,
     ISpecProvider specProvider,
     ILogManager logManager,
     ProcessingOptions processingOptions = ProcessingOptions.Trace)
 {
     _logManager        = logManager ?? throw new ArgumentNullException(nameof(logManager));
     _processingOptions = processingOptions;
     _recoveryStep      = recoveryStep ?? throw new ArgumentNullException(nameof(recoveryStep));
     _specProvider      = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _dbProvider        = dbProvider.AsReadOnly(false);
     _blockTree         = blockTree.AsReadOnly();
     _trieStore         = trieStore;
 }
        public virtual BlockProducerEnv Create(ITxSource?additionalTxSource = null)
        {
            ReadOnlyDbProvider readOnlyDbProvider = _dbProvider.AsReadOnly(false);
            ReadOnlyBlockTree  readOnlyBlockTree  = _blockTree.AsReadOnly();

            ReadOnlyTxProcessingEnv txProcessingEnv =
                CreateReadonlyTxProcessingEnv(readOnlyDbProvider, readOnlyBlockTree);

            BlockProcessor blockProcessor =
                CreateBlockProcessor(txProcessingEnv,
                                     _specProvider,
                                     _blockValidator,
                                     _rewardCalculatorSource,
                                     _receiptStorage,
                                     _logManager,
                                     _miningConfig);

            IBlockchainProcessor blockchainProcessor =
                new BlockchainProcessor(
                    readOnlyBlockTree,
                    blockProcessor,
                    _blockPreprocessorStep,
                    txProcessingEnv.StateReader,
                    _logManager,
                    BlockchainProcessor.Options.NoReceipts);

            OneTimeChainProcessor chainProcessor = new(
                readOnlyDbProvider,
                blockchainProcessor);

            return(new BlockProducerEnv
            {
                BlockTree = readOnlyBlockTree,
                ChainProcessor = chainProcessor,
                ReadOnlyStateProvider = txProcessingEnv.StateProvider,
                TxSource = CreateTxSourceForProducer(additionalTxSource, txProcessingEnv, _txPool, _miningConfig, _transactionComparerProvider, _logManager),
                ReadOnlyTxProcessingEnv = txProcessingEnv
            });
        }
Ejemplo n.º 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();
 }