private IGasLimitOverride?GetGasLimitOverride(
            ReadOnlyTxProcessingEnv environment,
            ReadOnlyTransactionProcessorSource readOnlyTransactionProcessorSource,
            IStateProvider?stateProvider = null)
        {
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }
            var blockGasLimitContractTransitions = _context.ChainSpec.AuRa.BlockGasLimitContractTransitions;

            if (blockGasLimitContractTransitions?.Any() == true)
            {
                var gasLimitOverride = new AuRaContractGasLimitOverride(
                    blockGasLimitContractTransitions.Select(blockGasLimitContractTransition =>
                                                            new BlockGasLimitContract(
                                                                _context.AbiEncoder,
                                                                blockGasLimitContractTransition.Value,
                                                                blockGasLimitContractTransition.Key,
                                                                readOnlyTransactionProcessorSource))
                    .ToArray <IBlockGasLimitContract>(),
                    _context.GasLimitOverrideCache,
                    _auraConfig?.Minimum2MlnGasPerBlockWhenUsingBlockGasLimitContract == true,
                    _context.LogManager);

                return(gasLimitOverride);
            }

            return(null);
        }
示例#2
0
        public BlockProcessor(
            ISpecProvider?specProvider,
            IBlockValidator?blockValidator,
            IRewardCalculator?rewardCalculator,
            ITransactionProcessor?transactionProcessor,
            IStateProvider?stateProvider,
            IStorageProvider?storageProvider,
            ITxPool?txPool,
            IReceiptStorage?receiptStorage,
            IWitnessCollector?witnessCollector,
            ILogManager?logManager)
        {
            _logger               = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _specProvider         = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
            _blockValidator       = blockValidator ?? throw new ArgumentNullException(nameof(blockValidator));
            _stateProvider        = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider));
            _storageProvider      = storageProvider ?? throw new ArgumentNullException(nameof(storageProvider));
            _txPool               = txPool ?? throw new ArgumentNullException(nameof(txPool));
            _receiptStorage       = receiptStorage ?? throw new ArgumentNullException(nameof(receiptStorage));
            _witnessCollector     = witnessCollector ?? throw new ArgumentNullException(nameof(witnessCollector));
            _rewardCalculator     = rewardCalculator ?? throw new ArgumentNullException(nameof(rewardCalculator));
            _transactionProcessor = transactionProcessor ?? throw new ArgumentNullException(nameof(transactionProcessor));

            _receiptsTracer = new BlockReceiptsTracer();
        }
        private ITxPermissionFilter?GetTxPermissionFilter(
            ReadOnlyTxProcessingEnv environment,
            ReadOnlyTransactionProcessorSource readOnlyTransactionProcessorSource,
            IStateProvider?stateProvider = null)
        {
            if (_context.ChainSpec == null)
            {
                throw new StepDependencyException(nameof(_context.ChainSpec));
            }

            if (_context.ChainSpec.Parameters.TransactionPermissionContract != null)
            {
                var txPermissionFilter = new TxPermissionFilter(
                    new VersionedTransactionPermissionContract(_context.AbiEncoder,
                                                               _context.ChainSpec.Parameters.TransactionPermissionContract,
                                                               _context.ChainSpec.Parameters.TransactionPermissionContractTransition ?? 0,
                                                               readOnlyTransactionProcessorSource,
                                                               _context.TransactionPermissionContractVersions),
                    _context.TxFilterCache,
                    environment.StateProvider,
                    _context.LogManager);

                return(txPermissionFilter);
            }

            return(null);
        }
 public TransactionProcessor(
     ISpecProvider?specProvider,
     IStateProvider?stateProvider,
     IStorageProvider?storageProvider,
     IVirtualMachine?virtualMachine,
     ILogManager?logManager)
     : this(specProvider, new WorldState(stateProvider, storageProvider), virtualMachine, logManager)
 {
 }
示例#5
0
 public TransactionProcessor(
     ISpecProvider?specProvider,
     IStateProvider?stateProvider,
     IStorageProvider?storageProvider,
     IVirtualMachine?virtualMachine,
     ILogManager?logManager)
 {
     _logger          = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
     _specProvider    = specProvider ?? throw new ArgumentNullException(nameof(specProvider));
     _virtualMachine  = virtualMachine ?? throw new ArgumentNullException(nameof(virtualMachine));
     _stateProvider   = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider));
     _storageProvider = storageProvider ?? throw new ArgumentNullException(nameof(storageProvider));
     _ecdsa           = new EthereumEcdsa(specProvider.ChainId, logManager);
 }
 public DevBlockProducer(
     ITxSource?txSource,
     IBlockchainProcessor?processor,
     IStateProvider?stateProvider,
     IBlockTree?blockTree,
     IBlockProductionTrigger?trigger,
     ITimestamper?timestamper,
     ISpecProvider?specProvider,
     IMiningConfig?miningConfig,
     ILogManager logManager)
     : base(
         txSource,
         processor,
         new NethDevSealEngine(),
         blockTree,
         trigger,
         stateProvider,
示例#7
0
 protected BlockProducerBase(
     ITxSource?txSource,
     IBlockchainProcessor?processor,
     ISealer?sealer,
     IBlockTree?blockTree,
     IBlockProcessingQueue?blockProcessingQueue,
     IStateProvider?stateProvider,
     IGasLimitCalculator?gasLimitCalculator,
     ITimestamper?timestamper,
     ILogManager?logManager)
 {
     _txSource            = txSource ?? throw new ArgumentNullException(nameof(txSource));
     Processor            = processor ?? throw new ArgumentNullException(nameof(processor));
     Sealer               = sealer ?? throw new ArgumentNullException(nameof(sealer));
     BlockTree            = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
     BlockProcessingQueue = blockProcessingQueue ?? throw new ArgumentNullException(nameof(blockProcessingQueue));
     _stateProvider       = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider));
     _gasLimitCalculator  = gasLimitCalculator ?? throw new ArgumentNullException(nameof(gasLimitCalculator));
     Timestamper          = timestamper ?? throw new ArgumentNullException(nameof(timestamper));
     Logger               = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
 }
示例#8
0
 public StorageProvider(ITrieStore?trieStore, IStateProvider?stateProvider, ILogManager?logManager)
 {
     _persistentStorageProvider = new PersistentStorageProvider(trieStore, stateProvider, logManager);
     _transientStorageProvider  = new TransientStorageProvider(logManager);
 }