Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete leftPad when capturing the stack before and after a frame execution #6102

Merged
merged 8 commits into from
Nov 9, 2023
Prev Previous commit
Next Next commit
Spotless
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
  • Loading branch information
ahamlat committed Oct 31, 2023
commit 32b5607a5c3fd06abe71af1af1d0b58d16339bb9
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
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,8 +24,8 @@
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
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 @@ -55,7 +54,12 @@ public StructLog(final TraceFrame traceFrame) {
stack =
traceFrame
.getStack()
.map(a -> Arrays.stream(a).map(Bytes32::leftPad).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
Loading