|
|
|
@ -44,6 +44,7 @@ import java.util.Map; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
import org.apache.tuweni.bytes.Bytes; |
|
|
|
|
import org.apache.tuweni.bytes.Bytes32; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
public class DebugTraceTransactionTest { |
|
|
|
@ -76,6 +77,15 @@ public class DebugTraceTransactionTest { |
|
|
|
|
new JsonRpcRequestContext(new JsonRpcRequest("2.0", "debug_traceTransaction", params)); |
|
|
|
|
final Result result = mock(Result.class); |
|
|
|
|
|
|
|
|
|
final Bytes32[] stackBytes = |
|
|
|
|
new Bytes32[] { |
|
|
|
|
Bytes32.fromHexString( |
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000001") |
|
|
|
|
}; |
|
|
|
|
final Bytes[] memoryBytes = |
|
|
|
|
new Bytes[] { |
|
|
|
|
Bytes.fromHexString("0x0000000000000000000000000000000000000000000000000000000000000002") |
|
|
|
|
}; |
|
|
|
|
final TraceFrame traceFrame = |
|
|
|
|
new TraceFrame( |
|
|
|
|
12, |
|
|
|
@ -89,8 +99,8 @@ public class DebugTraceTransactionTest { |
|
|
|
|
Wei.ZERO, |
|
|
|
|
Bytes.EMPTY, |
|
|
|
|
Bytes.EMPTY, |
|
|
|
|
Optional.empty(), |
|
|
|
|
Optional.empty(), |
|
|
|
|
Optional.of(stackBytes), |
|
|
|
|
Optional.of(memoryBytes), |
|
|
|
|
Optional.empty(), |
|
|
|
|
null, |
|
|
|
|
Optional.of(Bytes.fromHexString("0x1122334455667788")), |
|
|
|
@ -122,6 +132,13 @@ public class DebugTraceTransactionTest { |
|
|
|
|
assertThat(transactionResult.getReturnValue()).isEqualTo("1234"); |
|
|
|
|
final List<StructLog> expectedStructLogs = Collections.singletonList(new StructLog(traceFrame)); |
|
|
|
|
assertThat(transactionResult.getStructLogs()).isEqualTo(expectedStructLogs); |
|
|
|
|
assertThat(transactionResult.getStructLogs().size()).isEqualTo(1); |
|
|
|
|
assertThat(transactionResult.getStructLogs().get(0).stack().length).isEqualTo(1); |
|
|
|
|
assertThat(transactionResult.getStructLogs().get(0).stack()[0]) |
|
|
|
|
.isEqualTo(stackBytes[0].toUnprefixedHexString()); |
|
|
|
|
assertThat(transactionResult.getStructLogs().get(0).memory().length).isEqualTo(1); |
|
|
|
|
assertThat(transactionResult.getStructLogs().get(0).memory()[0]) |
|
|
|
|
.isEqualTo(memoryBytes[0].toUnprefixedHexString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|