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

Issues with reproducer testing #122

Open
vsaraph opened this issue Dec 5, 2018 · 0 comments
Open

Issues with reproducer testing #122

vsaraph opened this issue Dec 5, 2018 · 0 comments

Comments

@vsaraph
Copy link

vsaraph commented Dec 5, 2018

Hello,

I am trying to run evmlab's reproducer but I'm having issues doing so. After following the installation process in the documentation, I executed the following command to (what I think is supposed to) test that the reproducer works:

python3 -m evmlab reproducer -t

Here is the terminal output:

(.evmlab) vikrams-mbp:evmlab vsaraph$ python3 -m evmlab reproducer -t
Transaction input decoder package not installed. run `#> pip install evmlab[abidecoder]` to install.
WARNING:root:[!! Exception] Failed to Import RndCodeInstr() - ModuleNotFoundError("No module named 'evmcodegen'")
WARNING:root:----> Falling back to Random Code Generation based on byte distribution!
Doing tests
Setting Spurious config for block 4168497
GetAccountInfo(0x69EA6b31ef305d6b99bB2d4c9D99456fA108b02A, 4168496)
GetAccountInfo(0xB97048628DB6B661D4C2aA833e95Dbe1A905B280, 4168496)
Executing tx...
docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-geth_Z8t93uH2.json --gas 150000 --sender 0x69EA6b31ef305d6b99bB2d4c9D99456fA108b02A --receiver 0xB97048628DB6B661D4C2aA833e95Dbe1A905B280 --input a9059cbb0000000000000000000000008eef795fd9150f118bddeca556a5a2a2438ab865000000000000000000000000000000000000000000000081ebd8ffd6b2a58000 --nomemory --json run
Saved trace to /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519_d7odta6s.txt
Odd line: 
Final execution (memory on)
docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-geth_PkO4yaYw.json --gas 150000 --sender 0x69EA6b31ef305d6b99bB2d4c9D99456fA108b02A --receiver 0xB97048628DB6B661D4C2aA833e95Dbe1A905B280 --input a9059cbb0000000000000000000000008eef795fd9150f118bddeca556a5a2a2438ab865000000000000000000000000000000000000000000000081ebd8ffd6b2a58000 --json run
Saved trace to /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519_4awh90zx.txt
Evmtracing failed
Traceback (most recent call last):
  File "/Users/vsaraph/scratch/evmlab/evmlab/reproduce.py", line 229, in reproduceTx
    annotated_trace = evmtrace.traceEvmOutput(temp_path)
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 328, in traceEvmOutput
    ast = TransactionTrace.build(result)
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 132, in build
    return TransactionTrace(buildAST(trace))
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 102, in buildAST
    for step in trace:
