public override IMulticallModule Create()
        {
            var txProcessingEnv    = new ReadOnlyTxProcessingEnv(dbProvider, trieNodeResolver, blockTree, specProvider, logManager);
            var rewardCalculator   = rewardCalculatorSource.Get(txProcessingEnv.TransactionProcessor);
            var chainProcessingEnv = new ReadOnlyChainProcessingEnv(txProcessingEnv, Always.Valid, recoveryStep, rewardCalculator, receiptFinder, dbProvider, specProvider, logManager);
            var tracer             = new MyTracer(chainProcessingEnv.StateProvider, chainProcessingEnv.ChainProcessor);

            return(new MulticallModule(tracer, blockTree, jsonRpcConfig));
        }
Beispiel #2
0
        public override IDebugModule Create()
        {
            IReadOnlyDbProvider readOnlyDbProvider = new ReadOnlyDbProvider(_dbProvider, false);
            ReadOnlyBlockTree   readOnlyTree       = new ReadOnlyBlockTree(_blockTree);

            ReadOnlyTxProcessingEnv txEnv =
                new ReadOnlyTxProcessingEnv(
                    readOnlyDbProvider,
                    readOnlyTree,
                    _specProvider,
                    _logManager);

            ReadOnlyChainProcessingEnv readOnlyChainProcessingEnv =
                new ReadOnlyChainProcessingEnv(
                    txEnv,
                    _blockValidator,
                    _recoveryStep,
                    _rewardCalculatorSource.Get(txEnv.TransactionProcessor),
                    _receiptStorage,
                    readOnlyDbProvider,
                    _specProvider,
                    _logManager);

            IGethStyleTracer tracer =
                new GethStyleTracer(
                    readOnlyChainProcessingEnv.ChainProcessor,
                    _receiptStorage,
                    new ReadOnlyBlockTree(_blockTree));

            DebugBridge debugBridge =
                new DebugBridge(
                    _configProvider,
                    readOnlyDbProvider,
                    tracer,
                    readOnlyTree,
                    _receiptStorage,
                    _receiptsMigration,
                    _specProvider);

            return(new DebugModule(_logManager, debugBridge, _jsonRpcConfig));
        }
Beispiel #3
0
        public override ITraceModule Create()
        {
            ReadOnlyTxProcessingEnv txProcessingEnv =
                new(_dbProvider, _trieNodeResolver, _blockTree, _specProvider, _logManager);

            IRewardCalculator rewardCalculator = _rewardCalculatorSource.Get(txProcessingEnv.TransactionProcessor);

            ReadOnlyChainProcessingEnv chainProcessingEnv = new(
                txProcessingEnv,
                Always.Valid,
                _recoveryStep,
                rewardCalculator,
                _receiptStorage,
                _dbProvider,
                _specProvider,
                _logManager);

            Tracer tracer = new(chainProcessingEnv.StateProvider, chainProcessingEnv.ChainProcessor);

            return(new TraceModule(_receiptStorage, tracer, _blockTree, _jsonRpcConfig));
        }
        public override ITraceModule Create()
        {
            var    readOnlyTree               = new ReadOnlyBlockTree(_blockTree);
            var    readOnlyDbProvider         = new ReadOnlyDbProvider(_dbProvider, false);
            var    readOnlyTxProcessingEnv    = new ReadOnlyTxProcessingEnv(readOnlyDbProvider, readOnlyTree, _specProvider, _logManager);
            var    readOnlyChainProcessingEnv = new ReadOnlyChainProcessingEnv(readOnlyTxProcessingEnv, AlwaysValidBlockValidator.Instance, _recoveryStep, _rewardCalculatorSource.Get(readOnlyTxProcessingEnv.TransactionProcessor), _receiptStorage, readOnlyDbProvider, _specProvider, _logManager);
            Tracer tracer = new Tracer(readOnlyChainProcessingEnv.StateProvider, readOnlyChainProcessingEnv.ChainProcessor);

            return(new TraceModule(_receiptStorage, tracer, readOnlyTree));
        }
        private (IBlockchainProcessor, IStateReader) CreateProcessor(Block block, IReadOnlyDbProvider readOnlyDbProvider, ISpecProvider specProvider, ILogManager logManager)
        {
            ReadOnlyTxProcessingEnv    txEnv = new ReadOnlyTxProcessingEnv(readOnlyDbProvider, _readOnlyBlockTree, specProvider, logManager);
            ReadOnlyChainProcessingEnv env   = new ReadOnlyChainProcessingEnv(txEnv, _blockValidator, _recoveryStep, _rewardCalculatorSource.Get(txEnv.TransactionProcessor), NullReceiptStorage.Instance, _readOnlyDbProvider, specProvider, logManager);

            env.BlockProcessor.TransactionProcessed += (sender, args) =>
            {
                if (_logger.IsInfo)
                {
                    _logger.Info($"Processed tx {args.Index}/{block.Transactions.Length} of {block.Number}");
                }
            };

            return(env.ChainProcessor, txEnv.StateReader);
        }
 public IRewardCalculator Get(ITransactionProcessor processor)
 {
     return(new MergeRewardCalculator(_beforeTheMerge.Get(processor), _poSSwitcher));
 }
