From 2924de01fe53850a94075e6489356ce837fa6211 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 4 Feb 2025 16:23:15 +1000 Subject: [PATCH 1/8] Invalidate engine_newPayloadV3 if it contains executionRequests (#8223) Signed-off-by: Simon Dudley --- .../methods/engine/EngineNewPayloadV3.java | 4 ++ .../methods/engine/ForkSupportHelper.java | 8 ++-- .../engine/EngineNewPayloadV3Test.java | 22 ++++++++++- .../engine/EngineNewPayloadV4Test.java | 38 +++++++++++++++++++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3.java index ed9857d2003..beb566cfc98 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3.java @@ -78,6 +78,10 @@ protected ValidationResult validateParameters( return ValidationResult.invalid( RpcErrorType.INVALID_PARENT_BEACON_BLOCK_ROOT_PARAMS, "Missing parent beacon block root field"); + } else if (maybeRequestsParam.isPresent()) { + return ValidationResult.invalid( + RpcErrorType.INVALID_EXECUTION_REQUESTS_PARAMS, + "Unexpected execution requests field present"); } else { return ValidationResult.valid(); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/ForkSupportHelper.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/ForkSupportHelper.java index d2fe1c12d5f..c5a022f997f 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/ForkSupportHelper.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/ForkSupportHelper.java @@ -22,19 +22,21 @@ public class ForkSupportHelper { public static ValidationResult validateForkSupported( - final HardforkId hardforkId, + final HardforkId firstSupportedHardforkId, final Optional maybeForkMilestone, final long blockTimestamp) { if (maybeForkMilestone.isEmpty()) { return ValidationResult.invalid( RpcErrorType.UNSUPPORTED_FORK, - "Configuration error, no schedule for " + hardforkId.name() + " fork set"); + "Configuration error, no schedule for " + firstSupportedHardforkId.name() + " fork set"); } if (Long.compareUnsigned(blockTimestamp, maybeForkMilestone.get()) < 0) { return ValidationResult.invalid( RpcErrorType.UNSUPPORTED_FORK, - hardforkId.name() + " configured to start at timestamp: " + maybeForkMilestone.get()); + firstSupportedHardforkId.name() + + " configured to start at timestamp: " + + maybeForkMilestone.get()); } return ValidationResult.valid(); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java index 205f11ec5f1..2fb45124821 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java @@ -141,7 +141,7 @@ public void shouldInvalidVersionedHash_whenShortVersionedHash() { } @Test - public void shouldValidVersionedHash_whenListIsEmpty() { + public void validateVersionedHash_whenListIsPresentAndEmpty() { final BlockHeader mockHeader = setupValidPayload( new BlockProcessingResult(Optional.of(new BlockProcessingOutputs(null, List.of()))), @@ -153,10 +153,28 @@ public void shouldValidVersionedHash_whenListIsEmpty() { payload, Optional.of(List.of()), Optional.of("0x0000000000000000000000000000000000000000000000000000000000000000"), - Optional.of(emptyList())); + Optional.empty()); assertThat(res.isValid()).isTrue(); } + @Test + public void validateExecutionRequests_whenPresent() { + final BlockHeader mockHeader = + setupValidPayload( + new BlockProcessingResult(Optional.of(new BlockProcessingOutputs(null, List.of()))), + Optional.empty()); + final EnginePayloadParameter payload = mockEnginePayload(mockHeader, emptyList(), null); + + ValidationResult res = + method.validateParameters( + payload, + Optional.of(List.of()), + Optional.of("0x0000000000000000000000000000000000000000000000000000000000000000"), + Optional.of(emptyList())); + assertThat(res.isValid()).isFalse(); + assertThat(res.getInvalidReason()).isEqualTo(RpcErrorType.INVALID_EXECUTION_REQUESTS_PARAMS); + } + @Override protected BlockHeader createBlockHeader(final Optional> maybeWithdrawals) { BlockHeader parentBlockHeader = diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java index 525390c8520..8dc84418bc2 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java @@ -35,11 +35,13 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EnginePayloadParameter; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Request; import org.hyperledger.besu.ethereum.core.Withdrawal; import org.hyperledger.besu.ethereum.mainnet.BodyValidation; +import org.hyperledger.besu.ethereum.mainnet.ValidationResult; import org.hyperledger.besu.ethereum.mainnet.requests.MainnetRequestsValidator; import org.hyperledger.besu.ethereum.mainnet.requests.ProhibitedRequestValidator; import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator; @@ -131,6 +133,42 @@ public void shouldReturnInvalidIfRequestsIsNotNull_WhenRequestsProhibited() { verify(engineCallListener, times(1)).executionEngineCalled(); } + @Override + @Test + public void validateVersionedHash_whenListIsPresentAndEmpty() { + final BlockHeader mockHeader = + setupValidPayload( + new BlockProcessingResult(Optional.of(new BlockProcessingOutputs(null, List.of()))), + Optional.empty()); + final EnginePayloadParameter payload = mockEnginePayload(mockHeader, emptyList(), null); + + ValidationResult res = + method.validateParameters( + payload, + Optional.of(List.of()), + Optional.of("0x0000000000000000000000000000000000000000000000000000000000000000"), + Optional.of(List.of())); + assertThat(res.isValid()).isTrue(); + } + + @Override + @Test + public void validateExecutionRequests_whenPresent() { + final BlockHeader mockHeader = + setupValidPayload( + new BlockProcessingResult(Optional.of(new BlockProcessingOutputs(null, List.of()))), + Optional.empty()); + final EnginePayloadParameter payload = mockEnginePayload(mockHeader, emptyList(), null); + + ValidationResult res = + method.validateParameters( + payload, + Optional.of(List.of()), + Optional.of("0x0000000000000000000000000000000000000000000000000000000000000000"), + Optional.of(emptyList())); + assertThat(res.isValid()).isTrue(); + } + private BlockHeader createValidBlockHeaderForV4( final Optional> maybeWithdrawals) { return createBlockHeaderFixtureForV3(maybeWithdrawals) From cb5c223002eb69f68841dca922c2100cf4eae66b Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 4 Feb 2025 18:21:04 +1000 Subject: [PATCH 2/8] Use 9 for max blobs when sizing BlobCache (#8222) Supports Pectra EIP-7691 Signed-off-by: Simon Dudley --- .../hyperledger/besu/ethereum/eth/transactions/BlobCache.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java index 1cca3f5ee25..660b123c0ea 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/BlobCache.java @@ -34,7 +34,8 @@ public class BlobCache { public BlobCache() { this.cache = Caffeine.newBuilder() - .maximumSize(6 * 32 * 3L) // 6 blobs max per 32 slots per 3 epochs + .maximumSize( + 9 * 32 * 3L) // 9 blobs max (since Prague EIP-7691) per 32 slots per 3 epochs .expireAfterWrite( 3 * 32 * 12L, TimeUnit.SECONDS) // 3 epochs of 32 slots which take 12 seconds each. .build(); From e006bbf62e417dd23ab1e0269059d0550937a58c Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Tue, 4 Feb 2025 18:57:36 +1000 Subject: [PATCH 3/8] [TESTING] disable flaky fast sync actions test (#8208) Signed-off-by: Sally MacFarlane --- .../besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java index fe9683059f4..cddc9fcd9a8 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncActionsTest.java @@ -56,6 +56,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.params.ParameterizedTest; @@ -63,6 +64,8 @@ import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; +@Disabled( + "Fast sync is broken - https://github.com/hyperledger/besu/issues/7511 and deprecated, and this test is flaky") public class FastSyncActionsTest { private final WorldStateStorageCoordinator worldStateStorageCoordinator = mock(WorldStateStorageCoordinator.class); From 90df5e5564176015c14f4b9d85a28eadd2036cc5 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Tue, 4 Feb 2025 10:52:34 +0100 Subject: [PATCH 4/8] Not all invalid transient not selected txs should be penalized (#8231) Signed-off-by: Fabio Di Fabio --- .../ProcessingResultTransactionSelector.java | 7 ++++--- .../AbstractBlockTransactionSelectorTest.java | 10 ++++----- .../LayeredPendingTransactionsTest.java | 2 +- plugin-api/build.gradle | 2 +- .../data/TransactionSelectionResult.java | 21 +++++++++++++++---- 5 files changed, 28 insertions(+), 14 deletions(-) diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/ProcessingResultTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/ProcessingResultTransactionSelector.java index 5a9fd6030cd..120ad372a36 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/ProcessingResultTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/ProcessingResultTransactionSelector.java @@ -85,14 +85,15 @@ private TransactionSelectionResult transactionSelectionResultForInvalidResult( final ValidationResult invalidReasonValidationResult) { final TransactionInvalidReason invalidReason = invalidReasonValidationResult.getInvalidReason(); - // If the invalid reason is transient, then leave the transaction in the pool and continue + // If the invalid reason is transient, then penalize but leave the transaction in the pool and + // continue if (isTransientValidationError(invalidReason)) { LOG.atTrace() - .setMessage("Transient validation error {} for transaction {} keeping it in the pool") + .setMessage("Transient validation error {} for transaction {}, penalize it in the pool") .addArgument(invalidReason) .addArgument(transaction::toTraceLog) .log(); - return TransactionSelectionResult.invalidTransient(invalidReason.name()); + return TransactionSelectionResult.invalidPenalized(invalidReason.name()); } // If the transaction was invalid for any other reason, delete it, and continue. LOG.atTrace() diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java index 8d9b51b97ff..9875a0149c0 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java @@ -852,7 +852,7 @@ public void transactionWithIncorrectNonceRemainsInPoolAndNotSelected() { .containsOnly( entry( futureTransaction, - TransactionSelectionResult.invalidTransient( + TransactionSelectionResult.invalidPenalized( TransactionInvalidReason.NONCE_TOO_HIGH.name()))); } @@ -1035,13 +1035,13 @@ private void internalBlockSelectionTimeoutSimulation( try { Thread.sleep(t); } catch (final InterruptedException e) { - return TransactionSelectionResult.invalidTransient(EXECUTION_INTERRUPTED.name()); + return TransactionSelectionResult.invalidPenalized(EXECUTION_INTERRUPTED.name()); } } else { try { Thread.sleep(fastProcessingTxTime); } catch (final InterruptedException e) { - return TransactionSelectionResult.invalidTransient(EXECUTION_INTERRUPTED.name()); + return TransactionSelectionResult.invalidPenalized(EXECUTION_INTERRUPTED.name()); } } return SELECTED; @@ -1190,13 +1190,13 @@ private void internalBlockSelectionTimeoutSimulationInvalidTxs( try { Thread.sleep(t); } catch (final InterruptedException e) { - return TransactionSelectionResult.invalidTransient(EXECUTION_INTERRUPTED.name()); + return TransactionSelectionResult.invalidPenalized(EXECUTION_INTERRUPTED.name()); } } else { try { Thread.sleep(fastProcessingTxTime); } catch (final InterruptedException e) { - return TransactionSelectionResult.invalidTransient(EXECUTION_INTERRUPTED.name()); + return TransactionSelectionResult.invalidPenalized(EXECUTION_INTERRUPTED.name()); } } return invalidSelectionResult; diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java index 4c87b374a84..7f41a206732 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java @@ -537,7 +537,7 @@ public void temporarilyInvalidTransactionIsKeptInPendingTransactions() { pendingTransactions.selectTransactions( pendingTx -> { parsedTransactions.add(pendingTx); - return TransactionSelectionResult.invalidTransient( + return TransactionSelectionResult.invalidPenalized( GAS_PRICE_BELOW_CURRENT_BASE_FEE.name()); }); diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index 7d141da905f..097e0c2da42 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -71,7 +71,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'CrhgK6qq7Ym5AARLCQ0lQvZQpsejUgoFcnL1rU+ZGBs=' + knownHash = 'FEieWer0x6AdCmvf02G7yGQxS5JRxsIYrRDpqsNgQ+0=' } check.dependsOn('checkAPIChanges') diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java index b2fb5ab0c77..3bf162c9981 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java @@ -66,7 +66,8 @@ private enum BaseStatus implements Status { BLOCK_SELECTION_TIMEOUT_INVALID_TX(true, true, true), TX_EVALUATION_TOO_LONG(true, false, true), INVALID_TX_EVALUATION_TOO_LONG(true, true, true), - INVALID_TRANSIENT(false, false, true), + INVALID_TRANSIENT(false, false, false), + INVALID_PENALIZED(false, false, true), INVALID(false, true, false); private final boolean stop; @@ -160,21 +161,21 @@ public boolean penalize() { * price, but the selection should continue. */ public static final TransactionSelectionResult CURRENT_TX_PRICE_BELOW_MIN = - TransactionSelectionResult.invalidTransient("CURRENT_TX_PRICE_BELOW_MIN"); + TransactionSelectionResult.invalidPenalized("CURRENT_TX_PRICE_BELOW_MIN"); /** * The transaction has not been selected since its blob price is below the current network blob * price, but the selection should continue. */ public static final TransactionSelectionResult BLOB_PRICE_BELOW_CURRENT_MIN = - TransactionSelectionResult.invalidTransient("BLOB_PRICE_BELOW_CURRENT_MIN"); + TransactionSelectionResult.invalidPenalized("BLOB_PRICE_BELOW_CURRENT_MIN"); /** * The transaction has not been selected since its priority fee is below the configured min * priority fee per gas, but the selection should continue. */ public static final TransactionSelectionResult PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN = - TransactionSelectionResult.invalidTransient("PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN"); + TransactionSelectionResult.invalidPenalized("PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN"); /** * The transaction has not been selected since its sender already had a previous transaction not @@ -217,6 +218,18 @@ public static TransactionSelectionResult invalidTransient(final String invalidRe return new TransactionSelectionResult(BaseStatus.INVALID_TRANSIENT, invalidReason); } + /** + * Return a selection result that identify the candidate transaction as temporarily invalid and + * that it should be penalized, this means that the transaction could become valid at a later + * time. + * + * @param invalidReason the reason why transaction is invalid + * @return the selection result + */ + public static TransactionSelectionResult invalidPenalized(final String invalidReason) { + return new TransactionSelectionResult(BaseStatus.INVALID_PENALIZED, invalidReason); + } + /** * Return a selection result that identify the candidate transaction as permanently invalid, this * means that it could be removed safely from the transaction pool. From b74a7f2133147aa9b82d58e4eaad596a465755ba Mon Sep 17 00:00:00 2001 From: phillip Yun Date: Tue, 4 Feb 2025 19:19:45 +0900 Subject: [PATCH 5/8] add Xchain-pruning-blocks-retained must be >= epochlength (#7963) (#8140) Signed-off-by: philosup --- .../org/hyperledger/besu/cli/BesuCommand.java | 38 ++++++-- .../hyperledger/besu/cli/BesuCommandTest.java | 87 +++++++++++++++++++ 2 files changed, 118 insertions(+), 7 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 8a39f9bfc1d..b628e420cf1 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -1587,13 +1587,37 @@ private void validateRpcWsOptions() { } private void validateChainDataPruningParams() { - if (unstableChainPruningOptions.getChainDataPruningEnabled() - && unstableChainPruningOptions.getChainDataPruningBlocksRetained() - < unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()) { - throw new ParameterException( - this.commandLine, - "--Xchain-pruning-blocks-retained must be >= " - + unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()); + Long chainDataPruningBlocksRetained = + unstableChainPruningOptions.getChainDataPruningBlocksRetained(); + if (unstableChainPruningOptions.getChainDataPruningEnabled()) { + final GenesisConfigOptions genesisConfigOptions = readGenesisConfigOptions(); + if (chainDataPruningBlocksRetained + < unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()) { + throw new ParameterException( + this.commandLine, + "--Xchain-pruning-blocks-retained must be >= " + + unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()); + } else if (genesisConfigOptions.isPoa()) { + Long epochLength = 0L; + String consensusMechanism = ""; + if (genesisConfigOptions.isIbft2()) { + epochLength = genesisConfigOptions.getBftConfigOptions().getEpochLength(); + consensusMechanism = "IBFT2"; + } else if (genesisConfigOptions.isQbft()) { + epochLength = genesisConfigOptions.getQbftConfigOptions().getEpochLength(); + consensusMechanism = "QBFT"; + } else if (genesisConfigOptions.isClique()) { + epochLength = genesisConfigOptions.getCliqueConfigOptions().getEpochLength(); + consensusMechanism = "Clique"; + } + if (chainDataPruningBlocksRetained < epochLength) { + throw new ParameterException( + this.commandLine, + String.format( + "--Xchain-pruning-blocks-retained(%d) must be >= epochlength(%d) for %s", + chainDataPruningBlocksRetained, epochLength, consensusMechanism)); + } + } } } diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index 515ad59e3dc..733efd9162c 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -2598,4 +2598,91 @@ void helpOutputShouldDisplayCorrectDefaultValues() { assertThat(errorOutputString).isEmpty(); } + + @Test + void chainPruningEnabledWithPOAShouldFailWhenChainPruningBlocksRetainedValueLessThanEpochLength() + throws IOException { + JsonObject genesis = GENESIS_VALID_JSON; + + // for QBFT + genesis.getJsonObject("config").put("qbft", new JsonObject().put("epochlength", 25000)); + final Path genesisFileQBFT = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileQBFT.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=7200", + "--version-compatibility-protection=false"); + assertThat(commandErrorOutput.toString(UTF_8)) + .contains("--Xchain-pruning-blocks-retained(7200) must be >= epochlength(25000) for QBFT"); + commandErrorOutput.reset(); + + // for IBFT2 + genesis.getJsonObject("config").put("ibft2", new JsonObject().put("epochlength", 20000)); + genesis.getJsonObject("config").remove("qbft"); + final Path genesisFileIBFT = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileIBFT.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=7200", + "--version-compatibility-protection=false"); + assertThat(commandErrorOutput.toString(UTF_8)) + .contains("--Xchain-pruning-blocks-retained(7200) must be >= epochlength(20000) for IBFT2"); + commandErrorOutput.reset(); + + // for Clique + genesis.getJsonObject("config").put("clique", new JsonObject().put("epochlength", 10000)); + genesis.getJsonObject("config").remove("ibft2"); + final Path genesisFileClique = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileClique.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=7200", + "--version-compatibility-protection=false"); + assertThat(commandErrorOutput.toString(UTF_8)) + .contains( + "--Xchain-pruning-blocks-retained(7200) must be >= epochlength(10000) for Clique"); + } + + @Test + void chainPruningEnabledWithPOA() throws IOException { + JsonObject genesis = GENESIS_VALID_JSON; + // for QBFT + genesis.getJsonObject("config").put("qbft", new JsonObject().put("epochlength", 25000)); + final Path genesisFileForQBFT = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileForQBFT.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=25000", + "--version-compatibility-protection=false"); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + + // for IBFT2 + genesis.getJsonObject("config").put("ibft2", new JsonObject().put("epochlength", 20000)); + genesis.getJsonObject("config").remove("qbft"); + final Path genesisFileIBFT = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileIBFT.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=20000", + "--version-compatibility-protection=false"); + + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + + // for Clique + genesis.getJsonObject("config").put("clique", new JsonObject().put("epochlength", 10000)); + genesis.getJsonObject("config").remove("ibft2"); + final Path genesisFileClique = createFakeGenesisFile(genesis); + parseCommand( + "--genesis-file", + genesisFileClique.toString(), + "--Xchain-pruning-enabled=true", + "--Xchain-pruning-blocks-retained=10000", + "--version-compatibility-protection=false"); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + } } From 214673c026091545f35b2fffc1ed00e94687222e Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Tue, 4 Feb 2025 14:18:40 +0100 Subject: [PATCH 6/8] Add transaction hash for debug trace responses (#8205) Signed-off-by: Karim Taam --- .../DebugTraceTransactionIntegrationTest.java | 22 +- .../internal/methods/DebugTraceCall.java | 4 +- .../methods/DebugTraceTransaction.java | 8 +- .../results/DebugTraceTransactionDetails.java | 77 +++ .../results/DebugTraceTransactionResult.java | 52 +- .../DebugTraceJsonRpcHttpBySpecTest.java | 3 +- .../DebugTraceJsonRpcHttpBySpecTest.java | 3 +- .../methods/DebugTraceBlockByHashTest.java | 15 +- .../methods/DebugTraceBlockByNumberTest.java | 15 +- .../internal/methods/DebugTraceBlockTest.java | 15 +- .../methods/DebugTraceTransactionTest.java | 6 +- .../trace-block/debug_traceBlock_default.json | 456 ++++++++++++++ .../debug_traceBlock_disableMemory.json | 459 ++++++++++++++ .../debug_traceBlock_disableStack.json | 348 +++++++++++ .../debug_traceBlock_disableStorage.json | 392 ++++++++++++ .../debug/trace-call/debug_traceCall_all.json | 366 ++++++----- .../trace-call/debug_traceCall_default.json | 525 ++++++++++------ .../debug_traceCall_disableMemory.json | 525 ++++++++++------ .../debug_traceCall_disableStack.json | 424 +++++++------ .../debug_traceCall_disableStorage.json | 581 +++++++++++------- .../debug_traceCall_noGasPrice.json | 28 +- 21 files changed, 3273 insertions(+), 1051 deletions(-) create mode 100644 ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionDetails.java create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_default.json create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableMemory.json create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStack.json create mode 100644 ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStorage.json diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/DebugTraceTransactionIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/DebugTraceTransactionIntegrationTest.java index 5b488987169..d0ef9d77370 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/DebugTraceTransactionIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/DebugTraceTransactionIntegrationTest.java @@ -24,7 +24,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.plugin.services.rpc.RpcResponseType; import org.hyperledger.besu.testutil.BlockTestUtil; @@ -60,22 +60,20 @@ public void setUp() { @Test public void debugTraceTransactionSuccessTest() { final Map map = Map.of("disableStorage", true); - final Object[] params = - new Object[] { - Hash.fromHexString("0xcef53f2311d7c80e9086d661e69ac11a5f3d081e28e02a9ba9b66749407ac310"), - map - }; + final Hash trxHash = + Hash.fromHexString("0xcef53f2311d7c80e9086d661e69ac11a5f3d081e28e02a9ba9b66749407ac310"); + final Object[] params = new Object[] {trxHash, map}; final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", DEBUG_TRACE_TRANSACTION, params)); final JsonRpcResponse response = method.response(request); assertThat(response.getType()).isEqualTo(RpcResponseType.SUCCESS); - DebugTraceTransactionResult debugTraceTransactionResult = - (DebugTraceTransactionResult) ((JsonRpcSuccessResponse) response).getResult(); - assertThat(debugTraceTransactionResult.getGas()).isEqualTo(23705L); - assertThat(debugTraceTransactionResult.getReturnValue()).isEmpty(); - assertThat(debugTraceTransactionResult.failed()).isFalse(); - assertThat(debugTraceTransactionResult.getStructLogs()).hasSize(106); + DebugTraceTransactionDetails debugTraceTransactionDetails = + (DebugTraceTransactionDetails) ((JsonRpcSuccessResponse) response).getResult(); + assertThat(debugTraceTransactionDetails.getGas()).isEqualTo(23705L); + assertThat(debugTraceTransactionDetails.getReturnValue()).isEmpty(); + assertThat(debugTraceTransactionDetails.failed()).isFalse(); + assertThat(debugTraceTransactionDetails.getStructLogs()).hasSize(106); } @Test diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java index 4bfe4f18b47..2a9c6a724fa 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceCall.java @@ -26,7 +26,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.debug.TraceOptions; import org.hyperledger.besu.ethereum.mainnet.ImmutableTransactionValidationParams; @@ -104,7 +104,7 @@ protected PreCloseStateHandler getSimulatorResultHandler( new TransactionTrace( result.transaction(), result.result(), tracer.getTraceFrames()); - return new DebugTraceTransactionResult(transactionTrace); + return new DebugTraceTransactionDetails(transactionTrace); }); } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransaction.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransaction.java index 1e85e6530a4..6adc6c9bf7a 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransaction.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransaction.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata; import org.hyperledger.besu.ethereum.debug.TraceOptions; @@ -76,7 +76,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { RpcErrorType.INVALID_TRANSACTION_TRACE_PARAMS, e); } - final DebugTraceTransactionResult debugTraceTransactionResult = + final DebugTraceTransactionDetails debugTraceTransactionResult = debugTraceTransactionResult(hash, transactionWithMetadata.get(), traceOptions); return new JsonRpcSuccessResponse( @@ -86,7 +86,7 @@ public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { } } - private DebugTraceTransactionResult debugTraceTransactionResult( + private DebugTraceTransactionDetails debugTraceTransactionResult( final Hash hash, final TransactionWithMetadata transactionWithMetadata, final TraceOptions traceOptions) { @@ -100,7 +100,7 @@ private DebugTraceTransactionResult debugTraceTransactionResult( mutableWorldState -> transactionTracer .traceTransaction(mutableWorldState, blockHash, hash, execTracer) - .map(DebugTraceTransactionResult::new)) + .map(DebugTraceTransactionDetails::new)) .orElse(null); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionDetails.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionDetails.java new file mode 100644 index 00000000000..1c91c6c5050 --- /dev/null +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionDetails.java @@ -0,0 +1,77 @@ +/* + * Copyright contributors to Besu. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ +package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results; + +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; +import org.hyperledger.besu.ethereum.debug.TraceFrame; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonPropertyOrder({"gas", "failed", "returnValue", "structLogs"}) +public class DebugTraceTransactionDetails { + + private final List structLogs; + private final String returnValue; + private final long gas; + private final boolean failed; + + public DebugTraceTransactionDetails(final TransactionTrace transactionTrace) { + gas = transactionTrace.getGas(); + returnValue = transactionTrace.getResult().getOutput().toString().substring(2); + structLogs = new ArrayList<>(transactionTrace.getTraceFrames().size()); + transactionTrace.getTraceFrames().parallelStream() + .map(DebugTraceTransactionDetails::createStructLog) + .forEachOrdered(structLogs::add); + failed = !transactionTrace.getResult().isSuccessful(); + } + + public static Collection of( + final Collection traces) { + return traces.stream().map(DebugTraceTransactionResult::new).collect(Collectors.toList()); + } + + private static StructLog createStructLog(final TraceFrame frame) { + return frame + .getExceptionalHaltReason() + .map(__ -> (StructLog) new StructLogWithError(frame)) + .orElse(new StructLog(frame)); + } + + @JsonGetter(value = "structLogs") + public List getStructLogs() { + return structLogs; + } + + @JsonGetter(value = "returnValue") + public String getReturnValue() { + return returnValue; + } + + @JsonGetter(value = "gas") + public long getGas() { + return gas; + } + + @JsonGetter(value = "failed") + public boolean failed() { + return failed; + } +} diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionResult.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionResult.java index acec389ab21..4932ccd80d6 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionResult.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/DebugTraceTransactionResult.java @@ -1,5 +1,5 @@ /* - * Copyright ConsenSys AG. + * Copyright contributors to Besu. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -15,32 +15,23 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTrace; -import org.hyperledger.besu.ethereum.debug.TraceFrame; -import java.util.ArrayList; import java.util.Collection; -import java.util.List; import java.util.stream.Collectors; import com.fasterxml.jackson.annotation.JsonGetter; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -@JsonPropertyOrder({"gas", "failed", "returnValue", "structLogs"}) +@JsonPropertyOrder({"txHash", "result"}) public class DebugTraceTransactionResult { - private final List structLogs; - private final String returnValue; - private final long gas; - private final boolean failed; + private final String txHash; + + private final DebugTraceTransactionDetails result; public DebugTraceTransactionResult(final TransactionTrace transactionTrace) { - gas = transactionTrace.getGas(); - returnValue = transactionTrace.getResult().getOutput().toString().substring(2); - structLogs = new ArrayList<>(transactionTrace.getTraceFrames().size()); - transactionTrace.getTraceFrames().parallelStream() - .map(DebugTraceTransactionResult::createStructLog) - .forEachOrdered(structLogs::add); - failed = !transactionTrace.getResult().isSuccessful(); + this.txHash = transactionTrace.getTransaction().getHash().toHexString(); + this.result = new DebugTraceTransactionDetails(transactionTrace); } public static Collection of( @@ -48,30 +39,13 @@ public static Collection of( return traces.stream().map(DebugTraceTransactionResult::new).collect(Collectors.toList()); } - private static StructLog createStructLog(final TraceFrame frame) { - return frame - .getExceptionalHaltReason() - .map(__ -> (StructLog) new StructLogWithError(frame)) - .orElse(new StructLog(frame)); - } - - @JsonGetter(value = "structLogs") - public List getStructLogs() { - return structLogs; - } - - @JsonGetter(value = "returnValue") - public String getReturnValue() { - return returnValue; - } - - @JsonGetter(value = "gas") - public long getGas() { - return gas; + @JsonGetter(value = "txHash") + public String getTxHash() { + return txHash; } - @JsonGetter(value = "failed") - public boolean failed() { - return failed; + @JsonGetter(value = "result") + public DebugTraceTransactionDetails getResult() { + return result; } } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/DebugTraceJsonRpcHttpBySpecTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/DebugTraceJsonRpcHttpBySpecTest.java index fbe3f32196a..3d066d14e9e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/DebugTraceJsonRpcHttpBySpecTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/bonsai/DebugTraceJsonRpcHttpBySpecTest.java @@ -39,7 +39,8 @@ protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat sto } public static Object[][] specs() { - return AbstractJsonRpcHttpBySpecTest.findSpecFiles(new String[] {"debug/trace-call"}); + return AbstractJsonRpcHttpBySpecTest.findSpecFiles( + new String[] {"debug/trace-call", "debug/trace-block"}); } @Test diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/DebugTraceJsonRpcHttpBySpecTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/DebugTraceJsonRpcHttpBySpecTest.java index cdedc3438b6..d90873fbd2f 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/DebugTraceJsonRpcHttpBySpecTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/forest/DebugTraceJsonRpcHttpBySpecTest.java @@ -39,7 +39,8 @@ protected BlockchainSetupUtil getBlockchainSetupUtil(final DataStorageFormat sto } public static Object[][] specs() { - return AbstractJsonRpcHttpBySpecTest.findSpecFiles(new String[] {"debug/trace-call"}); + return AbstractJsonRpcHttpBySpecTest.findSpecFiles( + new String[] {"debug/trace-call", "debug/trace-block"}); } @Test diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java index 04aae980d14..b4cecb16713 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByHashTest.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.Tracer; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.Block; @@ -90,10 +90,10 @@ public void shouldReturnCorrectResponse() { when(blockchainQueries.getBlockchain()).thenReturn(blockchain); when(blockchain.getBlockByHash(block.getHash())).thenReturn(Optional.of(block)); - DebugTraceTransactionResult result1 = mock(DebugTraceTransactionResult.class); - DebugTraceTransactionResult result2 = mock(DebugTraceTransactionResult.class); + DebugTraceTransactionDetails result1 = mock(DebugTraceTransactionDetails.class); + DebugTraceTransactionDetails result2 = mock(DebugTraceTransactionDetails.class); - List resultList = Arrays.asList(result1, result2); + List resultList = Arrays.asList(result1, result2); try (MockedStatic mockedTracer = mockStatic(Tracer.class)) { mockedTracer @@ -109,7 +109,7 @@ public void shouldReturnCorrectResponse() { assertThat(jsonRpcResponse).isInstanceOf(JsonRpcSuccessResponse.class); JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) jsonRpcResponse; - final Collection traceResult = getResult(response); + final Collection traceResult = getResult(response); assertThat(traceResult).isNotEmpty(); assertThat(traceResult).isInstanceOf(Collection.class).hasSize(2); assertThat(traceResult).containsExactly(result1, result2); @@ -117,8 +117,9 @@ public void shouldReturnCorrectResponse() { } @SuppressWarnings("unchecked") - private Collection getResult(final JsonRpcSuccessResponse response) { - return (Collection) response.getResult(); + private Collection getResult( + final JsonRpcSuccessResponse response) { + return (Collection) response.getResult(); } @Test diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java index 3f2e39b5423..1a92c1fe6ac 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockByNumberTest.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.Tracer; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.Block; @@ -88,10 +88,10 @@ public void shouldReturnCorrectResponse() { when(blockchain.getBlockByNumber(blockNumber)).thenReturn(Optional.of(block)); when(block.getHeader()).thenReturn(blockHeader); - DebugTraceTransactionResult result1 = mock(DebugTraceTransactionResult.class); - DebugTraceTransactionResult result2 = mock(DebugTraceTransactionResult.class); + DebugTraceTransactionDetails result1 = mock(DebugTraceTransactionDetails.class); + DebugTraceTransactionDetails result2 = mock(DebugTraceTransactionDetails.class); - List resultList = Arrays.asList(result1, result2); + List resultList = Arrays.asList(result1, result2); try (MockedStatic mockedTracer = mockStatic(Tracer.class)) { mockedTracer @@ -105,7 +105,7 @@ public void shouldReturnCorrectResponse() { assertThat(jsonRpcResponse).isInstanceOf(JsonRpcSuccessResponse.class); JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) jsonRpcResponse; - final Collection traceResult = getResult(response); + final Collection traceResult = getResult(response); assertThat(traceResult).isNotEmpty(); assertThat(traceResult).isInstanceOf(Collection.class).hasSize(2); assertThat(traceResult).containsExactly(result1, result2); @@ -113,8 +113,9 @@ public void shouldReturnCorrectResponse() { } @SuppressWarnings("unchecked") - private Collection getResult(final JsonRpcSuccessResponse response) { - return (Collection) response.getResult(); + private Collection getResult( + final JsonRpcSuccessResponse response) { + return (Collection) response.getResult(); } @Test diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java index a8499d5ebed..a7c5bd877d1 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceBlockTest.java @@ -29,7 +29,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.Blockchain; @@ -144,10 +144,10 @@ public void shouldReturnCorrectResponse() { when(blockchain.getBlockByHash(block.getHeader().getParentHash())) .thenReturn(Optional.of(parentBlock)); - DebugTraceTransactionResult result1 = mock(DebugTraceTransactionResult.class); - DebugTraceTransactionResult result2 = mock(DebugTraceTransactionResult.class); + DebugTraceTransactionDetails result1 = mock(DebugTraceTransactionDetails.class); + DebugTraceTransactionDetails result2 = mock(DebugTraceTransactionDetails.class); - List resultList = Arrays.asList(result1, result2); + List resultList = Arrays.asList(result1, result2); try (MockedStatic mockedTracer = mockStatic(Tracer.class)) { mockedTracer @@ -163,7 +163,7 @@ public void shouldReturnCorrectResponse() { assertThat(jsonRpcResponse).isInstanceOf(JsonRpcSuccessResponse.class); JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) jsonRpcResponse; - final Collection traceResult = getResult(response); + final Collection traceResult = getResult(response); assertThat(traceResult).isNotEmpty(); assertThat(traceResult).isInstanceOf(Collection.class).hasSize(2); assertThat(traceResult).containsExactly(result1, result2); @@ -171,8 +171,9 @@ public void shouldReturnCorrectResponse() { } @SuppressWarnings("unchecked") - private Collection getResult(final JsonRpcSuccessResponse response) { - return (Collection) response.getResult(); + private Collection getResult( + final JsonRpcSuccessResponse response) { + return (Collection) response.getResult(); } @Test diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java index 107abf5b2d4..87a3de8d25f 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugTraceTransactionTest.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTracer; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionResult; +import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.DebugTraceTransactionDetails; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.StructLog; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata; @@ -155,8 +155,8 @@ public void shouldTraceTheTransactionUsingTheTransactionTracer() { .thenReturn(Optional.of(transactionTrace)); final JsonRpcSuccessResponse response = (JsonRpcSuccessResponse) debugTraceTransaction.response(request); - final DebugTraceTransactionResult transactionResult = - (DebugTraceTransactionResult) response.getResult(); + final DebugTraceTransactionDetails transactionResult = + (DebugTraceTransactionDetails) response.getResult(); assertThat(transactionResult.getGas()).isEqualTo(73); assertThat(transactionResult.getReturnValue()).isEqualTo("1234"); diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_default.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_default.json new file mode 100644 index 00000000000..dfaa0333b2c --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_default.json @@ -0,0 +1,456 @@ +{ + "request": { + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "0x04" + ] + }, + "response": { + "jsonrpc":"2.0", + "id":1, + "result":[ + { + "txHash":"0x4de634fe767d1f6d0512ca0c9c0a054d3a2596f7cdd7c1eea5f93046a740b3c7", + "result":{ + "gas":61584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":20000, + "depth":1, + "stack":[ + "0x1", + "0x1" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16735630, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"1" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16735627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16735624, + "gasCost":3, + "depth":1, + "stack":[ + "0x2" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16735621, + "gasCost":3, + "depth":1, + "stack":[ + "0x2", + "0x40" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16735618, + "gasCost":20000, + "depth":1, + "stack":[ + "0x2", + "0x2" + ], + "storage":{ + "1":"1", + "2":"2" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16715618, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"1", + "2":"2" + } + } + ] + } + }, + { + "txHash":"0xf882ec206292910527fd7095e59a1ca027b873296f1eba3886aa1addc4ff0ab9", + "result":{ + "gas":31584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":5000, + "depth":1, + "stack":[ + "0x3", + "0x1" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16750630, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16750627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16750624, + "gasCost":3, + "depth":1, + "stack":[ + "0x4" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16750621, + "gasCost":3, + "depth":1, + "stack":[ + "0x4", + "0x40" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16750618, + "gasCost":5000, + "depth":1, + "stack":[ + "0x4", + "0x2" + ], + "storage":{ + "1":"3", + "2":"4" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16745618, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3", + "2":"4" + } + } + ] + } + }, + { + "txHash":"0x7ca6bf869e8882216f7443accb8d642df41af5bfa3a0e63bf03be2cfe629a030", + "result":{ + "gas":13686, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755654, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755651, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755648, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755645, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755642, + "gasCost":800, + "depth":1, + "stack":[ + "0x3", + "0x1" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16754842, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16754839, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16754836, + "gasCost":3, + "depth":1, + "stack":[ + "0x0" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16754833, + "gasCost":3, + "depth":1, + "stack":[ + "0x0", + "0x40" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16754830, + "gasCost":5000, + "depth":1, + "stack":[ + "0x0", + "0x1" + ], + "storage":{ + "1":"0" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16749830, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"0" + } + } + ] + } + } + ] + }, + "statusCode": 200 +} \ No newline at end of file diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableMemory.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableMemory.json new file mode 100644 index 00000000000..bb907bf8d35 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableMemory.json @@ -0,0 +1,459 @@ +{ + "request": { + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "0x04", + { + "disableMemory":true + } + ] + }, + "response":{ + "jsonrpc":"2.0", + "id":1, + "result":[ + { + "txHash":"0x4de634fe767d1f6d0512ca0c9c0a054d3a2596f7cdd7c1eea5f93046a740b3c7", + "result":{ + "gas":61584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":20000, + "depth":1, + "stack":[ + "0x1", + "0x1" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16735630, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"1" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16735627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16735624, + "gasCost":3, + "depth":1, + "stack":[ + "0x2" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16735621, + "gasCost":3, + "depth":1, + "stack":[ + "0x2", + "0x40" + ], + "storage":{ + "1":"1" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16735618, + "gasCost":20000, + "depth":1, + "stack":[ + "0x2", + "0x2" + ], + "storage":{ + "1":"1", + "2":"2" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16715618, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"1", + "2":"2" + } + } + ] + } + }, + { + "txHash":"0xf882ec206292910527fd7095e59a1ca027b873296f1eba3886aa1addc4ff0ab9", + "result":{ + "gas":31584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":5000, + "depth":1, + "stack":[ + "0x3", + "0x1" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16750630, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16750627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16750624, + "gasCost":3, + "depth":1, + "stack":[ + "0x4" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16750621, + "gasCost":3, + "depth":1, + "stack":[ + "0x4", + "0x40" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16750618, + "gasCost":5000, + "depth":1, + "stack":[ + "0x4", + "0x2" + ], + "storage":{ + "1":"3", + "2":"4" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16745618, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3", + "2":"4" + } + } + ] + } + }, + { + "txHash":"0x7ca6bf869e8882216f7443accb8d642df41af5bfa3a0e63bf03be2cfe629a030", + "result":{ + "gas":13686, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755654, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755651, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755648, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755645, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755642, + "gasCost":800, + "depth":1, + "stack":[ + "0x3", + "0x1" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16754842, + "gasCost":3, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16754839, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16754836, + "gasCost":3, + "depth":1, + "stack":[ + "0x0" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16754833, + "gasCost":3, + "depth":1, + "stack":[ + "0x0", + "0x40" + ], + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16754830, + "gasCost":5000, + "depth":1, + "stack":[ + "0x0", + "0x1" + ], + "storage":{ + "1":"0" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16749830, + "gasCost":0, + "depth":1, + "stack":[ + + ], + "storage":{ + "1":"0" + } + } + ] + } + } + ] + }, + "statusCode": 200 +} \ No newline at end of file diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStack.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStack.json new file mode 100644 index 00000000000..e2b1a41f206 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStack.json @@ -0,0 +1,348 @@ +{ + "request": { + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "0x04", + { + "disableStack": true + } + ] + }, + "response": { + "jsonrpc":"2.0", + "id":1, + "result":[ + { + "txHash":"0x4de634fe767d1f6d0512ca0c9c0a054d3a2596f7cdd7c1eea5f93046a740b3c7", + "result":{ + "gas":61584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1 + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1 + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1 + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1 + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":20000, + "depth":1, + "storage":{ + "1":"1" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16735630, + "gasCost":3, + "depth":1, + "storage":{ + "1":"1" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16735627, + "gasCost":3, + "depth":1, + "storage":{ + "1":"1" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16735624, + "gasCost":3, + "depth":1, + "storage":{ + "1":"1" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16735621, + "gasCost":3, + "depth":1, + "storage":{ + "1":"1" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16735618, + "gasCost":20000, + "depth":1, + "storage":{ + "1":"1", + "2":"2" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16715618, + "gasCost":0, + "depth":1, + "storage":{ + "1":"1", + "2":"2" + } + } + ] + } + }, + { + "txHash":"0xf882ec206292910527fd7095e59a1ca027b873296f1eba3886aa1addc4ff0ab9", + "result":{ + "gas":31584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1 + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1 + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1 + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1 + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":5000, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16750630, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16750627, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16750624, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16750621, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16750618, + "gasCost":5000, + "depth":1, + "storage":{ + "1":"3", + "2":"4" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16745618, + "gasCost":0, + "depth":1, + "storage":{ + "1":"3", + "2":"4" + } + } + ] + } + }, + { + "txHash":"0x7ca6bf869e8882216f7443accb8d642df41af5bfa3a0e63bf03be2cfe629a030", + "result":{ + "gas":13686, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755654, + "gasCost":3, + "depth":1 + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755651, + "gasCost":3, + "depth":1 + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755648, + "gasCost":3, + "depth":1 + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755645, + "gasCost":3, + "depth":1 + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755642, + "gasCost":800, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":7, + "op":"PUSH1", + "gas":16754842, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16754839, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":10, + "op":"PUSH1", + "gas":16754836, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16754833, + "gasCost":3, + "depth":1, + "storage":{ + "1":"3" + } + }, + { + "pc":13, + "op":"SSTORE", + "gas":16754830, + "gasCost":5000, + "depth":1, + "storage":{ + "1":"0" + } + }, + { + "pc":14, + "op":"STOP", + "gas":16749830, + "gasCost":0, + "depth":1, + "storage":{ + "1":"0" + } + } + ] + } + } + ] + }, + "statusCode": 200 +} \ No newline at end of file diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStorage.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStorage.json new file mode 100644 index 00000000000..1c0e1b717a2 --- /dev/null +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-block/debug_traceBlock_disableStorage.json @@ -0,0 +1,392 @@ +{ + "request": { + "id": 1, + "jsonrpc": "2.0", + "method": "debug_traceBlockByNumber", + "params": [ + "0x04", + { + "disableStorage": true + } + ] + }, + "response": { + "jsonrpc":"2.0", + "id":1, + "result":[ + { + "txHash":"0x4de634fe767d1f6d0512ca0c9c0a054d3a2596f7cdd7c1eea5f93046a740b3c7", + "result":{ + "gas":61584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":20000, + "depth":1, + "stack":[ + "0x1", + "0x1" + ] + }, + { + "pc":7, + "op":"PUSH1", + "gas":16735630, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16735627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ] + }, + { + "pc":10, + "op":"PUSH1", + "gas":16735624, + "gasCost":3, + "depth":1, + "stack":[ + "0x2" + ] + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16735621, + "gasCost":3, + "depth":1, + "stack":[ + "0x2", + "0x40" + ] + }, + { + "pc":13, + "op":"SSTORE", + "gas":16735618, + "gasCost":20000, + "depth":1, + "stack":[ + "0x2", + "0x2" + ] + }, + { + "pc":14, + "op":"STOP", + "gas":16715618, + "gasCost":0, + "depth":1, + "stack":[ + + ] + } + ] + } + }, + { + "txHash":"0xf882ec206292910527fd7095e59a1ca027b873296f1eba3886aa1addc4ff0ab9", + "result":{ + "gas":31584, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755642, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755639, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755636, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755633, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755630, + "gasCost":5000, + "depth":1, + "stack":[ + "0x3", + "0x1" + ] + }, + { + "pc":7, + "op":"PUSH1", + "gas":16750630, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16750627, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ] + }, + { + "pc":10, + "op":"PUSH1", + "gas":16750624, + "gasCost":3, + "depth":1, + "stack":[ + "0x4" + ] + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16750621, + "gasCost":3, + "depth":1, + "stack":[ + "0x4", + "0x40" + ] + }, + { + "pc":13, + "op":"SSTORE", + "gas":16750618, + "gasCost":5000, + "depth":1, + "stack":[ + "0x4", + "0x2" + ] + }, + { + "pc":14, + "op":"STOP", + "gas":16745618, + "gasCost":0, + "depth":1, + "stack":[ + + ] + } + ] + } + }, + { + "txHash":"0x7ca6bf869e8882216f7443accb8d642df41af5bfa3a0e63bf03be2cfe629a030", + "result":{ + "gas":13686, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755654, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16755651, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16755648, + "gasCost":3, + "depth":1, + "stack":[ + "0x3" + ] + }, + { + "pc":5, + "op":"CALLDATALOAD", + "gas":16755645, + "gasCost":3, + "depth":1, + "stack":[ + "0x3", + "0x0" + ] + }, + { + "pc":6, + "op":"SSTORE", + "gas":16755642, + "gasCost":800, + "depth":1, + "stack":[ + "0x3", + "0x1" + ] + }, + { + "pc":7, + "op":"PUSH1", + "gas":16754842, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":9, + "op":"CALLDATALOAD", + "gas":16754839, + "gasCost":3, + "depth":1, + "stack":[ + "0x60" + ] + }, + { + "pc":10, + "op":"PUSH1", + "gas":16754836, + "gasCost":3, + "depth":1, + "stack":[ + "0x0" + ] + }, + { + "pc":12, + "op":"CALLDATALOAD", + "gas":16754833, + "gasCost":3, + "depth":1, + "stack":[ + "0x0", + "0x40" + ] + }, + { + "pc":13, + "op":"SSTORE", + "gas":16754830, + "gasCost":5000, + "depth":1, + "stack":[ + "0x0", + "0x1" + ] + }, + { + "pc":14, + "op":"STOP", + "gas":16749830, + "gasCost":0, + "depth":1, + "stack":[ + + ] + } + ] + } + } + ] + }, + "statusCode": 200 +} \ No newline at end of file diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_all.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_all.json index 3f6849d4533..7b58cd2cfc4 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_all.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_all.json @@ -17,175 +17,203 @@ "id" : 1 }, "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 22070, - "failed" : false, - "returnValue" : "f000000000000000000000000000000000000000000000000000000000000002", - "structLogs" : [ { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16755910, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 2, - "op" : "PUSH1", - "gas" : 16755907, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 4, - "op" : "PUSH1", - "gas" : 16755904, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 6, - "op" : "CALLDATASIZE", - "gas" : 16755901, - "gasCost" : 2, - "depth" : 1 - }, { - "pc" : 7, - "op" : "SUB", - "gas" : 16755899, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 8, - "op" : "DUP1", - "gas" : 16755896, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16755893, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16755890, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 13, - "op" : "CALLDATACOPY", - "gas" : 16755887, - "gasCost" : 9, - "depth" : 1 - }, { - "pc" : 14, - "op" : "PUSH1", - "gas" : 16755878, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 16, - "op" : "CALLVALUE", - "gas" : 16755875, - "gasCost" : 2, - "depth" : 1 - }, { - "pc" : 17, - "op" : "PUSH1", - "gas" : 16755873, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 19, - "op" : "CALLDATALOAD", - "gas" : 16755870, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 20, - "op" : "GAS", - "gas" : 16755867, - "gasCost" : 2, - "depth" : 1 - }, { - "pc" : 21, - "op" : "CALLCODE", - "gas" : 16755865, - "gasCost" : 16494066, - "depth" : 1 - }, { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16493366, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 2, - "op" : "CALLDATALOAD", - "gas" : 16493363, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 3, - "op" : "PUSH1", - "gas" : 16493360, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 5, - "op" : "ADD", - "gas" : 16493357, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 6, - "op" : "PUSH1", - "gas" : 16493354, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 8, - "op" : "MSTORE", - "gas" : 16493351, - "gasCost" : 6, - "depth" : 2 - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16493345, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16493342, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 13, - "op" : "RETURN", - "gas" : 16493339, - "gasCost" : 0, - "depth" : 2 - }, { - "pc" : 22, - "op" : "PUSH1", - "gas" : 16755138, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 24, - "op" : "PUSH1", - "gas" : 16755135, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 26, - "op" : "RETURN", - "gas" : 16755132, - "gasCost" : 0, - "depth" : 1 - } ] + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":22070, + "failed":false, + "returnValue":"f000000000000000000000000000000000000000000000000000000000000002", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755910, + "gasCost":3, + "depth":1 + }, + { + "pc":2, + "op":"PUSH1", + "gas":16755907, + "gasCost":3, + "depth":1 + }, + { + "pc":4, + "op":"PUSH1", + "gas":16755904, + "gasCost":3, + "depth":1 + }, + { + "pc":6, + "op":"CALLDATASIZE", + "gas":16755901, + "gasCost":2, + "depth":1 + }, + { + "pc":7, + "op":"SUB", + "gas":16755899, + "gasCost":3, + "depth":1 + }, + { + "pc":8, + "op":"DUP1", + "gas":16755896, + "gasCost":3, + "depth":1 + }, + { + "pc":9, + "op":"PUSH1", + "gas":16755893, + "gasCost":3, + "depth":1 + }, + { + "pc":11, + "op":"PUSH1", + "gas":16755890, + "gasCost":3, + "depth":1 + }, + { + "pc":13, + "op":"CALLDATACOPY", + "gas":16755887, + "gasCost":9, + "depth":1 + }, + { + "pc":14, + "op":"PUSH1", + "gas":16755878, + "gasCost":3, + "depth":1 + }, + { + "pc":16, + "op":"CALLVALUE", + "gas":16755875, + "gasCost":2, + "depth":1 + }, + { + "pc":17, + "op":"PUSH1", + "gas":16755873, + "gasCost":3, + "depth":1 + }, + { + "pc":19, + "op":"CALLDATALOAD", + "gas":16755870, + "gasCost":3, + "depth":1 + }, + { + "pc":20, + "op":"GAS", + "gas":16755867, + "gasCost":2, + "depth":1 + }, + { + "pc":21, + "op":"CALLCODE", + "gas":16755865, + "gasCost":16494066, + "depth":1 + }, + { + "pc":0, + "op":"PUSH1", + "gas":16493366, + "gasCost":3, + "depth":2 + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16493363, + "gasCost":3, + "depth":2 + }, + { + "pc":3, + "op":"PUSH1", + "gas":16493360, + "gasCost":3, + "depth":2 + }, + { + "pc":5, + "op":"ADD", + "gas":16493357, + "gasCost":3, + "depth":2 + }, + { + "pc":6, + "op":"PUSH1", + "gas":16493354, + "gasCost":3, + "depth":2 + }, + { + "pc":8, + "op":"MSTORE", + "gas":16493351, + "gasCost":6, + "depth":2 + }, + { + "pc":9, + "op":"PUSH1", + "gas":16493345, + "gasCost":3, + "depth":2 + }, + { + "pc":11, + "op":"PUSH1", + "gas":16493342, + "gasCost":3, + "depth":2 + }, + { + "pc":13, + "op":"RETURN", + "gas":16493339, + "gasCost":0, + "depth":2 + }, + { + "pc":22, + "op":"PUSH1", + "gas":16755138, + "gasCost":3, + "depth":1 + }, + { + "pc":24, + "op":"PUSH1", + "gas":16755135, + "gasCost":3, + "depth":1 + }, + { + "pc":26, + "op":"RETURN", + "gas":16755132, + "gasCost":0, + "depth":1 + } + ] } }, "statusCode": 200 diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_default.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_default.json index da6d2b78009..05743484d10 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_default.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_default.json @@ -14,202 +14,335 @@ "id" : 1 }, "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 22070, - "failed" : false, - "returnValue" : "f000000000000000000000000000000000000000000000000000000000000002", - "structLogs" : [ { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16755910, - "gasCost" : 3, - "depth" : 1, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "PUSH1", - "gas" : 16755907, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20" ] - }, { - "pc" : 4, - "op" : "PUSH1", - "gas" : 16755904, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0" ] - }, { - "pc" : 6, - "op" : "CALLDATASIZE", - "gas" : 16755901, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 7, - "op" : "SUB", - "gas" : 16755899, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x40" ] - }, { - "pc" : 8, - "op" : "DUP1", - "gas" : 16755896, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16755893, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20" ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16755890, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20" ] - }, { - "pc" : 13, - "op" : "CALLDATACOPY", - "gas" : 16755887, - "gasCost" : 9, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20", "0x0" ] - }, { - "pc" : 14, - "op" : "PUSH1", - "gas" : 16755878, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 16, - "op" : "CALLVALUE", - "gas" : 16755875, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0" ] - }, { - "pc" : 17, - "op" : "PUSH1", - "gas" : 16755873, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0" ] - }, { - "pc" : 19, - "op" : "CALLDATALOAD", - "gas" : 16755870, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x0" ] - }, { - "pc" : 20, - "op" : "GAS", - "gas" : 16755867, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000" ] - }, { - "pc" : 21, - "op" : "CALLCODE", - "gas" : 16755865, - "gasCost" : 16494066, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000", "0xffac99" ] - }, { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16493366, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "CALLDATALOAD", - "gas" : 16493363, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x0" ] - }, { - "pc" : 3, - "op" : "PUSH1", - "gas" : 16493360, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 5, - "op" : "ADD", - "gas" : 16493357, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001", "0x1" ] - }, { - "pc" : 6, - "op" : "PUSH1", - "gas" : 16493354, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 8, - "op" : "MSTORE", - "gas" : 16493351, - "gasCost" : 6, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002", "0x0" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16493345, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16493342, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x20" ] - }, { - "pc" : 13, - "op" : "RETURN", - "gas" : 16493339, - "gasCost" : 0, - "depth" : 2, - "stack" : [ "0x20", "0x0" ] - }, { - "pc" : 22, - "op" : "PUSH1", - "gas" : 16755138, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1" ] - }, { - "pc" : 24, - "op" : "PUSH1", - "gas" : 16755135, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1", "0x20" ] - }, { - "pc" : 26, - "op" : "RETURN", - "gas" : 16755132, - "gasCost" : 0, - "depth" : 1, - "stack" : [ "0x1", "0x20", "0x0" ] - } ] + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":22070, + "failed":false, + "returnValue":"f000000000000000000000000000000000000000000000000000000000000002", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755910, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"PUSH1", + "gas":16755907, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":4, + "op":"PUSH1", + "gas":16755904, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0" + ] + }, + { + "pc":6, + "op":"CALLDATASIZE", + "gas":16755901, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":7, + "op":"SUB", + "gas":16755899, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x40" + ] + }, + { + "pc":8, + "op":"DUP1", + "gas":16755896, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16755893, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20" + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16755890, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20" + ] + }, + { + "pc":13, + "op":"CALLDATACOPY", + "gas":16755887, + "gasCost":9, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20", + "0x0" + ] + }, + { + "pc":14, + "op":"PUSH1", + "gas":16755878, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":16, + "op":"CALLVALUE", + "gas":16755875, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0" + ] + }, + { + "pc":17, + "op":"PUSH1", + "gas":16755873, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0" + ] + }, + { + "pc":19, + "op":"CALLDATALOAD", + "gas":16755870, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x0" + ] + }, + { + "pc":20, + "op":"GAS", + "gas":16755867, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000" + ] + }, + { + "pc":21, + "op":"CALLCODE", + "gas":16755865, + "gasCost":16494066, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000", + "0xffac99" + ] + }, + { + "pc":0, + "op":"PUSH1", + "gas":16493366, + "gasCost":3, + "depth":2, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16493363, + "gasCost":3, + "depth":2, + "stack":[ + "0x0" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16493360, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":5, + "op":"ADD", + "gas":16493357, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001", + "0x1" + ] + }, + { + "pc":6, + "op":"PUSH1", + "gas":16493354, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":8, + "op":"MSTORE", + "gas":16493351, + "gasCost":6, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002", + "0x0" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16493345, + "gasCost":3, + "depth":2, + "stack":[ + + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16493342, + "gasCost":3, + "depth":2, + "stack":[ + "0x20" + ] + }, + { + "pc":13, + "op":"RETURN", + "gas":16493339, + "gasCost":0, + "depth":2, + "stack":[ + "0x20", + "0x0" + ] + }, + { + "pc":22, + "op":"PUSH1", + "gas":16755138, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ] + }, + { + "pc":24, + "op":"PUSH1", + "gas":16755135, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x20" + ] + }, + { + "pc":26, + "op":"RETURN", + "gas":16755132, + "gasCost":0, + "depth":1, + "stack":[ + "0x1", + "0x20", + "0x0" + ] + } + ] } }, "statusCode": 200 diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableMemory.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableMemory.json index af3d29f847d..1909943944c 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableMemory.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableMemory.json @@ -17,202 +17,335 @@ "id" : 1 }, "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 22070, - "failed" : false, - "returnValue" : "f000000000000000000000000000000000000000000000000000000000000002", - "structLogs" : [ { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16755910, - "gasCost" : 3, - "depth" : 1, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "PUSH1", - "gas" : 16755907, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20" ] - }, { - "pc" : 4, - "op" : "PUSH1", - "gas" : 16755904, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0" ] - }, { - "pc" : 6, - "op" : "CALLDATASIZE", - "gas" : 16755901, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 7, - "op" : "SUB", - "gas" : 16755899, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x40" ] - }, { - "pc" : 8, - "op" : "DUP1", - "gas" : 16755896, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16755893, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20" ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16755890, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20" ] - }, { - "pc" : 13, - "op" : "CALLDATACOPY", - "gas" : 16755887, - "gasCost" : 9, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20", "0x0" ] - }, { - "pc" : 14, - "op" : "PUSH1", - "gas" : 16755878, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 16, - "op" : "CALLVALUE", - "gas" : 16755875, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0" ] - }, { - "pc" : 17, - "op" : "PUSH1", - "gas" : 16755873, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0" ] - }, { - "pc" : 19, - "op" : "CALLDATALOAD", - "gas" : 16755870, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x0" ] - }, { - "pc" : 20, - "op" : "GAS", - "gas" : 16755867, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000" ] - }, { - "pc" : 21, - "op" : "CALLCODE", - "gas" : 16755865, - "gasCost" : 16494066, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000", "0xffac99" ] - }, { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16493366, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "CALLDATALOAD", - "gas" : 16493363, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x0" ] - }, { - "pc" : 3, - "op" : "PUSH1", - "gas" : 16493360, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 5, - "op" : "ADD", - "gas" : 16493357, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001", "0x1" ] - }, { - "pc" : 6, - "op" : "PUSH1", - "gas" : 16493354, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 8, - "op" : "MSTORE", - "gas" : 16493351, - "gasCost" : 6, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002", "0x0" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16493345, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16493342, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x20" ] - }, { - "pc" : 13, - "op" : "RETURN", - "gas" : 16493339, - "gasCost" : 0, - "depth" : 2, - "stack" : [ "0x20", "0x0" ] - }, { - "pc" : 22, - "op" : "PUSH1", - "gas" : 16755138, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1" ] - }, { - "pc" : 24, - "op" : "PUSH1", - "gas" : 16755135, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1", "0x20" ] - }, { - "pc" : 26, - "op" : "RETURN", - "gas" : 16755132, - "gasCost" : 0, - "depth" : 1, - "stack" : [ "0x1", "0x20", "0x0" ] - } ] + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":22070, + "failed":false, + "returnValue":"f000000000000000000000000000000000000000000000000000000000000002", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755910, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"PUSH1", + "gas":16755907, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":4, + "op":"PUSH1", + "gas":16755904, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0" + ] + }, + { + "pc":6, + "op":"CALLDATASIZE", + "gas":16755901, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":7, + "op":"SUB", + "gas":16755899, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x40" + ] + }, + { + "pc":8, + "op":"DUP1", + "gas":16755896, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16755893, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20" + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16755890, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20" + ] + }, + { + "pc":13, + "op":"CALLDATACOPY", + "gas":16755887, + "gasCost":9, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20", + "0x0" + ] + }, + { + "pc":14, + "op":"PUSH1", + "gas":16755878, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":16, + "op":"CALLVALUE", + "gas":16755875, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0" + ] + }, + { + "pc":17, + "op":"PUSH1", + "gas":16755873, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0" + ] + }, + { + "pc":19, + "op":"CALLDATALOAD", + "gas":16755870, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x0" + ] + }, + { + "pc":20, + "op":"GAS", + "gas":16755867, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000" + ] + }, + { + "pc":21, + "op":"CALLCODE", + "gas":16755865, + "gasCost":16494066, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000", + "0xffac99" + ] + }, + { + "pc":0, + "op":"PUSH1", + "gas":16493366, + "gasCost":3, + "depth":2, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16493363, + "gasCost":3, + "depth":2, + "stack":[ + "0x0" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16493360, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":5, + "op":"ADD", + "gas":16493357, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001", + "0x1" + ] + }, + { + "pc":6, + "op":"PUSH1", + "gas":16493354, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":8, + "op":"MSTORE", + "gas":16493351, + "gasCost":6, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002", + "0x0" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16493345, + "gasCost":3, + "depth":2, + "stack":[ + + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16493342, + "gasCost":3, + "depth":2, + "stack":[ + "0x20" + ] + }, + { + "pc":13, + "op":"RETURN", + "gas":16493339, + "gasCost":0, + "depth":2, + "stack":[ + "0x20", + "0x0" + ] + }, + { + "pc":22, + "op":"PUSH1", + "gas":16755138, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ] + }, + { + "pc":24, + "op":"PUSH1", + "gas":16755135, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x20" + ] + }, + { + "pc":26, + "op":"RETURN", + "gas":16755132, + "gasCost":0, + "depth":1, + "stack":[ + "0x1", + "0x20", + "0x0" + ] + } + ] } }, "statusCode": 200 diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStack.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStack.json index 43ad0da8ff2..f502da04ebe 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStack.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStack.json @@ -16,190 +16,246 @@ } ], "id" : 1 }, - "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 22070, - "failed" : false, - "returnValue" : "f000000000000000000000000000000000000000000000000000000000000002", - "structLogs" : [ { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16755910, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 2, - "op" : "PUSH1", - "gas" : 16755907, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 4, - "op" : "PUSH1", - "gas" : 16755904, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 6, - "op" : "CALLDATASIZE", - "gas" : 16755901, - "gasCost" : 2, - "depth" : 1 - }, { - "pc" : 7, - "op" : "SUB", - "gas" : 16755899, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 8, - "op" : "DUP1", - "gas" : 16755896, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16755893, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16755890, - "gasCost" : 3, - "depth" : 1 - }, { - "pc" : 13, - "op" : "CALLDATACOPY", - "gas" : 16755887, - "gasCost" : 9, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 14, - "op" : "PUSH1", - "gas" : 16755878, - "gasCost" : 3, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 16, - "op" : "CALLVALUE", - "gas" : 16755875, - "gasCost" : 2, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 17, - "op" : "PUSH1", - "gas" : 16755873, - "gasCost" : 3, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 19, - "op" : "CALLDATALOAD", - "gas" : 16755870, - "gasCost" : 3, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 20, - "op" : "GAS", - "gas" : 16755867, - "gasCost" : 2, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 21, - "op" : "CALLCODE", - "gas" : 16755865, - "gasCost" : 16494066, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16493366, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 2, - "op" : "CALLDATALOAD", - "gas" : 16493363, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 3, - "op" : "PUSH1", - "gas" : 16493360, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 5, - "op" : "ADD", - "gas" : 16493357, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 6, - "op" : "PUSH1", - "gas" : 16493354, - "gasCost" : 3, - "depth" : 2 - }, { - "pc" : 8, - "op" : "MSTORE", - "gas" : 16493351, - "gasCost" : 6, - "depth" : 2, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16493345, - "gasCost" : 3, - "depth" : 2, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16493342, - "gasCost" : 3, - "depth" : 2, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 13, - "op" : "RETURN", - "gas" : 16493339, - "gasCost" : 0, - "depth" : 2, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 22, - "op" : "PUSH1", - "gas" : 16755138, - "gasCost" : 3, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 24, - "op" : "PUSH1", - "gas" : 16755135, - "gasCost" : 3, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 26, - "op" : "RETURN", - "gas" : 16755132, - "gasCost" : 0, - "depth" : 1, - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - } ] + "response":{ + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":22070, + "failed":false, + "returnValue":"f000000000000000000000000000000000000000000000000000000000000002", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755910, + "gasCost":3, + "depth":1 + }, + { + "pc":2, + "op":"PUSH1", + "gas":16755907, + "gasCost":3, + "depth":1 + }, + { + "pc":4, + "op":"PUSH1", + "gas":16755904, + "gasCost":3, + "depth":1 + }, + { + "pc":6, + "op":"CALLDATASIZE", + "gas":16755901, + "gasCost":2, + "depth":1 + }, + { + "pc":7, + "op":"SUB", + "gas":16755899, + "gasCost":3, + "depth":1 + }, + { + "pc":8, + "op":"DUP1", + "gas":16755896, + "gasCost":3, + "depth":1 + }, + { + "pc":9, + "op":"PUSH1", + "gas":16755893, + "gasCost":3, + "depth":1 + }, + { + "pc":11, + "op":"PUSH1", + "gas":16755890, + "gasCost":3, + "depth":1 + }, + { + "pc":13, + "op":"CALLDATACOPY", + "gas":16755887, + "gasCost":9, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":14, + "op":"PUSH1", + "gas":16755878, + "gasCost":3, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":16, + "op":"CALLVALUE", + "gas":16755875, + "gasCost":2, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":17, + "op":"PUSH1", + "gas":16755873, + "gasCost":3, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":19, + "op":"CALLDATALOAD", + "gas":16755870, + "gasCost":3, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":20, + "op":"GAS", + "gas":16755867, + "gasCost":2, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":21, + "op":"CALLCODE", + "gas":16755865, + "gasCost":16494066, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":0, + "op":"PUSH1", + "gas":16493366, + "gasCost":3, + "depth":2 + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16493363, + "gasCost":3, + "depth":2 + }, + { + "pc":3, + "op":"PUSH1", + "gas":16493360, + "gasCost":3, + "depth":2 + }, + { + "pc":5, + "op":"ADD", + "gas":16493357, + "gasCost":3, + "depth":2 + }, + { + "pc":6, + "op":"PUSH1", + "gas":16493354, + "gasCost":3, + "depth":2 + }, + { + "pc":8, + "op":"MSTORE", + "gas":16493351, + "gasCost":6, + "depth":2, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16493345, + "gasCost":3, + "depth":2, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16493342, + "gasCost":3, + "depth":2, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":13, + "op":"RETURN", + "gas":16493339, + "gasCost":0, + "depth":2, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":22, + "op":"PUSH1", + "gas":16755138, + "gasCost":3, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":24, + "op":"PUSH1", + "gas":16755135, + "gasCost":3, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":26, + "op":"RETURN", + "gas":16755132, + "gasCost":0, + "depth":1, + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + } + ] } }, "statusCode": 200 diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStorage.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStorage.json index 2c5bb7a5afe..e9401e6f985 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStorage.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_disableStorage.json @@ -17,216 +17,377 @@ "id" : 1 }, "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 22070, - "failed" : false, - "returnValue" : "f000000000000000000000000000000000000000000000000000000000000002", - "structLogs" : [ { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16755910, - "gasCost" : 3, - "depth" : 1, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "PUSH1", - "gas" : 16755907, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20" ] - }, { - "pc" : 4, - "op" : "PUSH1", - "gas" : 16755904, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0" ] - }, { - "pc" : 6, - "op" : "CALLDATASIZE", - "gas" : 16755901, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 7, - "op" : "SUB", - "gas" : 16755899, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x40" ] - }, { - "pc" : 8, - "op" : "DUP1", - "gas" : 16755896, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16755893, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20" ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16755890, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20" ] - }, { - "pc" : 13, - "op" : "CALLDATACOPY", - "gas" : 16755887, - "gasCost" : 9, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x20", "0x20", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 14, - "op" : "PUSH1", - "gas" : 16755878, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 16, - "op" : "CALLVALUE", - "gas" : 16755875, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 17, - "op" : "PUSH1", - "gas" : 16755873, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 19, - "op" : "CALLDATALOAD", - "gas" : 16755870, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 20, - "op" : "GAS", - "gas" : 16755867, - "gasCost" : 2, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 21, - "op" : "CALLCODE", - "gas" : 16755865, - "gasCost" : 16494066, - "depth" : 1, - "stack" : [ "0x20", "0x0", "0x20", "0x0", "0x0", "0x30000000000000000000000000000000000000", "0xffac99" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 0, - "op" : "PUSH1", - "gas" : 16493366, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ] - }, { - "pc" : 2, - "op" : "CALLDATALOAD", - "gas" : 16493363, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x0" ] - }, { - "pc" : 3, - "op" : "PUSH1", - "gas" : 16493360, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001" ] - }, { - "pc" : 5, - "op" : "ADD", - "gas" : 16493357, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000001", "0x1" ] - }, { - "pc" : 6, - "op" : "PUSH1", - "gas" : 16493354, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 8, - "op" : "MSTORE", - "gas" : 16493351, - "gasCost" : 6, - "depth" : 2, - "stack" : [ "0xf000000000000000000000000000000000000000000000000000000000000002", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 9, - "op" : "PUSH1", - "gas" : 16493345, - "gasCost" : 3, - "depth" : 2, - "stack" : [ ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 11, - "op" : "PUSH1", - "gas" : 16493342, - "gasCost" : 3, - "depth" : 2, - "stack" : [ "0x20" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 13, - "op" : "RETURN", - "gas" : 16493339, - "gasCost" : 0, - "depth" : 2, - "stack" : [ "0x20", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 22, - "op" : "PUSH1", - "gas" : 16755138, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 24, - "op" : "PUSH1", - "gas" : 16755135, - "gasCost" : 3, - "depth" : 1, - "stack" : [ "0x1", "0x20" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - }, { - "pc" : 26, - "op" : "RETURN", - "gas" : 16755132, - "gasCost" : 0, - "depth" : 1, - "stack" : [ "0x1", "0x20", "0x0" ], - "memory" : [ "0xf000000000000000000000000000000000000000000000000000000000000002" ] - } ] + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":22070, + "failed":false, + "returnValue":"f000000000000000000000000000000000000000000000000000000000000002", + "structLogs":[ + { + "pc":0, + "op":"PUSH1", + "gas":16755910, + "gasCost":3, + "depth":1, + "stack":[ + + ] + }, + { + "pc":2, + "op":"PUSH1", + "gas":16755907, + "gasCost":3, + "depth":1, + "stack":[ + "0x20" + ] + }, + { + "pc":4, + "op":"PUSH1", + "gas":16755904, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0" + ] + }, + { + "pc":6, + "op":"CALLDATASIZE", + "gas":16755901, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":7, + "op":"SUB", + "gas":16755899, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x40" + ] + }, + { + "pc":8, + "op":"DUP1", + "gas":16755896, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16755893, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20" + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16755890, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20" + ] + }, + { + "pc":13, + "op":"CALLDATACOPY", + "gas":16755887, + "gasCost":9, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x20", + "0x20", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":14, + "op":"PUSH1", + "gas":16755878, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":16, + "op":"CALLVALUE", + "gas":16755875, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":17, + "op":"PUSH1", + "gas":16755873, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":19, + "op":"CALLDATALOAD", + "gas":16755870, + "gasCost":3, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":20, + "op":"GAS", + "gas":16755867, + "gasCost":2, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":21, + "op":"CALLCODE", + "gas":16755865, + "gasCost":16494066, + "depth":1, + "stack":[ + "0x20", + "0x0", + "0x20", + "0x0", + "0x0", + "0x30000000000000000000000000000000000000", + "0xffac99" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":0, + "op":"PUSH1", + "gas":16493366, + "gasCost":3, + "depth":2, + "stack":[ + + ] + }, + { + "pc":2, + "op":"CALLDATALOAD", + "gas":16493363, + "gasCost":3, + "depth":2, + "stack":[ + "0x0" + ] + }, + { + "pc":3, + "op":"PUSH1", + "gas":16493360, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001" + ] + }, + { + "pc":5, + "op":"ADD", + "gas":16493357, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000001", + "0x1" + ] + }, + { + "pc":6, + "op":"PUSH1", + "gas":16493354, + "gasCost":3, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":8, + "op":"MSTORE", + "gas":16493351, + "gasCost":6, + "depth":2, + "stack":[ + "0xf000000000000000000000000000000000000000000000000000000000000002", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":9, + "op":"PUSH1", + "gas":16493345, + "gasCost":3, + "depth":2, + "stack":[ + + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":11, + "op":"PUSH1", + "gas":16493342, + "gasCost":3, + "depth":2, + "stack":[ + "0x20" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":13, + "op":"RETURN", + "gas":16493339, + "gasCost":0, + "depth":2, + "stack":[ + "0x20", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":22, + "op":"PUSH1", + "gas":16755138, + "gasCost":3, + "depth":1, + "stack":[ + "0x1" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":24, + "op":"PUSH1", + "gas":16755135, + "gasCost":3, + "depth":1, + "stack":[ + "0x1", + "0x20" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + }, + { + "pc":26, + "op":"RETURN", + "gas":16755132, + "gasCost":0, + "depth":1, + "stack":[ + "0x1", + "0x20", + "0x0" + ], + "memory":[ + "0xf000000000000000000000000000000000000000000000000000000000000002" + ] + } + ] } }, "statusCode": 200 diff --git a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json index ac2e8a3f2b4..059cd3bf9b4 100644 --- a/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json +++ b/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/debug/trace-call/debug_traceCall_noGasPrice.json @@ -17,19 +17,21 @@ "id": 1 }, "response": { - "jsonrpc": "2.0", - "id": 1, - "result": { - "gas" : 21164, - "failed" : false, - "returnValue" : "", - "structLogs" : [ { - "pc" : 0, - "op" : "STOP", - "gas" : 17592186023252, - "gasCost" : 0, - "depth" : 1 - } ] + "jsonrpc":"2.0", + "id":1, + "result":{ + "gas":21164, + "failed":false, + "returnValue":"", + "structLogs":[ + { + "pc":0, + "op":"STOP", + "gas":17592186023252, + "gasCost":0, + "depth":1 + } + ] } }, "statusCode": 200 From 28dd49efaa37bdc3addc30eea6b9789b3ea8a506 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 5 Feb 2025 10:19:36 +1000 Subject: [PATCH 7/8] [CHANGELOG] add upcoming breaking changes to unreleased (#8235) Signed-off-by: Sally MacFarlane --- CHANGELOG.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d95d1f332c1..bb941f0ac9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ ## Unreleased ### Breaking Changes ### Upcoming Breaking Changes +- `MetricSystem::createLabelledGauge` is deprecated and will be removed in a future release, replace it with `MetricSystem::createLabelledSuppliedGauge` +- k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release. Use docker or none instead. +- `--Xsnapsync-synchronizer-flat-db-healing-enabled` is deprecated, use `--Xbonsai-full-flat-db-enabled` instead. +- `--Xbonsai-limit-trie-logs-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead. +- `--Xbonsai-trie-log-pruning-enabled` is deprecated, use `--bonsai-limit-trie-logs-enabled` instead. +- `--Xbonsai-trie-logs-pruning-window-size` is deprecated, use `--bonsai-trie-logs-pruning-window-size` instead. +- Sunsetting features - for more context on the reasoning behind the deprecation of these features, including alternative options, read [this blog post](https://www.lfdecentralizedtrust.org/blog/sunsetting-tessera-and-simplifying-hyperledger-besu) + - Tessera privacy + - Smart-contract-based (onchain) permissioning + - Proof of Work consensus + - Fast Sync ### Additions and Improvements - Add a tx selector to skip txs from the same sender after the first not selected [#8216](https://github.com/hyperledger/besu/pull/8216) @@ -20,7 +31,7 @@ ### Breaking Changes - `--host-whitelist` has been deprecated since 2020 and this option is removed. Use the equivalent `--host-allowlist` instead. -- Changed tracer API to include the mining beneficiary in BlockAwareOperationTracer::traceStartBlock [#8096](https://github.com/hyperledger/besu/pull/8096) +- Change tracer API to include the mining beneficiary in BlockAwareOperationTracer::traceStartBlock [#8096](https://github.com/hyperledger/besu/pull/8096) - Change the input defaults on debug_trace* calls to not trace memory by default ("disableMemory": true, "disableStack": false, "disableStorage": false) - Change the output format of debug_trace* and trace_* calls to match Geth behaviour From 1e5fb0051e9eff7de213e4141c72b43a142feb56 Mon Sep 17 00:00:00 2001 From: Sally MacFarlane Date: Wed, 5 Feb 2025 14:32:06 +1000 Subject: [PATCH 8/8] update rpc gas cap default to 50M (#8251) * update rpc gas cap default to 50M Signed-off-by: Sally MacFarlane --------- Signed-off-by: Sally MacFarlane --- CHANGELOG.md | 2 + .../cli/options/ApiConfigurationOptions.java | 2 +- .../options/ApiConfigurationOptionsTest.java | 37 ++++++- .../besu/ethereum/api/ApiConfiguration.java | 7 +- .../transaction/TransactionSimulatorTest.java | 96 ++++++++++++++----- 5 files changed, 114 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb941f0ac9e..f0c28640f91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased ### Breaking Changes +- `rpc-gas-cap` default value has changed from 0 (unlimited) to 50M. If you require `rpc-gas-cap` greater than 50M, you'll need to set that explicitly. [#8251](https://github.com/hyperledger/besu/issues/8251) ### Upcoming Breaking Changes - `MetricSystem::createLabelledGauge` is deprecated and will be removed in a future release, replace it with `MetricSystem::createLabelledSuppliedGauge` - k8s (KUBERNETES) Nat method is now deprecated and will be removed in a future release. Use docker or none instead. @@ -16,6 +17,7 @@ - Fast Sync ### Additions and Improvements - Add a tx selector to skip txs from the same sender after the first not selected [#8216](https://github.com/hyperledger/besu/pull/8216) +- `rpc-gas-cap` default value has changed from 0 (unlimited) to 50M [#8251](https://github.com/hyperledger/besu/issues/8251) #### Prague - Add timestamps to enable Prague hardfork on Sepolia and Holesky test networks [#8163](https://github.com/hyperledger/besu/pull/8163) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/ApiConfigurationOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/ApiConfigurationOptions.java index c5954f50639..e8f41805baa 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/ApiConfigurationOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/ApiConfigurationOptions.java @@ -81,7 +81,7 @@ public ApiConfigurationOptions() {} names = {"--rpc-gas-cap"}, description = "Specifies the gasLimit cap for transaction simulation RPC methods. Must be >=0. 0 specifies no limit (default: ${DEFAULT-VALUE})") - private final Long rpcGasCap = 0L; + private final Long rpcGasCap = ApiConfiguration.DEFAULT_GAS_CAP; @CommandLine.Option( names = {"--rpc-max-trace-filter-range"}, diff --git a/besu/src/test/java/org/hyperledger/besu/cli/options/ApiConfigurationOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/options/ApiConfigurationOptionsTest.java index 6e6c17f4dda..83e737b81ee 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/options/ApiConfigurationOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/options/ApiConfigurationOptionsTest.java @@ -19,6 +19,7 @@ import static org.mockito.Mockito.verify; import org.hyperledger.besu.cli.CommandTestAbstract; +import org.hyperledger.besu.ethereum.api.ApiConfiguration; import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration; import org.junit.jupiter.api.Test; @@ -111,7 +112,7 @@ public void rpcMaxLogsRangeOptionMustBeUsed() { verify(mockRunnerBuilder).build(); assertThat(apiConfigurationCaptor.getValue()) - .isEqualTo(ImmutableApiConfiguration.builder().maxLogsRange((rpcMaxLogsRange)).build()); + .isEqualTo(ImmutableApiConfiguration.builder().maxLogsRange(rpcMaxLogsRange).build()); assertThat(commandOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); @@ -126,7 +127,37 @@ public void rpcGasCapOptionMustBeUsed() { verify(mockRunnerBuilder).build(); assertThat(apiConfigurationCaptor.getValue()) - .isEqualTo(ImmutableApiConfiguration.builder().gasCap((rpcGasCap)).build()); + .isEqualTo(ImmutableApiConfiguration.builder().gasCap(rpcGasCap).build()); + + assertThat(commandOutput.toString(UTF_8)).isEmpty(); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + } + + @Test + public void rpcGasCapDefault() { + parseCommand(); + + verify(mockRunnerBuilder).apiConfiguration(apiConfigurationCaptor.capture()); + verify(mockRunnerBuilder).build(); + + assertThat(apiConfigurationCaptor.getValue()) + .isEqualTo( + ImmutableApiConfiguration.builder().gasCap(ApiConfiguration.DEFAULT_GAS_CAP).build()); + + assertThat(commandOutput.toString(UTF_8)).isEmpty(); + assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); + } + + @Test + public void rpcGasCapAcceptsZero() { + final long rpcGasCap = 0L; + parseCommand("--rpc-gas-cap", Long.toString(rpcGasCap)); + + verify(mockRunnerBuilder).apiConfiguration(apiConfigurationCaptor.capture()); + verify(mockRunnerBuilder).build(); + + assertThat(apiConfigurationCaptor.getValue()) + .isEqualTo(ImmutableApiConfiguration.builder().gasCap(rpcGasCap).build()); assertThat(commandOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); @@ -143,7 +174,7 @@ public void rpcMaxTraceFilterOptionMustBeUsed() { assertThat(apiConfigurationCaptor.getValue()) .isEqualTo( ImmutableApiConfiguration.builder() - .maxTraceFilterRange((rpcMaxTraceFilterOption)) + .maxTraceFilterRange(rpcMaxTraceFilterOption) .build()); assertThat(commandOutput.toString(UTF_8)).isEmpty(); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java index e317845f841..4180f113ada 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java @@ -38,6 +38,9 @@ public abstract class ApiConfiguration { */ public static final long DEFAULT_UPPER_BOUND_GAS_AND_PRIORITY_FEE_COEFFICIENT = Long.MAX_VALUE; + /** The default gas cap used for transaction simulation */ + public static final long DEFAULT_GAS_CAP = 50_000_000L; + /** Constructs a new ApiConfiguration with default values. */ protected ApiConfiguration() {} @@ -93,13 +96,13 @@ public Long getMaxLogsRange() { } /** - * Returns the gas cap. Default value is 0. + * Returns the gas cap. Default value is 50M. * * @return the gas cap */ @Value.Default public Long getGasCap() { - return 0L; + return DEFAULT_GAS_CAP; } /** diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java index 3515a5b6719..a07cc7e982c 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/TransactionSimulatorTest.java @@ -37,6 +37,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.parameters.UnsignedLongParameter; import org.hyperledger.besu.ethereum.GasLimitCalculator; +import org.hyperledger.besu.ethereum.api.ApiConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonCallParameter.JsonCallParameterBuilder; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlobTestFixture; @@ -93,8 +94,9 @@ public class TransactionSimulatorTest { Address.fromHexString("0x0000000000000000000000000000000000000000"); private static final long GAS_CAP = 500000L; private static final long TRANSFER_GAS_LIMIT = 21000L; - private TransactionSimulator transactionSimulator; + private TransactionSimulator uncappedTransactionSimulator; private TransactionSimulator cappedTransactionSimulator; + private TransactionSimulator defaultCappedTransactionSimulator; @Mock private Blockchain blockchain; @Mock private WorldStateArchive worldStateArchive; @@ -107,12 +109,22 @@ public class TransactionSimulatorTest { @BeforeEach public void setUp() { final var miningConfiguration = MiningConfiguration.newDefault().setCoinbase(Address.ZERO); - this.transactionSimulator = + // rpc gas cap 0 means unlimited + this.uncappedTransactionSimulator = new TransactionSimulator( blockchain, worldStateArchive, protocolSchedule, miningConfiguration, 0); + // capped at a lower limit this.cappedTransactionSimulator = new TransactionSimulator( blockchain, worldStateArchive, protocolSchedule, miningConfiguration, GAS_CAP); + // capped at default limit + this.defaultCappedTransactionSimulator = + new TransactionSimulator( + blockchain, + worldStateArchive, + protocolSchedule, + miningConfiguration, + ApiConfiguration.DEFAULT_GAS_CAP); } @Test @@ -174,7 +186,7 @@ public void shouldReturnEmptyWhenBlockDoesNotExist() { when(blockchain.getBlockHeader(eq(1L))).thenReturn(Optional.empty()); final Optional result = - transactionSimulator.process(legacyTransactionCallParameterBuilder().build(), 1L); + uncappedTransactionSimulator.process(legacyTransactionCallParameterBuilder().build(), 1L); assertThat(result.isPresent()).isFalse(); } @@ -203,7 +215,7 @@ public void shouldReturnSuccessfulResultWhenProcessingIsSuccessful() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); assertThat(result.get().isSuccessful()).isTrue(); verifyTransactionWasProcessed(expectedTransaction); @@ -234,12 +246,12 @@ public void simulateOnPendingBlockWorks() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.processOnPending( + uncappedTransactionSimulator.processOnPending( callParameter, Optional.empty(), TransactionValidationParams.transactionSimulator(), NO_TRACING, - transactionSimulator.simulatePendingBlockHeader()); + uncappedTransactionSimulator.simulatePendingBlockHeader()); assertThat(result.get().isSuccessful()).isTrue(); verifyTransactionWasProcessed(expectedTransaction); @@ -269,7 +281,7 @@ public void shouldSetGasPriceToZeroWhenExceedingBalanceAllowed() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process( + uncappedTransactionSimulator.process( callParameter, ImmutableTransactionValidationParams.builder().isAllowExceedingBalance(true).build(), NO_TRACING, @@ -306,7 +318,7 @@ public void shouldSetFeePerGasToZeroWhenExceedingBalanceAllowed() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process( + uncappedTransactionSimulator.process( callParameter, ImmutableTransactionValidationParams.builder().isAllowExceedingBalance(true).build(), NO_TRACING, @@ -340,7 +352,7 @@ public void shouldNotSetGasPriceToZeroWhenExceedingBalanceIsNotAllowed() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process( + uncappedTransactionSimulator.process( callParameter, ImmutableTransactionValidationParams.builder().isAllowExceedingBalance(false).build(), NO_TRACING, @@ -376,7 +388,7 @@ public void shouldNotSetFeePerGasToZeroWhenExceedingBalanceIsNotAllowed() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process( + uncappedTransactionSimulator.process( callParameter, ImmutableTransactionValidationParams.builder().isAllowExceedingBalance(false).build(), NO_TRACING, @@ -409,7 +421,7 @@ public void shouldUseDefaultValuesWhenMissingOptionalFields() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); verifyTransactionWasProcessed(expectedTransaction); } @@ -438,7 +450,7 @@ public void shouldUseZeroNonceWhenAccountDoesNotExist() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); verifyTransactionWasProcessed(expectedTransaction); } @@ -472,7 +484,7 @@ public void shouldUseSpecifiedNonceWhenProvided() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); verifyTransactionWasProcessed(expectedTransaction); } @@ -501,7 +513,7 @@ public void shouldReturnFailureResultWhenProcessingFails() { mockProcessorStatusForTransaction(expectedTransaction, Status.FAILED); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); assertThat(result.get().isSuccessful()).isFalse(); verifyTransactionWasProcessed(expectedTransaction); @@ -512,7 +524,8 @@ public void shouldReturnEmptyWhenBlockDoesNotExistByHash() { when(blockchain.getBlockHeader(eq(Hash.ZERO))).thenReturn(Optional.empty()); final Optional result = - transactionSimulator.process(legacyTransactionCallParameterBuilder().build(), Hash.ZERO); + uncappedTransactionSimulator.process( + legacyTransactionCallParameterBuilder().build(), Hash.ZERO); assertThat(result.isPresent()).isFalse(); } @@ -542,7 +555,7 @@ public void shouldReturnSuccessfulResultWhenProcessingIsSuccessfulByHash() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.process(callParameter, blockHeader.getBlockHash()); + uncappedTransactionSimulator.process(callParameter, blockHeader.getBlockHash()); assertThat(result.get().isSuccessful()).isTrue(); verifyTransactionWasProcessed(expectedTransaction); @@ -572,7 +585,7 @@ public void shouldUseDefaultValuesWhenMissingOptionalFieldsByHash() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process(callParameter, blockHeader.getBlockHash()); + uncappedTransactionSimulator.process(callParameter, blockHeader.getBlockHash()); verifyTransactionWasProcessed(expectedTransaction); } @@ -601,7 +614,7 @@ public void shouldUseZeroNonceWhenAccountDoesNotExistByHash() { .build(); mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); - transactionSimulator.process(callParameter, blockHeader.getBlockHash()); + uncappedTransactionSimulator.process(callParameter, blockHeader.getBlockHash()); verifyTransactionWasProcessed(expectedTransaction); } @@ -631,7 +644,7 @@ public void shouldReturnFailureResultWhenProcessingFailsByHash() { mockProcessorStatusForTransaction(expectedTransaction, Status.FAILED); final Optional result = - transactionSimulator.process(callParameter, blockHeader.getBlockHash()); + uncappedTransactionSimulator.process(callParameter, blockHeader.getBlockHash()); assertThat(result.get().isSuccessful()).isFalse(); verifyTransactionWasProcessed(expectedTransaction); @@ -662,7 +675,7 @@ public void shouldReturnSuccessfulResultWhenEip1559TransactionProcessingIsSucces mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); assertThat(result.get().isSuccessful()).isTrue(); verifyTransactionWasProcessed(expectedTransaction); @@ -735,7 +748,7 @@ public void shouldUseProvidedGasLimitWhenBelowRpcCapGas() { } @Test - public void shouldUseRpcGasCapWhenGasLimitNoPresent() { + public void shouldUseRpcGasCapWhenGasLimitNotPresent() { // generate call parameters that do not specify a gas limit, // expect the rpc gas cap to be used for simulation @@ -769,6 +782,41 @@ public void shouldUseRpcGasCapWhenGasLimitNoPresent() { verifyTransactionWasProcessed(expectedTransaction); } + @Test + public void shouldUseDefaultRpcGasCapWhenGasLimitNotPresent() { + // generate call parameters that do not specify a gas limit, + // expect the default rpc gas cap to be used for simulation + + final CallParameter callParameter = + eip1559TransactionCallParameterBuilder().withGas(-1L).build(); + + mockBlockchainAndWorldState(callParameter); + mockProtocolSpecForProcessWithWorldUpdater(); + + final Transaction expectedTransaction = + Transaction.builder() + .type(TransactionType.EIP1559) + .chainId(BigInteger.ONE) + .nonce(1L) + .gasLimit(callParameter.getGasLimit()) + .maxFeePerGas(callParameter.getMaxFeePerGas().orElseThrow()) + .maxPriorityFeePerGas(callParameter.getMaxPriorityFeePerGas().orElseThrow()) + .to(callParameter.getTo()) + .sender(callParameter.getFrom()) + .value(callParameter.getValue()) + .payload(callParameter.getPayload()) + .signature(FAKE_SIGNATURE) + .gasLimit(ApiConfiguration.DEFAULT_GAS_CAP) + .build(); + + // call process with original transaction + defaultCappedTransactionSimulator.process( + callParameter, TransactionValidationParams.transactionSimulator(), NO_TRACING, 1L); + + // expect transaction with the original gas limit to be processed + verifyTransactionWasProcessed(expectedTransaction); + } + @Test public void shouldReturnSuccessfulResultWhenBlobTransactionProcessingIsSuccessful() { final CallParameter callParameter = blobTransactionCallParameter(); @@ -780,7 +828,7 @@ public void shouldReturnSuccessfulResultWhenBlobTransactionProcessingIsSuccessfu mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); assertThat(result.get().isSuccessful()).isTrue(); verifyTransactionWasProcessed(expectedTransaction); @@ -797,7 +845,7 @@ public void shouldReturnFailureResultWhenBlobTransactionProcessingFails() { mockProcessorStatusForTransaction(expectedTransaction, Status.FAILED); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); assertThat(result.get().isSuccessful()).isFalse(); verifyTransactionWasProcessed(expectedTransaction); @@ -980,7 +1028,7 @@ public void shouldSimulateLegacyTransactionWhenBaseFeeNotZero() { mockProcessorStatusForTransaction(expectedTransaction, Status.SUCCESSFUL); final Optional result = - transactionSimulator.process(callParameter, 1L); + uncappedTransactionSimulator.process(callParameter, 1L); verifyTransactionWasProcessed(expectedTransaction); assertThat(result.get().isSuccessful()).isTrue();