Skip to content

Commit

Permalink
Update Linea Besu and Tracer
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <[email protected]>
  • Loading branch information
fab-10 committed Nov 29, 2024
1 parent 4d925ad commit ce548b8
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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/
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -28,15 +28,15 @@ public abstract class AbstractLineaRequiredPlugin extends AbstractLineaSharedPri
*
* <p>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);
Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
}

Expand All @@ -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(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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."));
}

/**
Expand All @@ -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);
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -52,30 +52,30 @@ public class LineaTransactionPoolValidatorPlugin extends AbstractLineaRequiredPl
private Optional<JsonRpcManager> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit ce548b8

Please sign in to comment.