Skip to content

Commit

Permalink
feature: PR suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel-Trintinalia <[email protected]>
  • Loading branch information
Gabriel-Trintinalia committed Apr 9, 2024
1 parent 83396d4 commit 3e79729
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

import lombok.Builder;

/** The Linea transaction selectors configuration. */
/** The Linea tracer configuration. */
@Builder(toBuilder = true)
public record LineaTracerConfiguration(String moduleLimitsFilePath) {}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public ModuleLimitsValidationResult validate(Map<String, Integer> currentAccumul
return ModuleLimitsValidationResult.blockModuleLineCountFull(moduleName);
}
}
return ModuleLimitsValidationResult.valid();
return ModuleLimitsValidationResult.VALID;
}

/**
Expand Down

0 comments on commit 3e79729

Please sign in to comment.