From d8ab71d37bf7be503d27e952bf26e3b7adfa3a5b Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Fri, 6 Dec 2024 14:38:39 +0100 Subject: [PATCH] Make `linea_estimateGas` to simulate tx on pending block Signed-off-by: Fabio Di Fabio --- gradle.properties | 2 +- .../net/consensys/linea/rpc/methods/LineaEstimateGas.java | 7 +++---- .../txpoolvalidation/validators/SimulationValidator.java | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index ae194b4f..1975ec14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ releaseVersion=0.8.0-rc6.1 -besuVersion=24.11-delivery39 +besuVersion=24.12-develop-cf50479 arithmetizationVersion=0.8.0-rc6 besuArtifactGroup=io.consensys.linea-besu distributionIdentifier=linea-sequencer diff --git a/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java b/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java index 0a8f1101..f3250aa1 100644 --- a/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java +++ b/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java @@ -277,10 +277,9 @@ private Long estimateGasUsed( final var zkTracer = createZkTracer(chainHeadHeader, blockchainService.getChainId().get()); final TracerAggregator zkAndGasTracer = TracerAggregator.create(estimateGasTracer, zkTracer); - final var chainHeadHash = chainHeadHeader.getBlockHash(); final var maybeSimulationResults = transactionSimulationService.simulate( - transaction, maybeStateOverrides, chainHeadHash, zkAndGasTracer, false); + transaction, maybeStateOverrides, Optional.empty(), zkAndGasTracer, false); ModuleLimitsValidationResult moduleLimit = moduleLineCountValidator.validate(zkTracer.getModulesLineCount()); @@ -328,7 +327,7 @@ private Long estimateGasUsed( transactionSimulationService.simulate( createTransactionForSimulation(callParameters, lowGasEstimation), maybeStateOverrides, - chainHeadHash, + Optional.empty(), estimateGasTracer, true); @@ -364,7 +363,7 @@ private Long estimateGasUsed( transactionSimulationService.simulate( createTransactionForSimulation(callParameters, mid), maybeStateOverrides, - chainHeadHash, + Optional.empty(), estimateGasTracer, true); diff --git a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java index 75204eb6..7d9638d6 100644 --- a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java +++ b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java @@ -89,8 +89,7 @@ public Optional validateTransaction( final var zkTracer = createZkTracer(chainHeadHeader, blockchainService.getChainId().get()); final var maybeSimulationResults = - transactionSimulationService.simulate( - transaction, chainHeadHeader.getBlockHash(), zkTracer, true); + transactionSimulationService.simulate(transaction, Optional.empty(), zkTracer, true); ModuleLimitsValidationResult moduleLimitResult = moduleLineCountValidator.validate(zkTracer.getModulesLineCount());