Skip to content

Commit

Permalink
Still use leftPad when displaying the stack in the output (ex. for de…
Browse files Browse the repository at this point in the history
…bug_traceTransaction)

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
  • Loading branch information
ahamlat committed Oct 31, 2023
1 parent 8950f26 commit a41d5b4
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results;

import org.apache.tuweni.bytes.Bytes32;
import org.hyperledger.besu.ethereum.debug.TraceFrame;

import java.util.Arrays;
Expand All @@ -25,6 +26,7 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256;
import org.hyperledger.besu.ethereum.vm.DebugOperationTracer;

@JsonPropertyOrder({"pc", "op", "gas", "gasCost", "depth", "stack", "memory", "storage"})
public class StructLog {
Expand Down Expand Up @@ -53,7 +55,7 @@ public StructLog(final TraceFrame traceFrame) {
stack =
traceFrame
.getStack()
.map(a -> Arrays.stream(a).map(Bytes::toUnprefixedHexString).toArray(String[]::new))
.map(a -> Arrays.stream(a).map(Bytes32::leftPad).map(Bytes::toUnprefixedHexString).toArray(String[]::new))
.orElse(null);
storage = traceFrame.getStorage().map(StructLog::formatStorage).orElse(null);
reason = traceFrame.getRevertReason().map(Bytes::toShortHexString).orElse(null);
Expand Down

0 comments on commit a41d5b4

Please sign in to comment.