repro

command
v0.0.0-...-a6ff567 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

README

Repro

repro is a utility to reproduce a line in a (potentially large) trace. It is very simplistic and naive, which works well in some situations. For now, it just looks at the stack and produces a push-sequence to mimic that stack.

Example, telling it to focos on step 7 of the trace at ./testdata/1.geth.jsonl:

$ go run . ./testdata/1.geth.jsonl 7 
INFO [02-10|09:43:33.486] Read traces                              steps=9
INFO [02-10|09:43:33.486] Read traces                              steps=9 target step=7
Target line:

        {"pc":15337,"op":26,"gas":"0x22","gasCost":"0x0","memSize":0,"stack":["0x10000000000000000","0x77676767676760000000000000001002e000000000000040000000e000000000","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x0","0x0"],"depth":1,"refund":0,"opName":"BYTE"}

Reproing stack, at step 7: 
         push 0x0
         push 0x0
         push 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
         push 0x77676767676760000000000000001002e000000000000040000000e000000000
         push 0x10000000000000000
Adding op
        BYTE
Code: 0x600060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f77676767676760000000000000001002e000000000000040000000e000000000680100000000000000001a

If you only have the interesting line, and not the full stack, you need to do a bit of special magic, see ./testdata/line.txt. Namely, add an extra line with an empty {} -- this is to ensure that the parser sees it as jsonl, and does not confuse it with another json-based trace-format returned by legacy rpc.

$ go run . ./testdata/line.txt 
INFO [02-10|09:45:53.448] Read traces                              steps=1
INFO [02-10|09:45:53.448] Read traces                              steps=1 target step=0
Target line:

        {"pc":15337,"op":26,"gas":"0x22","gasCost":"0x0","memSize":0,"stack":["0x0","0x0","0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","0x77676767676760000000000000001002e000000000000040000000e000000000","0x10000000000000000"],"depth":1,"refund":0,"opName":"BYTE"}

Reproing stack, at step 0: 
         push 0x10000000000000000
         push 0x77676767676760000000000000001002e000000000000040000000e000000000
         push 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
         push 0x0
         push 0x0
Adding op
        BYTE
Code: 0x680100000000000000007f77676767676760000000000000001002e000000000000040000000e0000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600060001a

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL