public TestAuraProducer(ITxSource transactionSource, IBlockchainProcessor processor, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, IBlockProcessingQueue blockProcessingQueue, ITimestamper timestamper, ILogManager logManager, IAuRaStepCalculator auRaStepCalculator, IReportingValidator reportingValidator, IAuraConfig config, ISpecProvider specProvider) : base( transactionSource, processor, stateProvider, sealer, blockTree, blockProcessingQueue, timestamper, auRaStepCalculator, reportingValidator, config, FollowOtherMiners.Instance, specProvider, logManager) { }
public static (TxPriorityContract?Contract, TxPriorityContract.LocalDataSource?DataSource) CreateTxPrioritySources( IAuraConfig config, AuRaNethermindApi api, IReadOnlyTxProcessorSource readOnlyTxProcessorSource) { Address.TryParse(config.TxPriorityContractAddress, out Address? txPriorityContractAddress); bool usesTxPriorityContract = txPriorityContractAddress != null; TxPriorityContract?txPriorityContract = null; if (usesTxPriorityContract) { txPriorityContract = new TxPriorityContract(api.AbiEncoder, txPriorityContractAddress, readOnlyTxProcessorSource); } string?auraConfigTxPriorityConfigFilePath = config.TxPriorityConfigFilePath; bool usesTxPriorityLocalData = auraConfigTxPriorityConfigFilePath != null; if (usesTxPriorityLocalData) { api.TxPriorityContractLocalDataSource ??= new TxPriorityContract.LocalDataSource(auraConfigTxPriorityConfigFilePath, api.EthereumJsonSerializer, api.FileSystem, api.LogManager); } return(txPriorityContract, api.TxPriorityContractLocalDataSource); }
public AuRaBlockProducer(ITxSource txSource, IBlockchainProcessor processor, IBlockProductionTrigger blockProductionTrigger, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, ITimestamper timestamper, IAuRaStepCalculator auRaStepCalculator, IReportingValidator reportingValidator, IAuraConfig config, IGasLimitCalculator gasLimitCalculator, ISpecProvider specProvider, ILogManager logManager) : base( txSource, processor, sealer, blockTree, blockProductionTrigger, stateProvider, gasLimitCalculator, timestamper, specProvider, logManager, new AuraDifficultyCalculator(auRaStepCalculator)) { _auRaStepCalculator = auRaStepCalculator ?? throw new ArgumentNullException(nameof(auRaStepCalculator)); _reportingValidator = reportingValidator ?? throw new ArgumentNullException(nameof(reportingValidator)); _config = config ?? throw new ArgumentNullException(nameof(config)); }
public void SetUp() { _stepDelay = TimeSpan.FromMilliseconds(20); _pendingTxSelector = Substitute.For <IPendingTxSelector>(); _blockchainProcessor = Substitute.For <IBlockchainProcessor>(); _sealer = Substitute.For <ISealer>(); _blockTree = Substitute.For <IBlockTree>(); _blockProcessingQueue = Substitute.For <IBlockProcessingQueue>(); _stateProvider = Substitute.For <IStateProvider>(); _timestamper = Substitute.For <ITimestamper>(); _auRaStepCalculator = Substitute.For <IAuRaStepCalculator>(); _auraConfig = Substitute.For <IAuraConfig>(); _nodeAddress = TestItem.AddressA; _auRaBlockProducer = new AuRaBlockProducer( _pendingTxSelector, _blockchainProcessor, _stateProvider, _sealer, _blockTree, _blockProcessingQueue, _timestamper, LimboLogs.Instance, _auRaStepCalculator, _auraConfig, _nodeAddress); _auraConfig.ForceSealing.Returns(true); _pendingTxSelector.SelectTransactions(Arg.Any <long>()).Returns(Array.Empty <Transaction>()); _sealer.CanSeal(Arg.Any <long>(), Arg.Any <Keccak>()).Returns(true); _sealer.SealBlock(Arg.Any <Block>(), Arg.Any <CancellationToken>()).Returns(c => Task.FromResult(c.Arg <Block>())); _blockProcessingQueue.IsEmpty.Returns(true); _auRaStepCalculator.TimeToNextStep.Returns(_stepDelay); _blockTree.BestKnownNumber.Returns(1); _blockTree.Head.Returns(Build.A.BlockHeader.WithAura(10, Bytes.Empty).TestObject); _blockchainProcessor.Process(Arg.Any <Block>(), ProcessingOptions.ProducingBlock, Arg.Any <IBlockTracer>()).Returns(c => c.Arg <Block>()); }
public AuRaBlockProducer(ITxSource txSource, IBlockchainProcessor processor, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, IBlockProcessingQueue blockProcessingQueue, ITimestamper timestamper, IAuRaStepCalculator auRaStepCalculator, IReportingValidator reportingValidator, IAuraConfig config, IGasLimitCalculator gasLimitCalculator, ISpecProvider specProvider, ILogManager logManager) : base( new ValidatedTxSource(txSource, logManager), processor, sealer, blockTree, blockProcessingQueue, stateProvider, timestamper, gasLimitCalculator, specProvider, logManager, "AuRa") { _auRaStepCalculator = auRaStepCalculator ?? throw new ArgumentNullException(nameof(auRaStepCalculator)); _reportingValidator = reportingValidator ?? throw new ArgumentNullException(nameof(reportingValidator)); _config = config ?? throw new ArgumentNullException(nameof(config)); _canProduce = _config.AllowAuRaPrivateChains ? 1 : 0; }
public void InitProducer(IAuraConfig auraConfig) { AuRaBlockProducer = new AuRaBlockProducer( TransactionSource, BlockchainProcessor, StateProvider, Sealer, BlockTree, BlockProcessingQueue, Timestamper, LimboLogs.Instance, AuRaStepCalculator, auraConfig, NodeAddress); }
public void InitProducer(IAuraConfig auraConfig) { AuRaBlockProducer = new AuRaBlockProducer( TransactionSource, BlockchainProcessor, StateProvider, Sealer, BlockTree, BlockProcessingQueue, Timestamper, AuRaStepCalculator, NullReportingValidator.Instance, auraConfig, FollowOtherMiners.Instance, LimboLogs.Instance); }
public AuRaBlockProducer(IPendingTxSelector pendingTxSelector, IBlockchainProcessor processor, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, IBlockProcessingQueue blockProcessingQueue, ITimestamper timestamper, ILogManager logManager, IAuRaStepCalculator auRaStepCalculator, IAuraConfig config, Address nodeAddress) : base(pendingTxSelector, processor, sealer, blockTree, blockProcessingQueue, stateProvider, timestamper, logManager, "AuRa") { _auRaStepCalculator = auRaStepCalculator ?? throw new ArgumentNullException(nameof(auRaStepCalculator)); _config = config ?? throw new ArgumentNullException(nameof(config)); _nodeAddress = nodeAddress ?? throw new ArgumentNullException(nameof(nodeAddress)); }
public AuRaBlockProducer( ITxSource txSource, IBlockchainProcessor processor, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, IBlockProcessingQueue blockProcessingQueue, ITimestamper timestamper, ILogManager logManager, IAuRaStepCalculator auRaStepCalculator, IAuraConfig config, Address nodeAddress, IGasLimitOverride gasLimitOverride = null) : base(txSource, processor, sealer, blockTree, blockProcessingQueue, stateProvider, timestamper, logManager, "AuRa") { _auRaStepCalculator = auRaStepCalculator ?? throw new ArgumentNullException(nameof(auRaStepCalculator)); _config = config ?? throw new ArgumentNullException(nameof(config)); CanProduce = _config.AllowAuRaPrivateChains; _nodeAddress = nodeAddress ?? throw new ArgumentNullException(nameof(nodeAddress)); _gasLimitOverride = gasLimitOverride; }
public AuRaBlockProducer(ITxPool txPool, IBlockchainProcessor blockchainProcessor, IBlockTree blockTree, ITimestamper timestamper, IAuRaStepCalculator auRaStepCalculator, Address nodeAddress, ISealer sealer, IStateProvider stateProvider, IAuraConfig config, ILogManager logManager) { _txPool = txPool ?? throw new ArgumentNullException(nameof(txPool)); _processor = blockchainProcessor ?? throw new ArgumentNullException(nameof(blockchainProcessor)); _blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree)); _timestamper = timestamper ?? throw new ArgumentNullException(nameof(timestamper)); _auRaStepCalculator = auRaStepCalculator ?? throw new ArgumentNullException(nameof(auRaStepCalculator)); _nodeAddress = nodeAddress ?? throw new ArgumentNullException(nameof(nodeAddress)); _sealer = sealer ?? throw new ArgumentNullException(nameof(sealer)); _stateProvider = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider)); _config = config ?? throw new ArgumentNullException(nameof(config)); _logger = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager)); }
public InitializeBlockchainAuRa(AuRaNethermindApi api) : base(api) { _api = api; _auraConfig = NethermindApi.Config <IAuraConfig>(); }
public StartBlockProducerAuRa(AuRaNethermindApi api) : base(api) { _api = api; _auraConfig = NethermindApi.Config <IAuraConfig>(); }
public TestAuraProducer(ITxSource transactionSource, IBlockchainProcessor processor, IStateProvider stateProvider, ISealer sealer, IBlockTree blockTree, IBlockProcessingQueue blockProcessingQueue, ITimestamper timestamper, ILogManager logManager, IAuRaStepCalculator auRaStepCalculator, IAuraConfig config, Address nodeAddress) : base(transactionSource, processor, stateProvider, sealer, blockTree, blockProcessingQueue, timestamper, logManager, auRaStepCalculator, config, nodeAddress) { }