From 3e797297dd1aa5751fed42bc83d2de97888e1b69 Mon Sep 17 00:00:00 2001 From: Gabriel-Trintinalia Date: Tue, 9 Apr 2024 11:48:33 -0300 Subject: [PATCH] feature: PR suggestion Signed-off-by: Gabriel-Trintinalia --- .../linea/config/LineaTracerConfiguration.java | 2 +- .../config/LineaTracerConfigurationCLiOptions.java | 6 +++--- .../config/LineaTransactionSelectorCliOptions.java | 4 ---- .../consensys/linea/rpc/linea/LineaEstimateGas.java | 10 +++++----- .../modulelimit/ModuleLimitsValidationResult.java | 8 +++----- .../modulelimit/ModuleLineCountValidator.java | 2 +- 6 files changed, 13 insertions(+), 19 deletions(-) diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfiguration.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfiguration.java index bf2c3ced..a9b69033 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfiguration.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfiguration.java @@ -17,6 +17,6 @@ import lombok.Builder; -/** The Linea transaction selectors configuration. */ +/** The Linea tracer configuration. */ @Builder(toBuilder = true) public record LineaTracerConfiguration(String moduleLimitsFilePath) {} diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfigurationCLiOptions.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfigurationCLiOptions.java index 74377c3b..5b6f6c04 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfigurationCLiOptions.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaTracerConfigurationCLiOptions.java @@ -14,14 +14,14 @@ */ package net.consensys.linea.config; -import static net.consensys.linea.config.LineaTransactionSelectorCliOptions.DEFAULT_MODULE_LIMIT_FILE_PATH; -import static net.consensys.linea.config.LineaTransactionSelectorCliOptions.MODULE_LIMIT_FILE_PATH; - import com.google.common.base.MoreObjects; import picocli.CommandLine; public class LineaTracerConfigurationCLiOptions { + public static final String MODULE_LIMIT_FILE_PATH = "--plugin-linea-module-limit-file-path"; + public static final String DEFAULT_MODULE_LIMIT_FILE_PATH = "moduleLimitFile.toml"; + @CommandLine.Option( names = {MODULE_LIMIT_FILE_PATH}, hidden = true, diff --git a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionSelectorCliOptions.java b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionSelectorCliOptions.java index 85856c95..acfe4ad1 100644 --- a/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionSelectorCliOptions.java +++ b/arithmetization/src/main/java/net/consensys/linea/config/LineaTransactionSelectorCliOptions.java @@ -23,10 +23,6 @@ public class LineaTransactionSelectorCliOptions { public static final String MAX_BLOCK_CALLDATA_SIZE = "--plugin-linea-max-block-calldata-size"; public static final int DEFAULT_MAX_BLOCK_CALLDATA_SIZE = 70_000; - - public static final String MODULE_LIMIT_FILE_PATH = "--plugin-linea-module-limit-file-path"; - public static final String DEFAULT_MODULE_LIMIT_FILE_PATH = "moduleLimitFile.toml"; - public static final String OVER_LINE_COUNT_LIMIT_CACHE_SIZE = "--plugin-linea-over-line-count-limit-cache-size"; public static final int DEFAULT_OVER_LINE_COUNT_LIMIT_CACHE_SIZE = 10_000; 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 79e61a74..0fbb64df 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 @@ -110,6 +110,11 @@ public void init( this.txProfitabilityCalculator = new TransactionProfitabilityCalculator(profitabilityConf); this.l1L2BridgeConfiguration = l1L2BridgeConfiguration; this.moduleLineCountValidator = new ModuleLineCountValidator(limitsMap); + + if (l1L2BridgeConfiguration.isEmpty()) { + log.error("L1L2 bridge settings have not been defined."); + System.exit(1); + } } public String getNamespace() { @@ -203,11 +208,6 @@ private Long estimateGasUsed( final Transaction transaction, final Wei minGasPrice) { - if (l1L2BridgeConfiguration.isEmpty()) { - throw new PluginRpcEndpointException( - RpcErrorType.PLUGIN_INTERNAL_ERROR, "L1L2 bridge settings have not been defined"); - } - final var estimateGasOperationTracer = new EstimateGasOperationTracer(); final var zkTracer = createZkTracer(); TracerAggregator tracerAggregator = diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLimitsValidationResult.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLimitsValidationResult.java index e5ca09fb..67060827 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLimitsValidationResult.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLimitsValidationResult.java @@ -23,17 +23,15 @@ public class ModuleLimitsValidationResult { private final ModuleLineCountValidator.ModuleLineCountResult result; private final String moduleName; + public static ModuleLimitsValidationResult VALID = + new ModuleLimitsValidationResult(ModuleLineCountValidator.ModuleLineCountResult.VALID, null); + private ModuleLimitsValidationResult( ModuleLineCountValidator.ModuleLineCountResult result, String moduleName) { this.result = result; this.moduleName = moduleName; } - public static ModuleLimitsValidationResult valid() { - return new ModuleLimitsValidationResult( - ModuleLineCountValidator.ModuleLineCountResult.VALID, null); - } - public static ModuleLimitsValidationResult moduleNotDefined(String moduleName) { return new ModuleLimitsValidationResult( ModuleLineCountValidator.ModuleLineCountResult.MODULE_NOT_DEFINED, moduleName); diff --git a/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java b/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java index 0600f318..9dcb23e2 100644 --- a/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java +++ b/arithmetization/src/main/java/net/consensys/linea/sequencer/modulelimit/ModuleLineCountValidator.java @@ -79,7 +79,7 @@ public ModuleLimitsValidationResult validate(Map currentAccumul return ModuleLimitsValidationResult.blockModuleLineCountFull(moduleName); } } - return ModuleLimitsValidationResult.valid(); + return ModuleLimitsValidationResult.VALID; } /**