From 27aad179693133da01099c05b142f0cda43a1073 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 27 Mar 2024 18:36:07 +0100 Subject: [PATCH] Rename to TransactionPoolValidator to make it clear it only apply to txpool (#654) Signed-off-by: Fabio Di Fabio --- .../AbstractLineaSharedOptionsPlugin.java | 18 ++++++------- ...eaTransactionPoolValidatorCliOptions.java} | 18 ++++++------- ...ransactionPoolValidatorConfiguration.java} | 2 +- .../rpc/linea/LineaEndpointServicePlugin.java | 2 +- .../linea/rpc/linea/LineaEstimateGas.java | 6 ++--- ...LineaTransactionPoolValidatorFactory.java} | 26 +++++++++---------- .../LineaTransactionPoolValidatorPlugin.java} | 19 +++++++------- .../validators/AllowedAddressValidator.java | 2 +- .../validators/CalldataValidator.java | 10 +++---- .../validators/GasLimitValidator.java | 10 +++---- .../validators/ProfitabilityValidator.java | 2 +- .../AllowedAddressValidatorTest.java | 2 +- .../validators/CalldataValidatorTest.java | 6 ++--- .../validators/GasLimitValidatorTest.java | 6 ++--- .../ProfitabilityValidatorTest.java | 2 +- 15 files changed, 66 insertions(+), 65 deletions(-) rename arithmetization/src/main/java/net/consensys/linea/config/{LineaTransactionValidatorCliOptions.java => LineaTransactionPoolValidatorCliOptions.java} (84%) rename arithmetization/src/main/java/net/consensys/linea/config/{LineaTransactionValidatorConfiguration.java => LineaTransactionPoolValidatorConfiguration.java} (94%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation/LineaTransactionValidatorFactory.java => txpoolvalidation/LineaTransactionPoolValidatorFactory.java} (71%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation/LineaTransactionValidatorPlugin.java => txpoolvalidation/LineaTransactionPoolValidatorPlugin.java} (82%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/AllowedAddressValidator.java (98%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/CalldataValidator.java (78%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/GasLimitValidator.java (79%) rename arithmetization/src/main/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/ProfitabilityValidator.java (97%) rename arithmetization/src/test/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/AllowedAddressValidatorTest.java (98%) rename arithmetization/src/test/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/CalldataValidatorTest.java (91%) rename arithmetization/src/test/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/GasLimitValidatorTest.java (91%) rename arithmetization/src/test/java/net/consensys/linea/sequencer/{txvalidation => txpoolvalidation}/validators/ProfitabilityValidatorTest.java (99%) diff --git a/arithmetization/src/main/java/net/consensys/linea/AbstractLineaSharedOptionsPlugin.java b/arithmetization/src/main/java/net/consensys/linea/AbstractLineaSharedOptionsPlugin.java index 16015d76..afdcacdc 100644 --- a/arithmetization/src/main/java/net/consensys/linea/AbstractLineaSharedOptionsPlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/AbstractLineaSharedOptionsPlugin.java @@ -23,10 +23,10 @@ import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.config.LineaRpcCliOptions; import net.consensys.linea.config.LineaRpcConfiguration; +import net.consensys.linea.config.LineaTransactionPoolValidatorCliOptions; +import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import net.consensys.linea.config.LineaTransactionSelectorCliOptions; import net.consensys.linea.config.LineaTransactionSelectorConfiguration; -import net.consensys.linea.config.LineaTransactionValidatorCliOptions; -import net.consensys.linea.config.LineaTransactionValidatorConfiguration; import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.services.PicoCLIOptions; @@ -37,12 +37,12 @@ public abstract class AbstractLineaSharedOptionsPlugin implements BesuPlugin { private static boolean cliOptionsRegistered = false; private static boolean configured = false; private static LineaTransactionSelectorCliOptions transactionSelectorCliOptions; - private static LineaTransactionValidatorCliOptions transactionValidatorCliOptions; + private static LineaTransactionPoolValidatorCliOptions transactionPoolValidatorCliOptions; private static LineaL1L2BridgeCliOptions l1L2BridgeCliOptions; private static LineaRpcCliOptions rpcCliOptions; private static LineaProfitabilityCliOptions profitabilityCliOptions; protected static LineaTransactionSelectorConfiguration transactionSelectorConfiguration; - protected static LineaTransactionValidatorConfiguration transactionValidatorConfiguration; + protected static LineaTransactionPoolValidatorConfiguration transactionPoolValidatorConfiguration; protected static LineaL1L2BridgeConfiguration l1L2BridgeConfiguration; protected static LineaRpcConfiguration rpcConfiguration; protected static LineaProfitabilityConfiguration profitabilityConfiguration; @@ -63,13 +63,13 @@ public synchronized void register(final BesuContext context) { new IllegalStateException( "Failed to obtain PicoCLI options from the BesuContext")); transactionSelectorCliOptions = LineaTransactionSelectorCliOptions.create(); - transactionValidatorCliOptions = LineaTransactionValidatorCliOptions.create(); + transactionPoolValidatorCliOptions = LineaTransactionPoolValidatorCliOptions.create(); l1L2BridgeCliOptions = LineaL1L2BridgeCliOptions.create(); rpcCliOptions = LineaRpcCliOptions.create(); profitabilityCliOptions = LineaProfitabilityCliOptions.create(); cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, transactionSelectorCliOptions); - cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, transactionValidatorCliOptions); + cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, transactionPoolValidatorCliOptions); cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, l1L2BridgeCliOptions); cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, rpcCliOptions); cmdlineOptions.addPicoCLIOptions(CLI_OPTIONS_PREFIX, profitabilityCliOptions); @@ -81,7 +81,7 @@ public synchronized void register(final BesuContext context) { public void beforeExternalServices() { if (!configured) { transactionSelectorConfiguration = transactionSelectorCliOptions.toDomainObject(); - transactionValidatorConfiguration = transactionValidatorCliOptions.toDomainObject(); + transactionPoolValidatorConfiguration = transactionPoolValidatorCliOptions.toDomainObject(); l1L2BridgeConfiguration = l1L2BridgeCliOptions.toDomainObject(); rpcConfiguration = rpcCliOptions.toDomainObject(); profitabilityConfiguration = profitabilityCliOptions.toDomainObject(); @@ -94,9 +94,9 @@ public void beforeExternalServices() { transactionSelectorCliOptions); log.debug( - "Configured plugin {} with transaction validator configuration: {}", + "Configured plugin {} with transaction pool validator configuration: {}", getName(), - transactionValidatorCliOptions); + transactionPoolValidatorCliOptions); log.debug( "Configured plugin {} with L1 L2 bridge configuration: {}", diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorCliOptions.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorCliOptions.java similarity index 84% rename from arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorCliOptions.java rename to arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorCliOptions.java index a97b2414..4cb68f78 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorCliOptions.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorCliOptions.java @@ -19,7 +19,7 @@ import picocli.CommandLine; /** The Linea CLI options. */ -public class LineaTransactionValidatorCliOptions { +public class LineaTransactionPoolValidatorCliOptions { public static final String DENY_LIST_PATH = "--plugin-linea-deny-list-path"; public static final String DEFAULT_DENY_LIST_PATH = "lineaDenyList.txt"; @@ -58,15 +58,15 @@ public class LineaTransactionValidatorCliOptions { + ")") private int maxTxCallDataSize = DEFAULT_MAX_TX_CALLDATA_SIZE; - private LineaTransactionValidatorCliOptions() {} + private LineaTransactionPoolValidatorCliOptions() {} /** * Create Linea cli options. * * @return the Linea cli options */ - public static LineaTransactionValidatorCliOptions create() { - return new LineaTransactionValidatorCliOptions(); + public static LineaTransactionPoolValidatorCliOptions create() { + return new LineaTransactionPoolValidatorCliOptions(); } /** @@ -75,9 +75,9 @@ public static LineaTransactionValidatorCliOptions create() { * @param config the config * @return the cli options */ - public static LineaTransactionValidatorCliOptions fromConfig( - final LineaTransactionValidatorConfiguration config) { - final LineaTransactionValidatorCliOptions options = create(); + public static LineaTransactionPoolValidatorCliOptions fromConfig( + final LineaTransactionPoolValidatorConfiguration config) { + final LineaTransactionPoolValidatorCliOptions options = create(); options.denyListPath = config.denyListPath(); options.maxTxGasLimit = config.maxTxGasLimit(); options.maxTxCallDataSize = config.maxTxCalldataSize(); @@ -90,8 +90,8 @@ public static LineaTransactionValidatorCliOptions fromConfig( * * @return the Linea factory configuration */ - public LineaTransactionValidatorConfiguration toDomainObject() { - return new LineaTransactionValidatorConfiguration( + public LineaTransactionPoolValidatorConfiguration toDomainObject() { + return new LineaTransactionPoolValidatorConfiguration( denyListPath, maxTxGasLimit, maxTxCallDataSize); } diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorConfiguration.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorConfiguration.java similarity index 94% rename from arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorConfiguration.java rename to arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorConfiguration.java index 61f1ac3c..90d41edf 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionValidatorConfiguration.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionPoolValidatorConfiguration.java @@ -25,5 +25,5 @@ * @param maxTxCalldataSize the maximum size of calldata allowed for transactions */ @Builder(toBuilder = true) -public record LineaTransactionValidatorConfiguration( +public record LineaTransactionPoolValidatorConfiguration( String denyListPath, int maxTxGasLimit, int maxTxCalldataSize) {} diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEndpointServicePlugin.java b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEndpointServicePlugin.java index 23e7c665..0dd3e8d4 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEndpointServicePlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEndpointServicePlugin.java @@ -87,6 +87,6 @@ public void doRegister(final BesuContext context) { public void beforeExternalServices() { super.beforeExternalServices(); lineaEstimateGasMethod.init( - rpcConfiguration, transactionValidatorConfiguration, profitabilityConfiguration); + rpcConfiguration, transactionPoolValidatorConfiguration, profitabilityConfiguration); } } diff --git a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java index bd5578ff..e5c91a99 100644 --- a/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java +++ b/arithmetization/src/main/java/net/consensys/linea/rpc/linea/LineaEstimateGas.java @@ -28,7 +28,7 @@ import net.consensys.linea.bl.TransactionProfitabilityCalculator; import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.config.LineaRpcConfiguration; -import net.consensys.linea.config.LineaTransactionValidatorConfiguration; +import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import org.apache.tuweni.bytes.Bytes; import org.bouncycastle.asn1.sec.SECNamedCurves; import org.bouncycastle.asn1.x9.X9ECParameters; @@ -74,7 +74,7 @@ public class LineaEstimateGas { private final TransactionSimulationService transactionSimulationService; private final BlockchainService blockchainService; private LineaRpcConfiguration rpcConfiguration; - private LineaTransactionValidatorConfiguration txValidatorConf; + private LineaTransactionPoolValidatorConfiguration txValidatorConf; private LineaProfitabilityConfiguration profitabilityConf; private TransactionProfitabilityCalculator txProfitabilityCalculator; @@ -89,7 +89,7 @@ public LineaEstimateGas( public void init( LineaRpcConfiguration rpcConfiguration, - final LineaTransactionValidatorConfiguration transactionValidatorConfiguration, + final LineaTransactionPoolValidatorConfiguration transactionValidatorConfiguration, final LineaProfitabilityConfiguration profitabilityConf) { this.rpcConfiguration = rpcConfiguration; this.txValidatorConf = transactionValidatorConfiguration; diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorFactory.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java similarity index 71% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorFactory.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java index d27bca7e..6fabee4e 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorFactory.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorFactory.java @@ -13,18 +13,18 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation; +package net.consensys.linea.sequencer.txpoolvalidation; import java.util.Arrays; import java.util.Optional; import java.util.Set; import net.consensys.linea.config.LineaProfitabilityConfiguration; -import net.consensys.linea.config.LineaTransactionValidatorConfiguration; -import net.consensys.linea.sequencer.txvalidation.validators.AllowedAddressValidator; -import net.consensys.linea.sequencer.txvalidation.validators.CalldataValidator; -import net.consensys.linea.sequencer.txvalidation.validators.GasLimitValidator; -import net.consensys.linea.sequencer.txvalidation.validators.ProfitabilityValidator; +import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; +import net.consensys.linea.sequencer.txpoolvalidation.validators.AllowedAddressValidator; +import net.consensys.linea.sequencer.txpoolvalidation.validators.CalldataValidator; +import net.consensys.linea.sequencer.txpoolvalidation.validators.GasLimitValidator; +import net.consensys.linea.sequencer.txpoolvalidation.validators.ProfitabilityValidator; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.BlockchainService; @@ -32,23 +32,23 @@ import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidatorFactory; /** Represents a factory for creating transaction validators. */ -public class LineaTransactionValidatorFactory implements PluginTransactionPoolValidatorFactory { +public class LineaTransactionPoolValidatorFactory implements PluginTransactionPoolValidatorFactory { private final BesuConfiguration besuConfiguration; private final BlockchainService blockchainService; - private final LineaTransactionValidatorConfiguration txValidatorConf; + private final LineaTransactionPoolValidatorConfiguration txPoolValidatorConf; private final LineaProfitabilityConfiguration profitabilityConf; private final Set
denied; - public LineaTransactionValidatorFactory( + public LineaTransactionPoolValidatorFactory( final BesuConfiguration besuConfiguration, final BlockchainService blockchainService, - final LineaTransactionValidatorConfiguration txValidatorConf, + final LineaTransactionPoolValidatorConfiguration txPoolValidatorConf, final LineaProfitabilityConfiguration profitabilityConf, final Set
denied) { this.besuConfiguration = besuConfiguration; this.blockchainService = blockchainService; - this.txValidatorConf = txValidatorConf; + this.txPoolValidatorConf = txPoolValidatorConf; this.profitabilityConf = profitabilityConf; this.denied = denied; } @@ -58,8 +58,8 @@ public PluginTransactionPoolValidator createTransactionValidator() { final var validators = new PluginTransactionPoolValidator[] { new AllowedAddressValidator(denied), - new GasLimitValidator(txValidatorConf), - new CalldataValidator(txValidatorConf), + new GasLimitValidator(txPoolValidatorConf), + new CalldataValidator(txPoolValidatorConf), new ProfitabilityValidator(besuConfiguration, blockchainService, profitabilityConf) }; diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorPlugin.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java similarity index 82% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorPlugin.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java index 900bb2bc..52eb2de9 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/LineaTransactionValidatorPlugin.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation; +package net.consensys.linea.sequencer.txpoolvalidation; import java.io.File; import java.nio.file.Files; @@ -41,11 +41,11 @@ */ @Slf4j @AutoService(BesuPlugin.class) -public class LineaTransactionValidatorPlugin extends AbstractLineaRequiredPlugin { +public class LineaTransactionPoolValidatorPlugin extends AbstractLineaRequiredPlugin { public static final String NAME = "linea"; private BesuConfiguration besuConfiguration; private BlockchainService blockchainService; - private TransactionPoolValidatorService transactionValidatorService; + private TransactionPoolValidatorService transactionPoolValidatorService; @Override public Optional getName() { @@ -70,28 +70,29 @@ public void doRegister(final BesuContext context) { new RuntimeException( "Failed to obtain BlockchainService from the BesuContext.")); - transactionValidatorService = + transactionPoolValidatorService = context .getService(TransactionPoolValidatorService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain TransactionValidationService from the BesuContext.")); + "Failed to obtain TransactionPoolValidationService from the BesuContext.")); } @Override public void beforeExternalServices() { super.beforeExternalServices(); try (Stream lines = - Files.lines(Path.of(new File(transactionValidatorConfiguration.denyListPath()).toURI()))) { + Files.lines( + Path.of(new File(transactionPoolValidatorConfiguration.denyListPath()).toURI()))) { final Set
denied = lines.map(l -> Address.fromHexString(l.trim())).collect(Collectors.toUnmodifiableSet()); - transactionValidatorService.registerPluginTransactionValidatorFactory( - new LineaTransactionValidatorFactory( + transactionPoolValidatorService.registerPluginTransactionValidatorFactory( + new LineaTransactionPoolValidatorFactory( besuConfiguration, blockchainService, - transactionValidatorConfiguration, + transactionPoolValidatorConfiguration, profitabilityConfiguration, denied)); diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java similarity index 98% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidator.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java index d15ad8e5..2ec608a5 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidator.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import java.util.Set; diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java similarity index 78% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidator.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java index dc7c736b..ec61c0ea 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidator.java @@ -12,28 +12,28 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import net.consensys.linea.config.LineaTransactionValidatorConfiguration; +import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidator; @Slf4j @RequiredArgsConstructor public class CalldataValidator implements PluginTransactionPoolValidator { - final LineaTransactionValidatorConfiguration txValidatorConf; + final LineaTransactionPoolValidatorConfiguration txPoolValidatorConf; @Override public Optional validateTransaction( final Transaction transaction, final boolean isLocal, final boolean hasPriority) { - if (transaction.getPayload().size() > txValidatorConf.maxTxCalldataSize()) { + if (transaction.getPayload().size() > txPoolValidatorConf.maxTxCalldataSize()) { final String errMsg = "Calldata of transaction is greater than the allowed max of " - + txValidatorConf.maxTxCalldataSize(); + + txPoolValidatorConf.maxTxCalldataSize(); log.debug(errMsg); return Optional.of(errMsg); } diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java similarity index 79% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidator.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java index 2c4cbea3..4ab3212d 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidator.java @@ -12,28 +12,28 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import net.consensys.linea.config.LineaTransactionValidatorConfiguration; +import net.consensys.linea.config.LineaTransactionPoolValidatorConfiguration; import org.hyperledger.besu.datatypes.Transaction; import org.hyperledger.besu.plugin.services.txvalidator.PluginTransactionPoolValidator; @Slf4j @RequiredArgsConstructor public class GasLimitValidator implements PluginTransactionPoolValidator { - final LineaTransactionValidatorConfiguration txValidatorConf; + final LineaTransactionPoolValidatorConfiguration txPoolValidatorConf; @Override public Optional validateTransaction( final Transaction transaction, final boolean isLocal, final boolean hasPriority) { - if (transaction.getGasLimit() > txValidatorConf.maxTxGasLimit()) { + if (transaction.getGasLimit() > txPoolValidatorConf.maxTxGasLimit()) { final String errMsg = "Gas limit of transaction is greater than the allowed max of " - + txValidatorConf.maxTxGasLimit(); + + txPoolValidatorConf.maxTxGasLimit(); log.debug(errMsg); return Optional.of(errMsg); } diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java similarity index 97% rename from arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidator.java rename to arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java index 78c6a7fa..97d25fd5 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidator.java @@ -12,7 +12,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; diff --git a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidatorTest.java b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java similarity index 98% rename from arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidatorTest.java rename to arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java index cd09fe01..c2f25f68 100644 --- a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/AllowedAddressValidatorTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/AllowedAddressValidatorTest.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import java.util.Set; diff --git a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidatorTest.java b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java similarity index 91% rename from arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidatorTest.java rename to arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java index 7f0e211d..fc775580 100644 --- a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/CalldataValidatorTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/CalldataValidatorTest.java @@ -13,13 +13,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import net.consensys.linea.config.LineaTransactionValidatorCliOptions; +import net.consensys.linea.config.LineaTransactionPoolValidatorCliOptions; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Wei; import org.junit.jupiter.api.Assertions; @@ -36,7 +36,7 @@ public class CalldataValidatorTest { public void initialize() { calldataValidator = new CalldataValidator( - LineaTransactionValidatorCliOptions.create().toDomainObject().toBuilder() + LineaTransactionPoolValidatorCliOptions.create().toDomainObject().toBuilder() .maxTxCalldataSize(MAX_TX_CALLDATA_SIZE) .build()); } diff --git a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidatorTest.java b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java similarity index 91% rename from arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidatorTest.java rename to arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java index 9ea005b2..219e62f4 100644 --- a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/GasLimitValidatorTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/GasLimitValidatorTest.java @@ -13,13 +13,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import java.util.Optional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import net.consensys.linea.config.LineaTransactionValidatorCliOptions; +import net.consensys.linea.config.LineaTransactionPoolValidatorCliOptions; import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.datatypes.Wei; import org.junit.jupiter.api.Assertions; @@ -36,7 +36,7 @@ public class GasLimitValidatorTest { public void initialize() { gasLimitValidator = new GasLimitValidator( - LineaTransactionValidatorCliOptions.create().toDomainObject().toBuilder() + LineaTransactionPoolValidatorCliOptions.create().toDomainObject().toBuilder() .maxTxGasLimit(MAX_TX_GAS_LIMIT) .build()); } diff --git a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidatorTest.java b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java similarity index 99% rename from arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidatorTest.java rename to arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java index 11c20292..34a18b6e 100644 --- a/arithmetization/src/test/java/net/consensys/linea/sequencer/txvalidation/validators/ProfitabilityValidatorTest.java +++ b/arithmetization/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/ProfitabilityValidatorTest.java @@ -13,7 +13,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package net.consensys.linea.sequencer.txvalidation.validators; +package net.consensys.linea.sequencer.txpoolvalidation.validators; import static org.assertj.core.api.Assertions.assertThat;