From dcec6951cbf9fb80dd179edc05c19ef82fc3e329 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 29 Nov 2024 11:10:03 +0100 Subject: [PATCH] Update Linea Besu and Tracer (#112) Signed-off-by: Fabio Di Fabio --- .../plugin/acc/test/LineaPluginTestBase.java | 2 +- .../resources/moduleLimits_sendRawTx.toml | 2 +- .../resources/txOverflowModuleLimits.toml | 2 +- gradle.properties | 6 ++-- .../linea/AbstractLineaRequiredPlugin.java | 14 ++++----- ...stractLineaSharedPrivateOptionsPlugin.java | 31 ++++++++++--------- .../linea/extradata/LineaExtraDataPlugin.java | 17 +++++----- .../LineaEstimateGasEndpointPlugin.java | 18 +++++------ .../LineaSetExtraDataEndpointPlugin.java | 10 +++--- .../LineaTransactionPoolValidatorPlugin.java | 16 +++++----- .../LineaTransactionSelectorPlugin.java | 12 +++---- 11 files changed, 66 insertions(+), 64 deletions(-) diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java index 68047249..a5d52571 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/LineaPluginTestBase.java @@ -352,7 +352,7 @@ protected double getMetricValue( + metricName + labelValues.stream() .map(lv -> lv.getKey() + "=\"" + lv.getValue() + "\"") - .collect(Collectors.joining(",", "{", ",}")); + .collect(Collectors.joining(",", "{", "}")); final var foundMetric = respLines.body().filter(line -> line.startsWith(searchString)).findFirst(); diff --git a/acceptance-tests/src/test/resources/moduleLimits_sendRawTx.toml b/acceptance-tests/src/test/resources/moduleLimits_sendRawTx.toml index c8dec3c8..bfe3d64a 100644 --- a/acceptance-tests/src/test/resources/moduleLimits_sendRawTx.toml +++ b/acceptance-tests/src/test/resources/moduleLimits_sendRawTx.toml @@ -32,7 +32,7 @@ ROM_LEX = 20 SHF = 63 TX_RLP = 131072 TRM = 120 -WCP = 149 +WCP = 156 LOG_DATA = 20 LOG_INFO = 20 RLP_ADDR = 20 diff --git a/acceptance-tests/src/test/resources/txOverflowModuleLimits.toml b/acceptance-tests/src/test/resources/txOverflowModuleLimits.toml index 58f903b0..6d369917 100644 --- a/acceptance-tests/src/test/resources/txOverflowModuleLimits.toml +++ b/acceptance-tests/src/test/resources/txOverflowModuleLimits.toml @@ -20,7 +20,7 @@ EUC = 16384 # can probably be lower EXP = 32760 EXT = 20 GAS = 262144 -HUB = 50 +HUB = 51 MMIO = 1048576 MMU = 524288 MOD = 20 diff --git a/gradle.properties b/gradle.properties index 6fe052df..ae194b4f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -releaseVersion=0.8.0-rc4.1 -besuVersion=24.11-develop-96e9ed8 -arithmetizationVersion=0.8.0-rc4 +releaseVersion=0.8.0-rc6.1 +besuVersion=24.11-delivery39 +arithmetizationVersion=0.8.0-rc6 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-sequencer distributionBaseUrl=https://artifacts.consensys.net/public/linea-besu/raw/names/linea-besu.tar.gz/versions/ \ No newline at end of file diff --git a/sequencer/src/main/java/net/consensys/linea/AbstractLineaRequiredPlugin.java b/sequencer/src/main/java/net/consensys/linea/AbstractLineaRequiredPlugin.java index 427796a1..b3e7ccf9 100644 --- a/sequencer/src/main/java/net/consensys/linea/AbstractLineaRequiredPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/AbstractLineaRequiredPlugin.java @@ -16,8 +16,8 @@ package net.consensys.linea; import lombok.extern.slf4j.Slf4j; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; @Slf4j public abstract class AbstractLineaRequiredPlugin extends AbstractLineaSharedPrivateOptionsPlugin { @@ -28,15 +28,15 @@ public abstract class AbstractLineaRequiredPlugin extends AbstractLineaSharedPri * *

If that's NOT desired, the plugin should implement {@link BesuPlugin} directly. * - * @param context the BesuContext to be used. + * @param serviceManager the ServiceManager to be used. */ @Override - public void register(final BesuContext context) { - super.register(context); + public void register(final ServiceManager serviceManager) { + super.register(serviceManager); try { log.info("Registering Linea plugin {}", this.getClass().getName()); - doRegister(context); + doRegister(serviceManager); } catch (Exception e) { log.error("Halting Besu startup: exception in plugin registration: ", e); @@ -49,7 +49,7 @@ public void register(final BesuContext context) { /** * Linea plugins need to implement this method. Called by {@link BesuPlugin} register method * - * @param context the BesuContext to be used. + * @param serviceManager the ServiceManager to be used. */ - public abstract void doRegister(final BesuContext context); + public abstract void doRegister(final ServiceManager serviceManager); } diff --git a/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java b/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java index 70b3cffa..c8898c64 100644 --- a/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/AbstractLineaSharedPrivateOptionsPlugin.java @@ -36,7 +36,7 @@ import net.consensys.linea.metrics.LineaMetricCategory; import net.consensys.linea.plugins.AbstractLineaSharedOptionsPlugin; import net.consensys.linea.plugins.LineaOptionsPluginConfiguration; -import org.hyperledger.besu.plugin.BesuContext; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry; @@ -63,7 +63,7 @@ public abstract class AbstractLineaSharedPrivateOptionsPlugin private static final AtomicBoolean sharedRegisterTasksDone = new AtomicBoolean(false); private static final AtomicBoolean sharedStartTasksDone = new AtomicBoolean(false); - private BesuContext besuContext; + private ServiceManager serviceManager; static { // force the initialization of the gnark compress native library to fail fast in case of issues @@ -124,31 +124,31 @@ public LineaRejectedTxReportingConfiguration rejectedTxReportingConfiguration() } @Override - public synchronized void register(final BesuContext context) { - super.register(context); + public synchronized void register(final ServiceManager serviceManager) { + super.register(serviceManager); - besuContext = context; + this.serviceManager = serviceManager; if (sharedRegisterTasksDone.compareAndSet(false, true)) { - performSharedRegisterTasksOnce(context); + performSharedRegisterTasksOnce(serviceManager); } } - protected static void performSharedRegisterTasksOnce(final BesuContext context) { + protected static void performSharedRegisterTasksOnce(final ServiceManager serviceManager) { blockchainService = - context + serviceManager .getService(BlockchainService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain BlockchainService from the BesuContext.")); + "Failed to obtain BlockchainService from the ServiceManager.")); - context + serviceManager .getService(MetricCategoryRegistry.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain MetricCategoryRegistry from the BesuContext.")) + "Failed to obtain MetricCategoryRegistry from the ServiceManager.")) .addMetricCategory(LineaMetricCategory.PROFITABILITY); } @@ -157,11 +157,11 @@ public void start() { super.start(); if (sharedStartTasksDone.compareAndSet(false, true)) { - performSharedStartTasksOnce(besuContext); + performSharedStartTasksOnce(serviceManager); } } - private static void performSharedStartTasksOnce(final BesuContext context) { + private static void performSharedStartTasksOnce(final ServiceManager serviceManager) { blockchainService .getChainId() .ifPresentOrElse( @@ -175,10 +175,11 @@ private static void performSharedStartTasksOnce(final BesuContext context) { }); metricsSystem = - context + serviceManager .getService(MetricsSystem.class) .orElseThrow( - () -> new RuntimeException("Failed to obtain MetricSystem from the BesuContext.")); + () -> + new RuntimeException("Failed to obtain MetricSystem from the ServiceManager.")); } @Override diff --git a/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java b/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java index d00c7b3b..907e3bd0 100644 --- a/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/extradata/LineaExtraDataPlugin.java @@ -22,8 +22,8 @@ import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.config.LineaProfitabilityConfiguration; import net.consensys.linea.metrics.LineaMetricCategory; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.data.AddedBlockContext; import org.hyperledger.besu.plugin.services.BesuEvents; import org.hyperledger.besu.plugin.services.BesuEvents.InitialSyncCompletionListener; @@ -33,19 +33,19 @@ @Slf4j @AutoService(BesuPlugin.class) public class LineaExtraDataPlugin extends AbstractLineaRequiredPlugin { - private BesuContext besuContext; + private ServiceManager serviceManager; private RpcEndpointService rpcEndpointService; @Override - public void doRegister(final BesuContext context) { - besuContext = context; + public void doRegister(final ServiceManager context) { + serviceManager = context; rpcEndpointService = context .getService(RpcEndpointService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain RpcEndpointService from the BesuContext.")); + "Failed to obtain RpcEndpointService from the ServiceManager.")); } /** @@ -58,10 +58,11 @@ public void start() { super.start(); if (profitabilityConfiguration().extraDataPricingEnabled()) { final var besuEventsService = - besuContext + serviceManager .getService(BesuEvents.class) .orElseThrow( - () -> new RuntimeException("Failed to obtain BesuEvents from the BesuContext.")); + () -> + new RuntimeException("Failed to obtain BesuEvents from the ServiceManager.")); // assume that we are in sync by default to support reading extra data at genesis final AtomicBoolean inSync = new AtomicBoolean(true); @@ -99,7 +100,7 @@ public synchronized void onInitialSyncRestart() { private void initMetrics(final LineaProfitabilityConfiguration lineaProfitabilityConfiguration) { final var confLabelledGauge = - metricsSystem.createLabelledGauge( + metricsSystem.createLabelledSuppliedGauge( LineaMetricCategory.PROFITABILITY, "conf", "Profitability configuration values at runtime", diff --git a/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaEstimateGasEndpointPlugin.java b/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaEstimateGasEndpointPlugin.java index 6d80e523..3f9d2f93 100644 --- a/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaEstimateGasEndpointPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaEstimateGasEndpointPlugin.java @@ -21,8 +21,8 @@ import lombok.extern.slf4j.Slf4j; import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.rpc.methods.LineaEstimateGas; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.TransactionSimulationService; @@ -39,33 +39,33 @@ public class LineaEstimateGasEndpointPlugin extends AbstractLineaRequiredPlugin /** * Register the RPC service. * - * @param context the BesuContext to be used. + * @param serviceManager the BesuContext to be used. */ @Override - public void doRegister(final BesuContext context) { + public void doRegister(final ServiceManager serviceManager) { besuConfiguration = - context + serviceManager .getService(BesuConfiguration.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain BesuConfiguration from the BesuContext.")); + "Failed to obtain BesuConfiguration from the ServiceManager.")); rpcEndpointService = - context + serviceManager .getService(RpcEndpointService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain RpcEndpointService from the BesuContext.")); + "Failed to obtain RpcEndpointService from the ServiceManager.")); transactionSimulationService = - context + serviceManager .getService(TransactionSimulationService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain TransactionSimulatorService from the BesuContext.")); + "Failed to obtain TransactionSimulatorService from the ServiceManager.")); lineaEstimateGasMethod = new LineaEstimateGas( diff --git a/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaSetExtraDataEndpointPlugin.java b/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaSetExtraDataEndpointPlugin.java index 17d973f0..b5f913bf 100644 --- a/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaSetExtraDataEndpointPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/rpc/services/LineaSetExtraDataEndpointPlugin.java @@ -20,8 +20,8 @@ import net.consensys.linea.AbstractLineaRequiredPlugin; import net.consensys.linea.extradata.LineaExtraDataHandler; import net.consensys.linea.rpc.methods.LineaSetExtraData; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.RpcEndpointService; /** Registers RPC endpoints. This class provides RPC endpoints under the 'linea' namespace. */ @@ -34,18 +34,18 @@ public class LineaSetExtraDataEndpointPlugin extends AbstractLineaRequiredPlugin /** * Register the RPC service. * - * @param context the BesuContext to be used. + * @param serviceManager the ServiceManager to be used. */ @Override - public void doRegister(final BesuContext context) { + public void doRegister(final ServiceManager serviceManager) { rpcEndpointService = - context + serviceManager .getService(RpcEndpointService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain RpcEndpointService from the BesuContext.")); + "Failed to obtain RpcEndpointService from the ServiceManager.")); lineaSetExtraDataMethod = new LineaSetExtraData(rpcEndpointService); diff --git a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java index 410e83e9..4ca4a2ac 100644 --- a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java @@ -31,8 +31,8 @@ import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; import net.consensys.linea.jsonrpc.JsonRpcManager; import org.hyperledger.besu.datatypes.Address; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.TransactionSimulationService; @@ -52,30 +52,30 @@ public class LineaTransactionPoolValidatorPlugin extends AbstractLineaRequiredPl private Optional rejectedTxJsonRpcManager = Optional.empty(); @Override - public void doRegister(final BesuContext context) { + public void doRegister(final ServiceManager serviceManager) { besuConfiguration = - context + serviceManager .getService(BesuConfiguration.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain BesuConfiguration from the BesuContext.")); + "Failed to obtain BesuConfiguration from the ServiceManager.")); transactionPoolValidatorService = - context + serviceManager .getService(TransactionPoolValidatorService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain TransactionPoolValidationService from the BesuContext.")); + "Failed to obtain TransactionPoolValidationService from the ServiceManager.")); transactionSimulationService = - context + serviceManager .getService(TransactionSimulationService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain TransactionSimulatorService from the BesuContext.")); + "Failed to obtain TransactionSimulatorService from the ServiceManager.")); } @Override diff --git a/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java b/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java index 69b60e97..e25a0c03 100644 --- a/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java +++ b/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/LineaTransactionSelectorPlugin.java @@ -25,8 +25,8 @@ import net.consensys.linea.config.LineaRejectedTxReportingConfiguration; import net.consensys.linea.config.LineaTransactionSelectorConfiguration; import net.consensys.linea.jsonrpc.JsonRpcManager; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.TransactionSelectionService; @@ -43,22 +43,22 @@ public class LineaTransactionSelectorPlugin extends AbstractLineaRequiredPlugin private BesuConfiguration besuConfiguration; @Override - public void doRegister(final BesuContext context) { + public void doRegister(final ServiceManager serviceManager) { transactionSelectionService = - context + serviceManager .getService(TransactionSelectionService.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain TransactionSelectionService from the BesuContext.")); + "Failed to obtain TransactionSelectionService from the ServiceManager.")); besuConfiguration = - context + serviceManager .getService(BesuConfiguration.class) .orElseThrow( () -> new RuntimeException( - "Failed to obtain BesuConfiguration from the BesuContext.")); + "Failed to obtain BesuConfiguration from the ServiceManager.")); } @Override