Skip to content

Commit cbc1912

Browse files
authored
Merge branch 'main' into feature/rpc-stack-refactor-phase1-clean
2 parents 8609317 + 4bf07a5 commit cbc1912

3 files changed

Lines changed: 57 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ are provided with different values, using input as per the execution-apis spec i
4242

4343
### Additions and Improvements
4444
- Add `transactionReceipts` subscription type to `eth_subscribe` that pushes all transaction receipts when a new block is added, with optional `transactionHashes` filter to receive receipts for specific transactions only [#10190](https://github.com/besu-eth/besu/pull/10190)
45+
- Add `enableMemory` parameter to `debug_traceTransaction` and `debug_traceBlockByNumber`. Defaults to `false`; memory is only included in trace output when explicitly enabled. The existing `disableMemory` parameter continues to work for backwards compatibility [#10169](https://github.com/besu-eth/besu/pull/10169)
4546
- `--net-restrict` now supports IPv6 CIDR notation (e.g. `fd00::/64`) in addition to IPv4, enabling subnet-based peer filtering in IPv6 and dual-stack deployments [#10028](https://github.com/besu-eth/besu/pull/10028)
4647
- Stop EngineQosTimer as part of shutdown [#9903](https://github.com/hyperledger/besu/pull/9903)
4748
- Add `--max-blobs-per-transaction` CLI option to configure the maximum number of blobs per transaction [#9912](https://github.com/hyperledger/besu/pull/9912)

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/TransactionTraceParams.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ default boolean disableMemory() {
5555
return Boolean.TRUE.equals(disableMemoryNullable());
5656
}
5757

58+
@JsonProperty(value = "enableMemory")
59+
@Nullable Boolean enableMemoryNullable();
60+
61+
default boolean enableMemory() {
62+
return Boolean.TRUE.equals(enableMemoryNullable());
63+
}
64+
5865
@JsonProperty(value = "disableStack")
5966
@Nullable Boolean disableStackNullable();
6067

@@ -103,7 +110,9 @@ default TraceOptions traceOptions() {
103110
if (disableStorageNullable() != null) {
104111
builder.traceStorage(!disableStorage());
105112
}
106-
if (disableMemoryNullable() != null) {
113+
if (enableMemoryNullable() != null) {
114+
builder.traceMemory(enableMemory());
115+
} else if (disableMemoryNullable() != null) {
107116
builder.traceMemory(!disableMemory());
108117
} else if (tracerType != TracerType.OPCODE_TRACER) {
109118
// Non-opcode tracers (e.g. callTracer) need memory capture enabled for internal

ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/TransactionTraceParamsTest.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,50 @@ public void nonOpcodeTracerShouldRespectExplicitDisableMemory() throws Exception
8585
.describedAs("explicit disableMemory=true should be respected")
8686
.isFalse();
8787
}
88+
89+
@Test
90+
public void enableMemoryTrueShouldEnableMemory() throws Exception {
91+
final TransactionTraceParams params =
92+
MAPPER.readValue("{\"enableMemory\": true}", TransactionTraceParams.class);
93+
final OpCodeTracerConfig config = params.traceOptions().opCodeTracerConfig();
94+
95+
assertThat(config.traceMemory())
96+
.describedAs("enableMemory=true should enable memory tracing")
97+
.isTrue();
98+
}
99+
100+
@Test
101+
public void enableMemoryFalseShouldDisableMemory() throws Exception {
102+
final TransactionTraceParams params =
103+
MAPPER.readValue("{\"enableMemory\": false}", TransactionTraceParams.class);
104+
final OpCodeTracerConfig config = params.traceOptions().opCodeTracerConfig();
105+
106+
assertThat(config.traceMemory())
107+
.describedAs("enableMemory=false should disable memory tracing")
108+
.isFalse();
109+
}
110+
111+
@Test
112+
public void enableMemoryShouldTakePrecedenceOverDisableMemory() throws Exception {
113+
final TransactionTraceParams params =
114+
MAPPER.readValue(
115+
"{\"enableMemory\": true, \"disableMemory\": true}", TransactionTraceParams.class);
116+
final OpCodeTracerConfig config = params.traceOptions().opCodeTracerConfig();
117+
118+
assertThat(config.traceMemory())
119+
.describedAs("enableMemory should take precedence over disableMemory")
120+
.isTrue();
121+
}
122+
123+
@Test
124+
public void nonOpcodeTracerShouldRespectExplicitEnableMemoryFalse() throws Exception {
125+
final TransactionTraceParams params =
126+
MAPPER.readValue(
127+
"{\"tracer\": \"callTracer\", \"enableMemory\": false}", TransactionTraceParams.class);
128+
final OpCodeTracerConfig config = params.traceOptions().opCodeTracerConfig();
129+
130+
assertThat(config.traceMemory())
131+
.describedAs("explicit enableMemory=false should be respected for callTracer")
132+
.isFalse();
133+
}
88134
}

0 commit comments

Comments
 (0)