private static ITxFilter CreateBaseAuRaTxFilter( IMiningConfig miningConfig, AuRaNethermindApi api, IReadOnlyTxProcessorSource readOnlyTxProcessorSource, IDictionaryContractDataStore <TxPriorityContract.Destination>?minGasPricesContractDataStore, ISpecProvider specProvider) { IMinGasPriceTxFilter minGasPriceTxFilter = CreateStandardMinGasPriceTxFilter(miningConfig, specProvider); ITxFilter gasPriceTxFilter = minGasPriceTxFilter; if (minGasPricesContractDataStore != null) { gasPriceTxFilter = new MinGasPriceContractTxFilter(minGasPriceTxFilter, minGasPricesContractDataStore); } Address?registrar = api.ChainSpec?.Parameters.Registrar; if (registrar != null) { RegisterContract registerContract = new(api.AbiEncoder, registrar, readOnlyTxProcessorSource); CertifierContract certifierContract = new(api.AbiEncoder, registerContract, readOnlyTxProcessorSource); return(new TxCertifierFilter(certifierContract, gasPriceTxFilter, specProvider, api.LogManager)); } return(gasPriceTxFilter); }
protected override TxPool.TxPool CreateTxPool(PersistentTxStorage txStorage) { // This has to be different object than the _processingReadOnlyTransactionProcessorSource as this is in separate thread var txPoolReadOnlyTransactionProcessorSource = CreateReadOnlyTransactionProcessorSource(); var(txPriorityContract, localDataSource) = TxFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, txPoolReadOnlyTransactionProcessorSource !); ReportTxPriorityRules(txPriorityContract, localDataSource); var minGasPricesContractDataStore = TxFilterBuilders.CreateMinGasPricesDataStore(_api, txPriorityContract, localDataSource); ITxFilter txPoolFilter = TxFilterBuilders.CreateAuRaTxFilter( NethermindApi.Config <IMiningConfig>(), _api, txPoolReadOnlyTransactionProcessorSource, minGasPricesContractDataStore); return(new FilteredTxPool( txStorage, _api.EthereumEcdsa, new ChainHeadSpecProvider(_api.SpecProvider, _api.BlockTree), NethermindApi.Config <ITxPoolConfig>(), _api.ChainHeadStateProvider, _api.TxValidator, _api.LogManager, CreateTxPoolTxComparer(txPriorityContract, localDataSource), new TxFilterAdapter(_api.BlockTree, txPoolFilter))); }
public TxCertifierFilter(ICertifierContract certifierContract, ITxFilter notCertifiedFilter, ISpecProvider specProvider, ILogManager logManager) { _certifierContract = certifierContract ?? throw new ArgumentNullException(nameof(certifierContract)); _notCertifiedFilter = notCertifiedFilter ?? throw new ArgumentNullException(nameof(notCertifiedFilter)); _specProvider = specProvider ?? throw new ArgumentNullException(nameof(specProvider)); _logger = logManager?.GetClassLogger <TxCertifierFilter>() ?? throw new ArgumentNullException(nameof(logManager)); }
public TxPoolTxSource(ITxPool transactionPool, IStateReader stateReader, ILogManager logManager, ITxFilter txFilter = null) { _transactionPool = transactionPool ?? throw new ArgumentNullException(nameof(transactionPool)); _stateReader = stateReader ?? throw new ArgumentNullException(nameof(stateReader)); _txFilter = txFilter ?? new MinGasPriceTxFilter(UInt256.Zero); _logger = logManager?.GetClassLogger <TxPoolTxSource>() ?? throw new ArgumentNullException(nameof(logManager)); }
public AuRaBlockProcessor( ISpecProvider specProvider, IBlockValidator blockValidator, IRewardCalculator rewardCalculator, IBlockProcessor.IBlockTransactionsExecutor blockTransactionsExecutor, IStateProvider stateProvider, IStorageProvider storageProvider, IReceiptStorage receiptStorage, ILogManager logManager, IBlockTree blockTree, ITxFilter?txFilter = null, AuRaContractGasLimitOverride?gasLimitOverride = null) : base( specProvider, blockValidator, rewardCalculator, blockTransactionsExecutor, stateProvider, storageProvider, receiptStorage, NullWitnessCollector.Instance, logManager) { _specProvider = specProvider; _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); _logger = logManager?.GetClassLogger <AuRaBlockProcessor>() ?? throw new ArgumentNullException(nameof(logManager)); _txFilter = txFilter ?? NullTxFilter.Instance; _gasLimitOverride = gasLimitOverride; if (blockTransactionsExecutor is IBlockProductionTransactionsExecutor produceBlockTransactionsStrategy) { produceBlockTransactionsStrategy.AddingTransaction += OnAddingTransaction; } }
public AuRaBlockProcessor( ISpecProvider specProvider, IBlockValidator blockValidator, IRewardCalculator rewardCalculator, ITransactionProcessor transactionProcessor, IStateProvider stateProvider, IStorageProvider storageProvider, ITxPool txPool, IReceiptStorage receiptStorage, ILogManager logManager, IBlockTree blockTree, ITxFilter?txFilter = null, AuRaContractGasLimitOverride?gasLimitOverride = null) : base( specProvider, blockValidator, rewardCalculator, transactionProcessor, stateProvider, storageProvider, txPool, receiptStorage, NullWitnessCollector.Instance, // TODO: we will not support beam sync on AuRa chains for now logManager) { _specProvider = specProvider; _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); _logger = logManager?.GetClassLogger <AuRaBlockProcessor>() ?? throw new ArgumentNullException(nameof(logManager)); _txFilter = txFilter ?? NullTxFilter.Instance; _gasLimitOverride = gasLimitOverride; }
public void should_not_accept_any_transaction_when_using_reject_all_filter() { _filter = new RejectAllTxFilter(); var transactions = GetTransactions(); var addedTransactions = ApplyFilter(transactions); addedTransactions.Should().BeEmpty(); }
public void should_accept_any_transaction_when_using_accept_all_filter() { _filter = new AcceptAllTxFilter(); var transactions = GetTransactions(); var addedTransactions = ApplyFilter(transactions); addedTransactions.Length.Should().Be(transactions.Length); }
private TxPoolTxSource CreateTxPoolTxSource(ReadOnlyTxProcessingEnv processingEnv, IReadOnlyTxProcessorSource readOnlyTxProcessorSource) { // We need special one for TxPriority as its following Head separately with events and we want rules from Head, not produced block IReadOnlyTxProcessorSource readOnlyTxProcessorSourceForTxPriority = new ReadOnlyTxProcessingEnv(_api.DbProvider, _api.ReadOnlyTrieStore, _api.BlockTree, _api.SpecProvider, _api.LogManager); (_txPriorityContract, _localDataSource) = TxAuRaFilterBuilders.CreateTxPrioritySources(_auraConfig, _api, readOnlyTxProcessorSourceForTxPriority); if (_txPriorityContract != null || _localDataSource != null) { _minGasPricesContractDataStore = TxAuRaFilterBuilders.CreateMinGasPricesDataStore(_api, _txPriorityContract, _localDataSource) !; _api.DisposeStack.Push(_minGasPricesContractDataStore); ContractDataStore <Address> whitelistContractDataStore = new ContractDataStoreWithLocalData <Address>( new HashSetContractDataStoreCollection <Address>(), _txPriorityContract?.SendersWhitelist, _api.BlockTree, _api.ReceiptFinder, _api.LogManager, _localDataSource?.GetWhitelistLocalDataSource() ?? new EmptyLocalDataSource <IEnumerable <Address> >()); DictionaryContractDataStore <TxPriorityContract.Destination> prioritiesContractDataStore = new DictionaryContractDataStore <TxPriorityContract.Destination>( new TxPriorityContract.DestinationSortedListContractDataStoreCollection(), _txPriorityContract?.Priorities, _api.BlockTree, _api.ReceiptFinder, _api.LogManager, _localDataSource?.GetPrioritiesLocalDataSource()); _api.DisposeStack.Push(whitelistContractDataStore); _api.DisposeStack.Push(prioritiesContractDataStore); ITxFilter auraTxFilter = CreateAuraTxFilterForProducer(readOnlyTxProcessorSource, _api.SpecProvider); ITxFilterPipeline txFilterPipeline = new TxFilterPipelineBuilder(_api.LogManager) .WithCustomTxFilter(auraTxFilter) .WithBaseFeeFilter(_api.SpecProvider) .WithNullTxFilter() .Build; return(new TxPriorityTxSource( _api.TxPool, processingEnv.StateReader, _api.LogManager, txFilterPipeline, whitelistContractDataStore, prioritiesContractDataStore, _api.SpecProvider, _api.TransactionComparerProvider)); } else { return(CreateStandardTxPoolTxSource(processingEnv, readOnlyTxProcessorSource)); } }
private TxPoolTxSource CreateStandardTxPoolTxSource(ReadOnlyTxProcessingEnv processingEnv, IReadOnlyTxProcessorSource readOnlyTxProcessorSource) { ITxFilter txSourceFilter = CreateAuraTxFilterForProducer(readOnlyTxProcessorSource, _api.SpecProvider); ITxFilterPipeline txFilterPipeline = new TxFilterPipelineBuilder(_api.LogManager) .WithCustomTxFilter(txSourceFilter) .WithBaseFeeFilter(_api.SpecProvider) .Build; return(new TxPoolTxSource(_api.TxPool, _api.SpecProvider, _api.TransactionComparerProvider, _api.LogManager, txFilterPipeline)); }
public void should_add_some_transactions_to_storage_when_using_accept_when_filter() { _filter = AcceptWhenTxFilter .Create() .Nonce(n => n >= 0) .GasPrice(p => p > 2 && p < 1500) .Build(); var transactions = GetTransactions(); var addedTransactions = ApplyFilter(transactions); addedTransactions.Should().NotBeEmpty(); }
public static ITxFilter CreateAuRaTxFilter( AuRaNethermindApi api, IReadOnlyTxProcessorSource readOnlyTxProcessorSource, ISpecProvider specProvider) { ITxFilter baseAuRaTxFilter = CreateBaseAuRaTxFilter(api, readOnlyTxProcessorSource, specProvider); ITxFilter?txPermissionFilter = CreateTxPermissionFilter(api, readOnlyTxProcessorSource); return(txPermissionFilter != null ? new CompositeTxFilter(baseAuRaTxFilter, txPermissionFilter) : baseAuRaTxFilter); }
public TxPriorityTxSource( ITxPool transactionPool, IStateReader stateReader, ILogManager logManager, ITxFilter minGasPriceFilter, IContractDataStore <Address> sendersWhitelist, // expected HashSet based IDictionaryContractDataStore <TxPriorityContract.Destination> priorities) // expected SortedList based : base(transactionPool, stateReader, logManager, minGasPriceFilter) { _sendersWhitelist = sendersWhitelist ?? throw new ArgumentNullException(nameof(sendersWhitelist)); _priorities = priorities ?? throw new ArgumentNullException(nameof(priorities)); }
public static ITxFilter CreateAuRaTxFilter( IMiningConfig miningConfig, AuRaNethermindApi api, IReadOnlyTxProcessorSource readOnlyTxProcessorSource, IDictionaryContractDataStore <TxPriorityContract.Destination>?minGasPricesContractDataStore) { ITxFilter baseAuRaTxFilter = CreateBaseAuRaTxFilter(miningConfig, api, readOnlyTxProcessorSource, minGasPricesContractDataStore); ITxFilter?txPermissionFilter = CreateTxPermissionFilter(api, readOnlyTxProcessorSource); return(txPermissionFilter != null ? new CompositeTxFilter(baseAuRaTxFilter, txPermissionFilter) : baseAuRaTxFilter); }
protected override ITxFilter CreateGasPriceTxFilter(ReadOnlyTxProcessorSource readOnlyTxProcessorSource) { ITxFilter gasPriceTxFilter = base.CreateGasPriceTxFilter(readOnlyTxProcessorSource); Address? registrar = _api.ChainSpec?.Parameters.Registrar; if (registrar != null) { RegisterContract registerContract = new RegisterContract(_api.AbiEncoder, registrar, readOnlyTxProcessorSource); CertifierContract certifierContract = new CertifierContract(_api.AbiEncoder, registerContract, readOnlyTxProcessorSource); return(new TxCertifierFilter(certifierContract, gasPriceTxFilter, _api.LogManager)); } return(gasPriceTxFilter); }
public void SetUp() { _certifierContract = Substitute.For <ICertifierContract>(); _notCertifiedFilter = Substitute.For <ITxFilter>(); _notCertifiedFilter.IsAllowed(Arg.Any <Transaction>(), Arg.Any <BlockHeader>()) .Returns((false, string.Empty)); _certifierContract.Certified(Arg.Any <BlockHeader>(), Arg.Is <Address>(a => TestItem.Addresses.Take(3).Contains(a))) .Returns(true); _filter = new TxCertifierFilter(_certifierContract, _notCertifiedFilter, LimboLogs.Instance); }
protected virtual BlockProcessor NewBlockProcessor(AuRaNethermindApi api, ITxFilter txFilter, ContractRewriter contractRewriter) => new AuRaBlockProcessor( _api.SpecProvider, _api.BlockValidator, _api.RewardCalculatorSource.Get(_api.TransactionProcessor), new BlockProcessor.BlockValidationTransactionsExecutor(_api.TransactionProcessor, _api.StateProvider), _api.StateProvider, _api.StorageProvider, _api.ReceiptStorage, _api.LogManager, _api.BlockTree, txFilter, GetGasLimitCalculator(), contractRewriter );
public void SetUp() { _certifierContract = Substitute.For <ICertifierContract>(); _notCertifiedFilter = Substitute.For <ITxFilter>(); _specProvider = Substitute.For <ISpecProvider>(); _notCertifiedFilter.IsAllowed(Arg.Any <Transaction>(), Arg.Any <BlockHeader>()) .Returns(AcceptTxResult.Invalid); _certifierContract.Certified(Arg.Any <BlockHeader>(), Arg.Is <Address>(a => TestItem.Addresses.Take(3).Contains(a))) .Returns(true); _filter = new TxCertifierFilter(_certifierContract, _notCertifiedFilter, _specProvider, LimboLogs.Instance); }
private static ITxFilter CreateBaseAuRaTxFilter( AuRaNethermindApi api, IReadOnlyTxProcessorSource readOnlyTxProcessorSource, ISpecProvider specProvider, ITxFilter baseTxFilter) { Address?registrar = api.ChainSpec?.Parameters.Registrar; if (registrar != null) { RegisterContract registerContract = new(api.AbiEncoder, registrar, readOnlyTxProcessorSource); CertifierContract certifierContract = new(api.AbiEncoder, registerContract, readOnlyTxProcessorSource); return(CreateFilter(new TxCertifierFilter(certifierContract, baseTxFilter, specProvider, api.LogManager))); } return(baseTxFilter); }
protected override BlockProcessor NewBlockProcessor(AuRaNethermindApi api, ITxFilter txFilter, ContractRewriter contractRewriter) { return(new AuRaMergeBlockProcessor( _api.PoSSwitcher !, _api.SpecProvider !, _api.BlockValidator !, _api.RewardCalculatorSource !.Get(_api.TransactionProcessor !), new BlockProcessor.BlockValidationTransactionsExecutor(_api.TransactionProcessor !, _api.StateProvider !), _api.StateProvider !, _api.StorageProvider !, _api.ReceiptStorage !, _api.LogManager, _api.BlockTree !, txFilter, GetGasLimitCalculator(), contractRewriter )); }
private AuRaBlockProcessor CreateProcessor(ITxFilter txFilter = null) { IDb stateDb = new MemDb(); IDb codeDb = new MemDb(); TrieStore trieStore = new(stateDb, LimboLogs.Instance); IStateProvider stateProvider = new StateProvider(trieStore, codeDb, LimboLogs.Instance); ITransactionProcessor transactionProcessor = Substitute.For <ITransactionProcessor>(); return(new AuRaBlockProcessor( RinkebySpecProvider.Instance, TestBlockValidator.AlwaysValid, NoBlockRewards.Instance, new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider), stateProvider, new StorageProvider(trieStore, stateProvider, LimboLogs.Instance), NullReceiptStorage.Instance, LimboLogs.Instance, Substitute.For <IBlockTree>(), txFilter)); }
public AuRaBlockProcessor( ISpecProvider specProvider, IBlockValidator blockValidator, IRewardCalculator rewardCalculator, ITransactionProcessor transactionProcessor, ISnapshotableDb stateDb, ISnapshotableDb codeDb, IStateProvider stateProvider, IStorageProvider storageProvider, ITxPool txPool, IReceiptStorage receiptStorage, ILogManager logManager, IBlockTree blockTree, ITxFilter txFilter = null, AuRaContractGasLimitOverride gasLimitOverride = null) : base(specProvider, blockValidator, rewardCalculator, transactionProcessor, stateDb, codeDb, stateProvider, storageProvider, txPool, receiptStorage, logManager) { _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); _logger = logManager?.GetClassLogger <AuRaBlockProcessor>() ?? throw new ArgumentNullException(nameof(logManager)); _txFilter = txFilter ?? NullTxFilter.Instance; _gasLimitOverride = gasLimitOverride; }
public void For_not_empty_block_tx_filter_should_be_called() { ITxFilter txFilter = Substitute.For <ITxFilter>(); txFilter .IsAllowed(Arg.Any <Transaction>(), Arg.Any <BlockHeader>()) .Returns(AcceptTxResult.Accepted); AuRaBlockProcessor processor = CreateProcessor(txFilter).Processor; BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).WithNumber(3).TestObject; Transaction tx = Nethermind.Core.Test.Builders.Build.A.Transaction.WithData(new byte[] { 0, 1 }) .SignedAndResolved().WithChainId(105).WithGasPrice(0).WithValue(0).TestObject; Block block = Build.A.Block.WithHeader(header).WithTransactions(new Transaction[] { tx }).TestObject; Block[] processedBlocks = processor.Process( Keccak.EmptyTreeHash, new List <Block> { block }, ProcessingOptions.None, NullBlockTracer.Instance); txFilter.Received().IsAllowed(Arg.Any <Transaction>(), Arg.Any <BlockHeader>()); }
protected override BlockProcessor CreateBlockProcessor() { if (_api.SpecProvider == null) { throw new StepDependencyException(nameof(_api.SpecProvider)); } if (_api.ChainHeadStateProvider == null) { throw new StepDependencyException(nameof(_api.ChainHeadStateProvider)); } if (_api.BlockValidator == null) { throw new StepDependencyException(nameof(_api.BlockValidator)); } if (_api.RewardCalculatorSource == null) { throw new StepDependencyException(nameof(_api.RewardCalculatorSource)); } if (_api.TransactionProcessor == null) { throw new StepDependencyException(nameof(_api.TransactionProcessor)); } if (_api.DbProvider == null) { throw new StepDependencyException(nameof(_api.DbProvider)); } if (_api.StateProvider == null) { throw new StepDependencyException(nameof(_api.StateProvider)); } if (_api.StorageProvider == null) { throw new StepDependencyException(nameof(_api.StorageProvider)); } if (_api.TxPool == null) { throw new StepDependencyException(nameof(_api.TxPool)); } if (_api.ReceiptStorage == null) { throw new StepDependencyException(nameof(_api.ReceiptStorage)); } if (_api.BlockTree == null) { throw new StepDependencyException(nameof(_api.BlockTree)); } if (_api.GasPriceOracle == null) { throw new StepDependencyException(nameof(_api.GasPriceOracle)); } if (_api.ChainSpec == null) { throw new StepDependencyException(nameof(_api.ChainSpec)); } var processingReadOnlyTransactionProcessorSource = CreateReadOnlyTransactionProcessorSource(); var txPermissionFilterOnlyTxProcessorSource = CreateReadOnlyTransactionProcessorSource(); ITxFilter auRaTxFilter = TxAuRaFilterBuilders.CreateAuRaTxFilter( _api, txPermissionFilterOnlyTxProcessorSource, _api.SpecProvider, new ServiceTxFilter(_api.SpecProvider)); IDictionary <long, IDictionary <Address, byte[]> > rewriteBytecode = _api.ChainSpec.AuRa.RewriteBytecode; ContractRewriter?contractRewriter = rewriteBytecode?.Count > 0 ? new ContractRewriter(rewriteBytecode) : null; var processor = (AuRaBlockProcessor)NewBlockProcessor(_api, auRaTxFilter, contractRewriter); var auRaValidator = CreateAuRaValidator(processor, processingReadOnlyTransactionProcessorSource); processor.AuRaValidator = auRaValidator; var reportingValidator = auRaValidator.GetReportingValidator(); _api.ReportingValidator = reportingValidator; if (_sealValidator != null) { _sealValidator.ReportingValidator = reportingValidator; } return(processor); }
public TxFilterPipelineBuilder WithCustomTxFilter(ITxFilter txFilter) { _filterPipeline.AddTxFilter(txFilter); return(this); }
public TxFilterAdapter(IBlockTree blockTree, ITxFilter txFilter) { _txFilter = txFilter ?? throw new ArgumentNullException(nameof(txFilter)); _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); }
public MinGasPriceContractTxFilter(ITxFilter minGasPriceFilter, IDictionaryContractDataStore <TxPriorityContract.Destination> minGasPrices) { _minGasPriceFilter = minGasPriceFilter; _minGasPrices = minGasPrices ?? throw new ArgumentNullException(nameof(minGasPrices)); }
public FilteredTxSource(ITxSource innerSource, ITxFilter txFilter) { _innerSource = innerSource; _txFilter = txFilter; }
protected override BlockProcessor CreateBlockProcessor() { if (_api.SpecProvider == null) { throw new StepDependencyException(nameof(_api.SpecProvider)); } if (_api.ChainHeadStateProvider == null) { throw new StepDependencyException(nameof(_api.ChainHeadStateProvider)); } if (_api.BlockValidator == null) { throw new StepDependencyException(nameof(_api.BlockValidator)); } if (_api.RewardCalculatorSource == null) { throw new StepDependencyException(nameof(_api.RewardCalculatorSource)); } if (_api.TransactionProcessor == null) { throw new StepDependencyException(nameof(_api.TransactionProcessor)); } if (_api.DbProvider == null) { throw new StepDependencyException(nameof(_api.DbProvider)); } if (_api.StateProvider == null) { throw new StepDependencyException(nameof(_api.StateProvider)); } if (_api.StorageProvider == null) { throw new StepDependencyException(nameof(_api.StorageProvider)); } if (_api.TxPool == null) { throw new StepDependencyException(nameof(_api.TxPool)); } if (_api.ReceiptStorage == null) { throw new StepDependencyException(nameof(_api.ReceiptStorage)); } if (_api.BlockTree == null) { throw new StepDependencyException(nameof(_api.BlockTree)); } if (_api.GasPriceOracle == null) { throw new StepDependencyException(nameof(_api.GasPriceOracle)); } var processingReadOnlyTransactionProcessorSource = CreateReadOnlyTransactionProcessorSource(); var txPermissionFilterOnlyTxProcessorSource = CreateReadOnlyTransactionProcessorSource(); ITxFilter auRaTxFilter = TxAuRaFilterBuilders.CreateAuRaTxFilter( _api, txPermissionFilterOnlyTxProcessorSource, _api.SpecProvider, new ServiceTxFilter(_api.SpecProvider)); var processor = new AuRaBlockProcessor( _api.SpecProvider, _api.BlockValidator, _api.RewardCalculatorSource.Get(_api.TransactionProcessor), new BlockProcessor.BlockValidationTransactionsExecutor(_api.TransactionProcessor, _api.StateProvider), _api.StateProvider, _api.StorageProvider, _api.ReceiptStorage, _api.LogManager, _api.BlockTree, auRaTxFilter, GetGasLimitCalculator()); var auRaValidator = CreateAuRaValidator(processor, processingReadOnlyTransactionProcessorSource); processor.AuRaValidator = auRaValidator; var reportingValidator = auRaValidator.GetReportingValidator(); _api.ReportingValidator = reportingValidator; if (_sealValidator != null) { _sealValidator.ReportingValidator = reportingValidator; } return(processor); }
private BlockProcessor CreateBlockProcessor(ReadOnlyTxProcessingEnv changeableTxProcessingEnv, ReadOnlyTxProcessingEnv constantContractTxProcessingEnv) { if (_api.RewardCalculatorSource == null) { throw new StepDependencyException(nameof(_api.RewardCalculatorSource)); } if (_api.ValidatorStore == null) { throw new StepDependencyException(nameof(_api.ValidatorStore)); } if (_api.ChainSpec == null) { throw new StepDependencyException(nameof(_api.ChainSpec)); } if (_api.BlockTree == null) { throw new StepDependencyException(nameof(_api.BlockTree)); } if (_api.EngineSigner == null) { throw new StepDependencyException(nameof(_api.EngineSigner)); } if (_api.SpecProvider == null) { throw new StepDependencyException(nameof(_api.SpecProvider)); } if (_api.GasPriceOracle == null) { throw new StepDependencyException(nameof(_api.GasPriceOracle)); } var chainSpecAuRa = _api.ChainSpec.AuRa; ITxFilter auRaTxFilter = TxAuRaFilterBuilders.CreateAuRaTxFilter( _api, constantContractTxProcessingEnv, _api.SpecProvider, new LocalTxFilter(_api.EngineSigner)); _validator = new AuRaValidatorFactory(_api.AbiEncoder, changeableTxProcessingEnv.StateProvider, changeableTxProcessingEnv.TransactionProcessor, changeableTxProcessingEnv.BlockTree, constantContractTxProcessingEnv, _api.ReceiptStorage, _api.ValidatorStore, _api.FinalizationManager, NullTxSender.Instance, NullTxPool.Instance, NethermindApi.Config <IMiningConfig>(), _api.LogManager, _api.EngineSigner, _api.SpecProvider, _api.GasPriceOracle, _api.ReportingContractValidatorCache, chainSpecAuRa.PosdaoTransition, true) .CreateValidatorProcessor(chainSpecAuRa.Validators, _api.BlockTree.Head?.Header); if (_validator is IDisposable disposableValidator) { _api.DisposeStack.Push(disposableValidator); } IDictionary <long, IDictionary <Address, byte[]> > rewriteBytecode = chainSpecAuRa.RewriteBytecode; ContractRewriter?contractRewriter = rewriteBytecode?.Count > 0 ? new ContractRewriter(rewriteBytecode) : null; return(new AuRaBlockProcessor( _api.SpecProvider, _api.BlockValidator, _api.RewardCalculatorSource.Get(changeableTxProcessingEnv.TransactionProcessor), _api.BlockProducerEnvFactory.TransactionsExecutorFactory.Create(changeableTxProcessingEnv), changeableTxProcessingEnv.StateProvider, changeableTxProcessingEnv.StorageProvider, _api.ReceiptStorage, _api.LogManager, changeableTxProcessingEnv.BlockTree, auRaTxFilter, CreateGasLimitCalculator(constantContractTxProcessingEnv) as AuRaContractGasLimitOverride, contractRewriter) { AuRaValidator = _validator }); }