Beispiel #7
0
        public override IDebugModule Create()
        {
            IReadOnlyDbProvider        readOnlyDbProvider = new ReadOnlyDbProvider(_dbProvider, false);
            ReadOnlyBlockTree          readOnlyTree       = new ReadOnlyBlockTree(_blockTree);
            ReadOnlyTxProcessingEnv    txEnv = new ReadOnlyTxProcessingEnv(readOnlyDbProvider, readOnlyTree, _specProvider, _logManager);
            ReadOnlyChainProcessingEnv readOnlyChainProcessingEnv = new ReadOnlyChainProcessingEnv(txEnv, _blockValidator, _recoveryStep, _rewardCalculatorSource.Get(txEnv.TransactionProcessor), _receiptStorage, readOnlyDbProvider, _specProvider, _logManager);

            TimeSpan          cancellationTokenTimeout = TimeSpan.FromMilliseconds(_jsonRpcConfig.TracerTimeout);
            CancellationToken cancellationToken        = new CancellationTokenSource(cancellationTokenTimeout).Token;

            IGethStyleTracer tracer = new GethStyleTracer(readOnlyChainProcessingEnv.ChainProcessor, _receiptStorage, new ReadOnlyBlockTree(_blockTree), cancellationToken);

            DebugBridge debugBridge = new DebugBridge(_configProvider, readOnlyDbProvider, tracer, readOnlyChainProcessingEnv.BlockProcessingQueue, readOnlyTree);

            return(new DebugModule(_logManager, debugBridge));
        }
        public override ITraceModule Create()
        {
            var    readOnlyTree               = new ReadOnlyBlockTree(_blockTree);
            var    readOnlyDbProvider         = new ReadOnlyDbProvider(_dbProvider, false);
            var    readOnlyTxProcessingEnv    = new ReadOnlyTxProcessingEnv(readOnlyDbProvider, readOnlyTree, _specProvider, _logManager);
            var    readOnlyChainProcessingEnv = new ReadOnlyChainProcessingEnv(readOnlyTxProcessingEnv, Always.Valid, _recoveryStep, _rewardCalculatorSource.Get(readOnlyTxProcessingEnv.TransactionProcessor), _receiptStorage, readOnlyDbProvider, _specProvider, _logManager);
            Tracer tracer = new Tracer(readOnlyChainProcessingEnv.StateProvider, readOnlyChainProcessingEnv.ChainProcessor);

            TimeSpan          cancellationTokenTimeout = TimeSpan.FromMilliseconds(_jsonRpcConfig.TracerTimeout);
            CancellationToken cancellationToken        = new CancellationTokenSource(cancellationTokenTimeout).Token;

            return(new TraceModule(_receiptStorage, tracer, readOnlyTree, cancellationToken));
        }