public TxPermissionFilter(TransactionPermissionContract contract, ITxPermissionFilter.Cache cache, IStateProvider stateProvider, ILogManager logManager) { _contract = contract ?? throw new ArgumentNullException(nameof(contract)); _cache = cache ?? throw new ArgumentNullException(nameof(cache)); _stateProvider = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider)); _logger = logManager?.GetClassLogger <TxPermissionFilter>() ?? throw new ArgumentNullException(nameof(logManager)); }
public bool allows_transactions_before_transitions(long blockNumber) { var transactionPermissionContract = new TransactionPermissionContract( Substitute.For <ITransactionProcessor>(), Substitute.For <IAbiEncoder>(), TestItem.AddressA, 5, Substitute.For <IReadOnlyTransactionProcessorSource>()); var filter = new TxPermissionFilter(transactionPermissionContract, new ITxPermissionFilter.Cache(), Substitute.For <IStateProvider>(), LimboLogs.Instance); return(filter.IsAllowed(Build.A.Transaction.TestObject, Build.A.BlockHeader.WithNumber(blockNumber).TestObject)); }
protected override BlockProcessor CreateBlockProcessor() { var validator = new AuRaParameters.Validator() { Addresses = TestItem.Addresses, ValidatorType = AuRaParameters.ValidatorType.List }; var transactionPermissionContract = new TransactionPermissionContract(TxProcessor, new AbiEncoder(), _contractAddress, 1, new ReadOnlyTransactionProcessorSource(DbProvider, BlockTree, SpecProvider, LimboLogs.Instance)); TxPermissionFilterCache = new ITxPermissionFilter.Cache(); TxPermissionFilter = new TxPermissionFilter(transactionPermissionContract, TxPermissionFilterCache, State, LimboLogs.Instance); return(new AuRaBlockProcessor(SpecProvider, Always.Valid, new RewardCalculator(SpecProvider), TxProcessor, StateDb, CodeDb, State, Storage, TxPool, ReceiptStorage, LimboLogs.Instance, new ListBasedValidator(validator, new ValidSealerStrategy(), Substitute.For <IValidatorStore>(), LimboLogs.Instance, 1), BlockTree, TxPermissionFilter)); }