diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java index da41344f5..9fcf28fe3 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasCompatibilityModeTest.java @@ -71,7 +71,7 @@ public void lineaEstimateGasPriorityFeeMinGasPriceLowerBound() { final Account sender = accounts.getSecondaryBenefactor(); final CallParams callParams = - new CallParams(null, sender.getAddress(), null, "", "", "0", null, null, null); + new CallParams(null, sender.getAddress(), null, null, "", "", "0", null, null, null); final var reqLinea = new LineaEstimateGasRequest(callParams); final var respLinea = reqLinea.execute(minerNode.nodeRequests()).getResult(); diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java index cff3e6e72..7d76243db 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasModuleLimitOverflowTest.java @@ -50,6 +50,7 @@ public void estimateGasFailsForExceedingModuleLineCountTest() throws Exception { new EstimateGasTest.CallParams( null, sender.getAddress(), + null, simpleStorage.getContractAddress(), null, payload.toHexString(), diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java index 30d3ad952..f9aa62a2a 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EstimateGasTest.java @@ -99,6 +99,7 @@ public void lineaEstimateGasMatchesEthEstimateGas() { new CallParams( null, sender.getAddress(), + null, sender.getAddress(), null, Bytes.EMPTY.toHexString(), @@ -123,6 +124,7 @@ public void passingGasPriceFieldWorks() { new CallParams( null, sender.getAddress(), + null, sender.getAddress(), null, Bytes.EMPTY.toHexString(), @@ -146,6 +148,7 @@ public void passingChainIdFieldWorks() { new CallParams( "0x539", sender.getAddress(), + null, sender.getAddress(), null, Bytes.EMPTY.toHexString(), @@ -169,6 +172,7 @@ public void passingEIP1559FieldsWorks() { new CallParams( null, sender.getAddress(), + null, sender.getAddress(), null, Bytes.EMPTY.toHexString(), @@ -192,6 +196,7 @@ public void passingChainIdAndEIP1559FieldsWorks() { new CallParams( "0x539", sender.getAddress(), + null, sender.getAddress(), null, Bytes.EMPTY.toHexString(), @@ -219,6 +224,7 @@ public void passingStateOverridesWorks() { new CallParams( "0x539", sender.getAddress(), + null, sender.getAddress(), "1", Bytes.EMPTY.toHexString(), @@ -239,6 +245,49 @@ public void passingStateOverridesWorks() { "transaction up-front cost 0x208cbab601 exceeds transaction sender account balance 0x0"); } + @Test + public void passingNonceWorks() { + + final Account sender = accounts.getSecondaryBenefactor(); + + final CallParams callParams = + new CallParams( + null, + sender.getAddress(), + "0", + sender.getAddress(), + null, + Bytes.EMPTY.toHexString(), + "0", + null, + "0x1234", + null); + + final var reqLinea = new LineaEstimateGasRequest(callParams); + final var respLinea = reqLinea.execute(minerNode.nodeRequests()); + assertThat(respLinea.hasError()).isFalse(); + assertThat(respLinea.getResult()).isNotNull(); + + // try with a future nonce + final CallParams callParamsFuture = + new CallParams( + null, + sender.getAddress(), + "10", + sender.getAddress(), + null, + Bytes.EMPTY.toHexString(), + "0", + null, + "0x1234", + null); + + final var reqLineaFuture = new LineaEstimateGasRequest(callParamsFuture); + final var respLineaFuture = reqLineaFuture.execute(minerNode.nodeRequests()); + assertThat(respLineaFuture.hasError()).isFalse(); + assertThat(respLineaFuture.getResult()).isNotNull(); + } + @Test public void lineaEstimateGasIsProfitable() { @@ -259,6 +308,7 @@ public void lineaEstimateGasIsProfitable() { new CallParams( null, sender.getAddress(), + null, sender.getAddress(), null, payload.toHexString(), @@ -320,6 +370,7 @@ public void invalidParametersLineaEstimateGasRequestReturnErrorResponse() { null, sender.getAddress(), null, + null, "", "", String.valueOf(Integer.MAX_VALUE), @@ -341,6 +392,7 @@ public void revertedTransactionReturnErrorResponse() throws Exception { new CallParams( null, sender.getAddress(), + null, simpleStorage.getContractAddress(), "", "", @@ -363,6 +415,7 @@ public void failedTransactionReturnErrorResponse() { null, sender.getAddress(), null, + null, "", Accounts.GENESIS_ACCOUNT_TWO_PRIVATE_KEY, "0", @@ -492,6 +545,7 @@ static class RawEstimateGasResponse extends org.web3j.protocol.core.Response