protected override BlockProcessor CreateBlockProcessor() { var blockGasLimitContractTransition = ChainSpec.AuRa.BlockGasLimitContractTransitions.First(); var gasLimitContract = new BlockGasLimitContract(new AbiEncoder(), blockGasLimitContractTransition.Value, blockGasLimitContractTransition.Key, new ReadOnlyTxProcessorSource(DbProvider, BlockTree, SpecProvider, LimboLogs.Instance)); GasLimitOverrideCache = new AuRaContractGasLimitOverride.Cache(); GasLimitCalculator = new AuRaContractGasLimitOverride(new[] { gasLimitContract }, GasLimitOverrideCache, false, FollowOtherMiners.Instance, LimboLogs.Instance); return(new AuRaBlockProcessor( SpecProvider, Always.Valid, new RewardCalculator(SpecProvider), TxProcessor, StateDb, CodeDb, State, Storage, TxPool, ReceiptStorage, LimboLogs.Instance, BlockTree, null, GasLimitCalculator as AuRaContractGasLimitOverride)); }
protected override BlockProcessor CreateBlockProcessor() { var validator = new AuRaParameters.Validator() { Addresses = TestItem.Addresses, ValidatorType = AuRaParameters.ValidatorType.List }; var blockGasLimitContractTransition = this.ChainSpec.AuRa.BlockGasLimitContractTransitions.First(); var gasLimitContract = new BlockGasLimitContract(new AbiEncoder(), blockGasLimitContractTransition.Value, blockGasLimitContractTransition.Key, new ReadOnlyTransactionProcessorSource(DbProvider, BlockTree, SpecProvider, LimboLogs.Instance)); GasLimitOverrideCache = new IGasLimitOverride.Cache(); GasLimitOverride = new AuRaContractGasLimitOverride(new[] { gasLimitContract }, GasLimitOverrideCache, false, LimboLogs.Instance); return(new AuRaBlockProcessor( SpecProvider, Always.Valid, new RewardCalculator(SpecProvider), TxProcessor, StateDb, CodeDb, State, Storage, TxPool, ReceiptStorage, LimboLogs.Instance, BlockTree, null, GasLimitOverride)); }
private UInt256?GetContractGasLimit(BlockHeader parent, BlockGasLimitContract contract) { try { var contractGasLimit = contract.BlockGasLimit(parent); return(contractGasLimit.HasValue && _minimum2MlnGasPerBlockWhenUsingBlockGasLimitContract && contractGasLimit < MinimalContractGasLimit ? MinimalContractGasLimit : contractGasLimit); } catch (AuRaException e) { if (_logger.IsError) { _logger.Error("Contract call failed. Not changing the block gas limit.", e); } return(null); } }