diff --git a/CHANGELOG.md b/CHANGELOG.md index c5d7949f19c..caff2e07342 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Add bft-style blockperiodseconds transitions to Clique [#6596](https://github.com/hyperledger/besu/pull/6596) - RocksDB database metadata refactoring [#6555](https://github.com/hyperledger/besu/pull/6555) - Make layered txpool aware of minGasPrice and minPriorityFeePerGas dynamic options [#6611](https://github.com/hyperledger/besu/pull/6611) +- Refactor and extend `TransactionPoolValidatorService` [#6636](https://github.com/hyperledger/besu/pull/6636) ### Bug fixes diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index d743a245e7e..fc38200811e 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -45,10 +45,10 @@ import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.BesuEvents; import org.hyperledger.besu.plugin.services.PicoCLIOptions; -import org.hyperledger.besu.plugin.services.PluginTransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.SecurityModuleService; import org.hyperledger.besu.plugin.services.StorageService; +import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.TransactionSelectionService; import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin; import org.hyperledger.besu.services.BesuConfigurationImpl; @@ -56,10 +56,10 @@ import org.hyperledger.besu.services.BesuPluginContextImpl; import org.hyperledger.besu.services.PermissioningServiceImpl; import org.hyperledger.besu.services.PicoCLIOptionsImpl; -import org.hyperledger.besu.services.PluginTransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.RpcEndpointServiceImpl; import org.hyperledger.besu.services.SecurityModuleServiceImpl; import org.hyperledger.besu.services.StorageServiceImpl; +import org.hyperledger.besu.services.TransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.TransactionSelectionServiceImpl; import java.io.File; @@ -103,8 +103,7 @@ private BesuPluginContextImpl buildPluginContext( besuPluginContext.addService( TransactionSelectionService.class, transactionSelectionServiceImpl); besuPluginContext.addService( - PluginTransactionPoolValidatorService.class, - new PluginTransactionPoolValidatorServiceImpl()); + TransactionPoolValidatorService.class, new TransactionPoolValidatorServiceImpl()); final Path pluginsPath; final String pluginDir = System.getProperty("besu.plugins.dir"); if (pluginDir == null || pluginDir.isEmpty()) { diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index e27bbc6b290..42c1f810e8b 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -160,12 +160,12 @@ import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.plugin.services.PermissioningService; import org.hyperledger.besu.plugin.services.PicoCLIOptions; -import org.hyperledger.besu.plugin.services.PluginTransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.PrivacyPluginService; import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.SecurityModuleService; import org.hyperledger.besu.plugin.services.StorageService; import org.hyperledger.besu.plugin.services.TraceService; +import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.TransactionSelectionService; import org.hyperledger.besu.plugin.services.exception.StorageException; import org.hyperledger.besu.plugin.services.metrics.MetricCategory; @@ -180,12 +180,12 @@ import org.hyperledger.besu.services.BlockchainServiceImpl; import org.hyperledger.besu.services.PermissioningServiceImpl; import org.hyperledger.besu.services.PicoCLIOptionsImpl; -import org.hyperledger.besu.services.PluginTransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.PrivacyPluginServiceImpl; import org.hyperledger.besu.services.RpcEndpointServiceImpl; import org.hyperledger.besu.services.SecurityModuleServiceImpl; import org.hyperledger.besu.services.StorageServiceImpl; import org.hyperledger.besu.services.TraceServiceImpl; +import org.hyperledger.besu.services.TransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.TransactionSelectionServiceImpl; import org.hyperledger.besu.services.kvstore.InMemoryStoragePlugin; import org.hyperledger.besu.util.InvalidConfigurationException; @@ -369,7 +369,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { P2PDiscoveryOptionGroup p2PDiscoveryOptionGroup = new P2PDiscoveryOptionGroup(); private final TransactionSelectionServiceImpl transactionSelectionServiceImpl; - private final PluginTransactionPoolValidatorServiceImpl transactionValidatorServiceImpl; + private final TransactionPoolValidatorServiceImpl transactionValidatorServiceImpl; private final BlockchainServiceImpl blockchainServiceImpl; static class P2PDiscoveryOptionGroup { @@ -955,7 +955,7 @@ public BesuCommand( new PkiBlockCreationConfigurationProvider(), new RpcEndpointServiceImpl(), new TransactionSelectionServiceImpl(), - new PluginTransactionPoolValidatorServiceImpl(), + new TransactionPoolValidatorServiceImpl(), new BlockchainServiceImpl()); } @@ -997,7 +997,7 @@ protected BesuCommand( final PkiBlockCreationConfigurationProvider pkiBlockCreationConfigProvider, final RpcEndpointServiceImpl rpcEndpointServiceImpl, final TransactionSelectionServiceImpl transactionSelectionServiceImpl, - final PluginTransactionPoolValidatorServiceImpl transactionValidatorServiceImpl, + final TransactionPoolValidatorServiceImpl transactionValidatorServiceImpl, final BlockchainServiceImpl blockchainServiceImpl) { this.besuComponent = besuComponent; this.logger = besuComponent.getBesuCommandLogger(); @@ -1209,7 +1209,7 @@ private void preparePlugins() { besuPluginContext.addService( TransactionSelectionService.class, transactionSelectionServiceImpl); besuPluginContext.addService( - PluginTransactionPoolValidatorService.class, transactionValidatorServiceImpl); + TransactionPoolValidatorService.class, transactionValidatorServiceImpl); besuPluginContext.addService(BlockchainService.class, blockchainServiceImpl); // register built-in plugins diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/TransactionPoolOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/TransactionPoolOptions.java index 90a5b8d55ce..74f22a3221e 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/TransactionPoolOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/TransactionPoolOptions.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; -import org.hyperledger.besu.plugin.services.PluginTransactionPoolValidatorService; +import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.util.number.Fraction; import org.hyperledger.besu.util.number.Percentage; @@ -58,7 +58,7 @@ public class TransactionPoolOptions implements CLIOptions factory = Optional.empty(); @Override - public PluginTransactionPoolTransactionValidator createTransactionValidator() { + public PluginTransactionPoolValidator createTransactionValidator() { return factory .map(PluginTransactionPoolValidatorFactory::createTransactionValidator) - .orElse(PluginTransactionPoolTransactionValidator.VALIDATE_ALL); + .orElse(PluginTransactionPoolValidator.VALIDATE_ALL); } @Override - public void registerTransactionValidatorFactory( - final PluginTransactionPoolValidatorFactory transactionValidatorFactory) { - factory = Optional.ofNullable(transactionValidatorFactory); + public void registerPluginTransactionValidatorFactory( + final PluginTransactionPoolValidatorFactory pluginTransactionPoolValidatorFactory) { + factory = Optional.ofNullable(pluginTransactionPoolValidatorFactory); } } diff --git a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java index 6cd7d1868d4..5f67a3cc810 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java @@ -86,11 +86,11 @@ import org.hyperledger.besu.services.BesuPluginContextImpl; import org.hyperledger.besu.services.BlockchainServiceImpl; import org.hyperledger.besu.services.PermissioningServiceImpl; -import org.hyperledger.besu.services.PluginTransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.PrivacyPluginServiceImpl; import org.hyperledger.besu.services.RpcEndpointServiceImpl; import org.hyperledger.besu.services.SecurityModuleServiceImpl; import org.hyperledger.besu.services.StorageServiceImpl; +import org.hyperledger.besu.services.TransactionPoolValidatorServiceImpl; import org.hyperledger.besu.services.TransactionSelectionServiceImpl; import org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage; @@ -569,7 +569,7 @@ public static class TestBesuCommand extends BesuCommand { pkiBlockCreationConfigProvider, rpcEndpointServiceImpl, new TransactionSelectionServiceImpl(), - new PluginTransactionPoolValidatorServiceImpl(), + new TransactionPoolValidatorServiceImpl(), new BlockchainServiceImpl()); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java index 202759c18e7..1c6d135709c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcErrorConverter.java @@ -75,7 +75,7 @@ public static RpcErrorType convertTransactionInvalidReason( return RpcErrorType.TOTAL_BLOB_GAS_TOO_HIGH; case TX_POOL_DISABLED: return RpcErrorType.TX_POOL_DISABLED; - case PLUGIN_TX_VALIDATOR: + case PLUGIN_TX_POOL_VALIDATOR: return RpcErrorType.PLUGIN_TX_VALIDATOR; case INVALID_BLOBS: return RpcErrorType.INVALID_BLOBS; diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSendRawTransaction.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSendRawTransaction.java index 45e554bc9a5..9382bd34f3c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSendRawTransaction.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSendRawTransaction.java @@ -103,7 +103,7 @@ private JsonRpcResponse getJsonRpcResponse( if (sendEmptyHashOnInvalidBlock) { return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), Hash.EMPTY.toString()); } else { - if (errorReason == TransactionInvalidReason.PLUGIN_TX_VALIDATOR) { + if (errorReason == TransactionInvalidReason.PLUGIN_TX_POOL_VALIDATOR) { final RpcErrorType rpcErrorType = JsonRpcErrorConverter.convertTransactionInvalidReason( validationResult.getInvalidReason()); diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java index 3fc970110ca..ebca2bb17aa 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java @@ -732,9 +732,11 @@ public void transactionSelectionPluginShouldBeNotifiedWhenTransactionSelectionCo final Transaction transaction = createTransaction(0, Wei.of(10), 21_000); ensureTransactionIsValid(transaction, 21_000, 0); - final TransactionInvalidReason invalidReason = TransactionInvalidReason.PLUGIN_TX_VALIDATOR; + final TransactionInvalidReason invalidReason = + TransactionInvalidReason.PLUGIN_TX_POOL_VALIDATOR; final Transaction invalidTransaction = createTransaction(1, Wei.of(10), 21_000); - ensureTransactionIsInvalid(invalidTransaction, TransactionInvalidReason.PLUGIN_TX_VALIDATOR); + ensureTransactionIsInvalid( + invalidTransaction, TransactionInvalidReason.PLUGIN_TX_POOL_VALIDATOR); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionInvalidReason.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionInvalidReason.java index acdb73c6978..0760740467f 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionInvalidReason.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/transaction/TransactionInvalidReason.java @@ -49,7 +49,7 @@ public enum TransactionInvalidReason { INTERNAL_ERROR, TX_POOL_DISABLED, INVALID_BLOBS, - PLUGIN_TX_VALIDATOR, + PLUGIN_TX_POOL_VALIDATOR, EXECUTION_HALTED, // Private Transaction Invalid Reasons PRIVATE_TRANSACTION_INVALID, diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java index 39b679ab2f6..4d85ec65fc6 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java @@ -435,15 +435,14 @@ && strictReplayProtectionShouldBeEnforcedLocally(chainHeadBlockHeader) } // Call the transaction validator plugin - - final Optional maybeError = + final Optional maybePluginInvalid = configuration .getPluginTransactionValidatorService() .createTransactionValidator() .validateTransaction(transaction, isLocal, hasPriority); - if (maybeError.isPresent()) { + if (maybePluginInvalid.isPresent()) { return ValidationResultAndAccount.invalid( - TransactionInvalidReason.PLUGIN_TX_VALIDATOR, maybeError.get()); + TransactionInvalidReason.PLUGIN_TX_POOL_VALIDATOR, maybePluginInvalid.get()); } try (final var worldState = diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolConfiguration.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolConfiguration.java index 285b5c4213e..db14ca93aef 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolConfiguration.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolConfiguration.java @@ -16,8 +16,8 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.plugin.services.PluginTransactionPoolValidatorService; -import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolTransactionValidator; +import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; +import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidator; import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidatorFactory; import org.hyperledger.besu.util.number.Fraction; import org.hyperledger.besu.util.number.Percentage; @@ -158,16 +158,16 @@ default Wei getMinGasPrice() { } @Value.Default - default PluginTransactionPoolValidatorService getPluginTransactionValidatorService() { - return new PluginTransactionPoolValidatorService() { + default TransactionPoolValidatorService getPluginTransactionValidatorService() { + return new TransactionPoolValidatorService() { @Override - public PluginTransactionPoolTransactionValidator createTransactionValidator() { - return PluginTransactionPoolTransactionValidator.VALIDATE_ALL; + public PluginTransactionPoolValidator createTransactionValidator() { + return PluginTransactionPoolValidator.VALIDATE_ALL; } @Override - public void registerTransactionValidatorFactory( - final PluginTransactionPoolValidatorFactory transactionValidatorFactory) {} + public void registerPluginTransactionValidatorFactory( + final PluginTransactionPoolValidatorFactory pluginTransactionPoolValidatorFactory) {} }; } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java index 912b89d9596..dfeb062af63 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java @@ -87,8 +87,8 @@ import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; import org.hyperledger.besu.plugin.services.MetricsSystem; -import org.hyperledger.besu.plugin.services.PluginTransactionPoolValidatorService; -import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolTransactionValidator; +import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; +import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidator; import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidatorFactory; import org.hyperledger.besu.util.number.Percentage; @@ -788,13 +788,13 @@ public void shouldAcceptRemoteTransactionEvenIfFeeCapExceeded(final boolean hasP @ParameterizedTest @ValueSource(booleans = {true, false}) public void transactionNotRejectedByPluginShouldBeAdded(final boolean noLocalPriority) { - final PluginTransactionPoolValidatorService pluginTransactionPoolValidatorService = + final TransactionPoolValidatorService transactionPoolValidatorService = getPluginTransactionPoolValidatorServiceReturning(null); // null -> not rejecting !! this.transactionPool = createTransactionPool( b -> b.noLocalPriority(noLocalPriority) - .pluginTransactionValidatorService(pluginTransactionPoolValidatorService)); + .pluginTransactionValidatorService(transactionPoolValidatorService)); givenTransactionIsValid(transaction0); @@ -804,27 +804,27 @@ public void transactionNotRejectedByPluginShouldBeAdded(final boolean noLocalPri @ParameterizedTest @ValueSource(booleans = {true, false}) public void transactionRejectedByPluginShouldNotBeAdded(final boolean noLocalPriority) { - final PluginTransactionPoolValidatorService pluginTransactionPoolValidatorService = + final TransactionPoolValidatorService transactionPoolValidatorService = getPluginTransactionPoolValidatorServiceReturning("false"); this.transactionPool = createTransactionPool( b -> b.noLocalPriority(noLocalPriority) - .pluginTransactionValidatorService(pluginTransactionPoolValidatorService)); + .pluginTransactionValidatorService(transactionPoolValidatorService)); givenTransactionIsValid(transaction0); addAndAssertTransactionViaApiInvalid( - transaction0, TransactionInvalidReason.PLUGIN_TX_VALIDATOR); + transaction0, TransactionInvalidReason.PLUGIN_TX_POOL_VALIDATOR); } @Test public void remoteTransactionRejectedByPluginShouldNotBeAdded() { - final PluginTransactionPoolValidatorService pluginTransactionPoolValidatorService = + final TransactionPoolValidatorService transactionPoolValidatorService = getPluginTransactionPoolValidatorServiceReturning("false"); this.transactionPool = createTransactionPool( - b -> b.pluginTransactionValidatorService(pluginTransactionPoolValidatorService)); + b -> b.pluginTransactionValidatorService(transactionPoolValidatorService)); givenTransactionIsValid(transaction0); @@ -1270,17 +1270,17 @@ public void addRemoteTransactionsShouldAllowDuplicates() { .containsExactlyInAnyOrder(transaction1, transaction2a, transaction3); } - private static PluginTransactionPoolValidatorService - getPluginTransactionPoolValidatorServiceReturning(final String errorMessage) { - return new PluginTransactionPoolValidatorService() { + private static TransactionPoolValidatorService getPluginTransactionPoolValidatorServiceReturning( + final String errorMessage) { + return new TransactionPoolValidatorService() { @Override - public PluginTransactionPoolTransactionValidator createTransactionValidator() { + public PluginTransactionPoolValidator createTransactionValidator() { return (transaction, isLocal, hasPriority) -> Optional.ofNullable(errorMessage); } @Override - public void registerTransactionValidatorFactory( - final PluginTransactionPoolValidatorFactory transactionValidatorFactory) {} + public void registerPluginTransactionValidatorFactory( + final PluginTransactionPoolValidatorFactory pluginTransactionPoolValidatorFactory) {} }; } diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index 9d0c7460e60..8d051eb516d 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -69,7 +69,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'eKFWCftiT6QdnKPk5J7wFHQi9fb9t4YL6hrJXLYk8ZU=' + knownHash = 'B/pzTaARYvd/T9WtAXtX6vFbxoK5u82GigByKD0YP6M=' } check.dependsOn('checkAPIChanges') diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/PluginTransactionPoolValidatorService.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/TransactionPoolValidatorService.java similarity index 75% rename from plugin-api/src/main/java/org/hyperledger/besu/plugin/services/PluginTransactionPoolValidatorService.java rename to plugin-api/src/main/java/org/hyperledger/besu/plugin/services/TransactionPoolValidatorService.java index 43aa69af948..2d210c13e41 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/PluginTransactionPoolValidatorService.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/TransactionPoolValidatorService.java @@ -16,25 +16,25 @@ package org.hyperledger.besu.plugin.services; import org.hyperledger.besu.plugin.Unstable; -import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolTransactionValidator; +import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidator; import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidatorFactory; /** Transaction validator for addition of transactions to the transaction pool */ @Unstable -public interface PluginTransactionPoolValidatorService extends BesuService { +public interface TransactionPoolValidatorService extends BesuService { /** * Returns the transaction validator to be used in the txpool * * @return the transaction validator */ - PluginTransactionPoolTransactionValidator createTransactionValidator(); + PluginTransactionPoolValidator createTransactionValidator(); /** * Registers the transaction validator factory with the service * - * @param transactionValidatorFactory transaction validator factory to be used + * @param pluginTransactionPoolValidatorFactory transaction validator factory to be used */ - void registerTransactionValidatorFactory( - PluginTransactionPoolValidatorFactory transactionValidatorFactory); + void registerPluginTransactionValidatorFactory( + PluginTransactionPoolValidatorFactory pluginTransactionPoolValidatorFactory); } diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolTransactionValidator.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidator.java similarity index 92% rename from plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolTransactionValidator.java rename to plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidator.java index d6240bea3b2..02fcd9b21f7 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolTransactionValidator.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidator.java @@ -22,9 +22,9 @@ /** Interface for the transaction validator plugin for txpool usage */ @Unstable -public interface PluginTransactionPoolTransactionValidator { +public interface PluginTransactionPoolValidator { /** Plugin transaction pool validator that unconditionally validates every transaction */ - PluginTransactionPoolTransactionValidator VALIDATE_ALL = + PluginTransactionPoolValidator VALIDATE_ALL = (transaction, isLocal, hasPriority) -> Optional.empty(); /** diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidatorFactory.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidatorFactory.java index 106d1c75cf3..3163667b86e 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidatorFactory.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/services/txvalidator/PluginTransactionPoolValidatorFactory.java @@ -26,5 +26,5 @@ public interface PluginTransactionPoolValidatorFactory { * * @return the transaction validator */ - PluginTransactionPoolTransactionValidator createTransactionValidator(); + PluginTransactionPoolValidator createTransactionValidator(); }