TypeError: 'NoneType' object is not iterable
vm args:
{'receiver': '0xB97048628DB6B661D4C2aA833e95Dbe1A905B280', 'sender': '0x69EA6b31ef305d6b99bB2d4c9D99456fA108b02A', 'genesis': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-geth_PkO4yaYw.json', 'json': True, 'input': 'a9059cbb0000000000000000000000008eef795fd9150f118bddeca556a5a2a2438ab865000000000000000000000000000000000000000000000081ebd8ffd6b2a58000', 'gas': 150000, 'memory': True, 'create': False}
({'geth genesis': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-geth_PkO4yaYw.json',
  'json-trace': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519_4awh90zx.txt',
  'parity genesis': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-parity_HyYFtjsa.json'},
 {'create': False,
  'gas': 150000,
  'genesis': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd6d519-genesis-geth_PkO4yaYw.json',
  'input': 'a9059cbb0000000000000000000000008eef795fd9150f118bddeca556a5a2a2438ab865000000000000000000000000000000000000000000000081ebd8ffd6b2a58000',
  'json': True,
  'memory': True,
  'receiver': '0xB97048628DB6B661D4C2aA833e95Dbe1A905B280',
  'sender': '0x69EA6b31ef305d6b99bB2d4c9D99456fA108b02A'})

I thought I would also try it out on an actual transaction:

(.evmlab) vikrams-mbp:evmlab vsaraph$ python3 -m evmlab reproducer -x 0xd401aa7847505def1ad54251895b08ece017d40fc52455abf606f499e20c6f0c
Transaction input decoder package not installed. run `#> pip install evmlab[abidecoder]` to install.
WARNING:root:[!! Exception] Failed to Import RndCodeInstr() - ModuleNotFoundError("No module named 'evmcodegen'")
WARNING:root:----> Falling back to Random Code Generation based on byte distribution!
Setting Metro config for block 4719480
GetAccountInfo(0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0, 4719479)
GetAccountInfo(0x8d12A197cB00D4747a1fe03395095ce2A5CC6819, 4719479)
Executing tx...
docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd401aa-genesis-geth_7nDlFvXH.json --gas 250000 --sender 0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0 --receiver 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 --input 2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000 --nomemory --json run
Saved trace to /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd401aa_ztj9ikbd.txt
Odd line: 
Final execution (memory on)
docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd401aa-genesis-geth_2NYs65zH.json --gas 250000 --sender 0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0 --receiver 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 --input 2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000 --json run
Saved trace to /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd401aa__k2hb_rb.txt
Evmtracing failed
Traceback (most recent call last):
  File "/Users/vsaraph/scratch/evmlab/evmlab/reproduce.py", line 229, in reproduceTx
    annotated_trace = evmtrace.traceEvmOutput(temp_path)
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 328, in traceEvmOutput
    ast = TransactionTrace.build(result)
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 132, in build
    return TransactionTrace(buildAST(trace))
  File "/Users/vsaraph/scratch/evmlab/evmlab/evmtrace.py", line 102, in buildAST
    for step in trace:
TypeError: 'NoneType' object is not iterable
vm args:
{'receiver': '0x8d12A197cB00D4747a1fe03395095ce2A5CC6819', 'sender': '0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0', 'genesis': '/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/0xd401aa-genesis-geth_2NYs65zH.json', 'json': True, 'input': '2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000', 'gas': 250000, 'memory': True, 'create': False}
Saving files

* geth genesis -> /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer10xd401aa-genesis-geth_2NYs65zH.json
* parity genesis -> /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer10xd401aa-genesis-parity_B7AS26ho.json
* json-trace -> /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer10xd401aa__k2hb_rb.txt

Command to execute locally (geth):

docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1 holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1/0xd401aa-genesis-geth_2NYs65zH.json --gas 250000 --sender 0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0 --receiver 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 --input 2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000 --json run

With memory:

docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1 holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1/0xd401aa-genesis-geth_2NYs65zH.json --gas 250000 --sender 0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0 --receiver 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 --input 2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000 --json run

For benchmarking:

docker run --rm -v /private/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1:/var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1 holiman/gethvm --prestate /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1/0xd401aa-genesis-geth_2NYs65zH.json --gas 250000 --sender 0x6d008fF3111A579c78Bd82a084CDdEA109D6f5E0 --receiver 0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 --input 2e1a7d4d000000000000000000000000000000000000000000000000002386f26fc10000 --nomemory --statdump run

For opviewing:

python3 opviewer.py -f /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1/0xd401aa__k2hb_rb.txt

For opviewing with sources:

python3 opviewer.py -f /var/folders/vg/42bs34ws19s4wkc5r_t3d9z80000gn/T/evmlabf9tjjer1/0xd401aa__k2hb_rb.txt --web3 'https://mainnet.infura.io/' -s path_to_contract_dir -j path_to_solc_combined_json --hash 0xd401aa7847505def1ad54251895b08ece017d40fc52455abf606f499e20c6f0c
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/vsaraph/scratch/evmlab/evmlab/__main__.py", line 50, in <module>
    main()
  File "/Users/vsaraph/scratch/evmlab/evmlab/__main__.py", line 43, in main
    ret = SUBCOMMAND.get(cmd_util.strip().lower(), usage)()
  File "/Users/vsaraph/scratch/evmlab/evmlab/__main__.py", line 33, in <lambda>
    'reproducer': lambda: reproducer.main(),
  File "/Users/vsaraph/scratch/evmlab/evmlab/tools/reproducer/reproducer.py", line 224, in main
    input_files = [(os.path.join(v['path'], v['name']), v['name']) for v in saved_files]
  File "/Users/vsaraph/scratch/evmlab/evmlab/tools/reproducer/reproducer.py", line 224, in <listcomp>
    input_files = [(os.path.join(v['path'], v['name']), v['name']) for v in saved_files]
TypeError: string indices must be integers

I get a second error when I try this, a TypeError as seen on the very last line above. I was easily able to fix this by replacing the line
input_files = [(os.path.join(v['path'], v['name']), v['name']) for v in saved_files]
with:
input_files = [(os.path.join(i['path'], i['name']), i['name']) for v, i in saved_files.items()]

However I haven't done enough digging around yet to figure out what the exact issue is with the TypeError: 'NoneType' object is not iterable when running the tests.

Any ideas? Or is the evmlab reproducer meant to be ready for use yet? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant