diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c7f31acc9a..790d2be303f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,11 +45,9 @@ are provided with different values, using input as per the execution-apis spec i - Implement `txpool_status` RPC method [#10002](https://github.com/hyperledger/besu/pull/10002) - Support [EIP-7975](https://eips.ethereum.org/EIPS/eip-7975): eth/70 - partial block receipt lists - Limit pooled tx requests by size and remove pre-eth/68 transaction announcement support [#9990](https://github.com/besu-eth/besu/pull/9990) -<<<<<<< optimize/register-based-shift - Use cache locality to improve Shift opcodes [#9878](https://github.com/besu-eth/besu/pull/9878) -======= +- Add maxUsedGas field to eth_simulateV1 results [#10066](https://github.com/besu-eth/besu/pull/10066) - Plugin API: pass pending block header when creating selectors [#10034](https://github.com/besu-eth/besu/pull/10034) ->>>>>>> main ## 26.2.0 diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockStateCallResult.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockStateCallResult.java index 9621e3d0539..1d70507d225 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockStateCallResult.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/BlockStateCallResult.java @@ -147,7 +147,8 @@ private static CallProcessingResult createTransactionProcessingResult( return new CallProcessingResult( result.isSuccessful() ? 1 : 0, result.getOutput(), - simulatorResult.getGasEstimate(), + result.getGasSpent(), + result.getEstimateGasUsedByTransaction(), getError(result), new LogsResult(transactionLogs)); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/CallProcessingResult.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/CallProcessingResult.java index 5341515d24b..9b68faf76b9 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/CallProcessingResult.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/CallProcessingResult.java @@ -32,6 +32,9 @@ public class CallProcessingResult { @JsonProperty("gasUsed") private final String gasUsed; + @JsonProperty("maxUsedGas") + private final String maxUsedGas; + @JsonProperty("error") private final JsonRpcError error; @@ -42,11 +45,13 @@ public CallProcessingResult( @JsonProperty("status") final int status, @JsonProperty("returnData") final Bytes returnData, @JsonProperty("gasUsed") final long gasUsed, + @JsonProperty("maxUsedGas") final long maxUsedGas, @JsonProperty("error") final JsonRpcError error, @JsonProperty("logs") final LogsResult logs) { this.status = Quantity.create(status); this.returnData = returnData.toString(); this.gasUsed = Quantity.create(gasUsed); + this.maxUsedGas = Quantity.create(maxUsedGas); this.error = error; this.logs = logs; } @@ -63,6 +68,10 @@ public String getGasUsed() { return gasUsed; } + public String getMaxUsedGas() { + return maxUsedGas; + } + @JsonInclude(JsonInclude.Include.NON_NULL) public JsonRpcError getError() { return error; diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation-with-authority.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation-with-authority.json index 9e4ac188dfa..571ed5811fa 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation-with-authority.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation-with-authority.json @@ -74,6 +74,7 @@ ] } ], + "maxUsedGas": "0x13b30", "returnData": "0x", "status": "0x1" } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation.json index f3cf41269d5..1a87482ca61 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-code-delegation.json @@ -68,12 +68,14 @@ { "gasUsed": "0xa637", "logs": [], + "maxUsedGas": "0xcfc4", "returnData": "0x", "status": "0x1" }, { "gasUsed": "0x5db5", "logs": [], + "maxUsedGas": "0x5db5", "returnData": "0x0000000000000000000000000000000000000000000000000000000000000000", "status": "0x1" } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-simple.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-simple.json index e0ecdd7ab13..5b1be7eaa01 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-simple.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-simple.json @@ -42,12 +42,14 @@ { "gasUsed": "0x5208", "logs": [], + "maxUsedGas": "0x5208", "returnData": "0x", "status": "0x1" }, { "gasUsed": "0x5208", "logs": [], + "maxUsedGas": "0x5208", "returnData": "0x", "status": "0x1" } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-trie-log.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-trie-log.json index 03fcb69ca5e..69db86cb7fc 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-trie-log.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1-trie-log.json @@ -43,12 +43,14 @@ { "gasUsed": "0x5208", "logs": [], + "maxUsedGas": "0x5208", "returnData": "0x", "status": "0x1" }, { "gasUsed": "0x5208", "logs": [], + "maxUsedGas": "0x5208", "returnData": "0x", "status": "0x1" } diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1_blobs.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1_blobs.json index 2e7f6bb705e..9439122cfb9 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1_blobs.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/simulateV1/specs/eth_simulateV1_blobs.json @@ -66,6 +66,7 @@ { "gasUsed": "0x53f6", "logs": [], + "maxUsedGas": "0x53f6", "returnData": "0x010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c44401400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "status": "0x1" } @@ -130,6 +131,7 @@ { "gasUsed": "0x53f6", "logs": [], + "maxUsedGas": "0x53f6", "returnData": "0x010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c44401400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "status": "0x1" }