Skip to content

Instantly share code, notes, and snippets.

View holiman's full-sized avatar
💭
<i>foo</i>

Martin HS holiman

💭
<i>foo</i>
View GitHub Profile
trace
```
#cat /tmp/evmlab/artefacts/ropsten_mini-combined_trace.log
[*] pc 0 op PUSH1( 96) gas 0x23ccaa depth 0 stack []
[*] pc 2 op SLOAD( 84) gas 0x23cca7 depth 0 stack ['0x3']
[*] pc 3 op CALLER( 51) gas 0x23cbdf depth 0 stack ['0x0']
[*] pc 4 op ADDRESS( 48) gas 0x23cbdd depth 0 stack ['0x0', '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b']
[*] pc 5 op EQ( 20) gas 0x23cbdb depth 0 stack ['0x0', '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0xe12d6474ac4964b9f23812bf3375c1fe637ad3b6']
[*] pc 6 op PUSH1( 96) gas 0x23cbd8 depth 0 stack ['0x0', '0x0']
[*] pc 8 op JUMPI( 87) gas 0x23cbd5 depth 0 stack ['0x0', '0x0', '0x1d']
@holiman
holiman / clip.sh
Created September 25, 2018 17:04
best script ever, place it as `~/bin/clip`
#!/bin/bash
# Linux version
# Use this script to pipe in/out of the clipboard
#
# Usage: someapp | clipboard # Pipe someapp's output into clipboard
# clipboard | someapp # Pipe clipboard's content into someapp
#
if command -v xclip 1>/dev/null; then
if [[ -p /dev/stdin ]] ; then

Current status and problems

Currently, tests are checked in to the tests repo, which contains several things:

  • Manually crafted tests, like bcForkBlockTestCopier.json in the src/BlockchaintestsFiller/ directory. The 'filler' directories contain various tests that are 'to be filled'.
  • Generalized state tests. These are also unfilled, and contain basically prestate, and the expect-section for various 'indexes'. Indexes are used to generalize the test. Example test 'Bazonk':
  • Run this test with gas 2000001, then 400000, on Constantinople and Homestead.

Writing an EVM-debugger for Geth

This document provides some ideas on how someone fairly easily could build the basic blocks for a debugger using geth.

Integration

The tracer interface defines four methods that a 'tracer' needs to implement:

Signatures included

Not listing calls made fewer than 5 times

1177020 0xa9059cbb-64 47.53% (47.53% aggregate)
107508 0xef343588-576 4.34% (51.88% aggregate)
66946 0x23b872dd-96 2.70% (54.58% aggregate)
46585 0x095ea7b3-64 1.88% (56.46% aggregate)
39975 0x70a08231-32 1.61% (58.07% aggregate)
34695 0x2295115b-256 1.40% (59.48% aggregate)
@holiman
holiman / output.json
Created February 23, 2018 06:21 — forked from lesce/output.json
PREIMAGES map[]
{
"root": "d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",
"accounts": {
"000d836201318ec6899a67540690382780743280": {
"balance": "200000000000000000000",
"nonce": 0,
"root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"codeHash": "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"code": "",

The values above, but translated into a table

Name                                         Gascost         Time (ns)       MGas/S    Gasprice for 10MGas/S  Gas/Ideal percent
-----------------------------------------  ---------  ----------------  -----------  -----------------------  -------------------
PrecompiledEcrecover/                           3000  171600              17.4825                   1716      174.8 %
PrecompiledSha256/128                            108     675             160                           6.75   1600.0 %
PrecompiledRipeMD/128                           1080    2336             462.329                      23.36   4623.3 %
PrecompiledIdentity/128                           27      18.8          1436.17                        0.188  14361.7 %
PrecompiledModExp/eip_example1                  2611  140894              18.5317                   1408.94   185.3 %
@holiman
holiman / 10kblocks.json
Last active June 3, 2017 00:48
4-byte identifiers, for all calls between 3639998 and 3649998, a total of 181k transactions, and ~42k actual method calls.
{"endblock":3649998,"ids":{"0x00000000":360,"0x005b9b48":3,"0x0121b93f":3,"0x02f2008d":2,"0x03496dae":1,"0x058aace1":8,"0x05f21815":1,"0x07946f50":2,"0x07da68f5":1,"0x07daf2df":3,"0x084da883":1,"0x095ea7b3":312,"0x0a19b14a":346,"0x0d381cad":2,"0x0d59b564":1,"0x0f2c9329":3757,"0x0fb59f95":6,"0x114d081d":4,"0x11610c25":1,"0x11a125ce":4,"0x144fa6d7":2,"0x148105ab":4,"0x154652c8":3,"0x15891148":168,"0x173825d9":2,"0x17be89f0":1,"0x186f161b":11,"0x18cf4469":1,"0x19b667da":1,"0x19c12795":3,"0x1a695230":268,"0x1bbfb029":31,"0x1e9a6950":23,"0x1f21cebb":1,"0x2016890c":1,"0x20987e64":10,"0x20ba018a":1,"0x213ac932":58,"0x219f037a":3,"0x23b872dd":317,"0x257bcd6a":490,"0x25fda176":6,"0x266710ca":1,"0x269673af":1,"0x26cfd794":1,"0x278b8c0e":104,"0x27dc297e":5,"0x29b5b30c":22,"0x29cbdc86":1,"0x29ff4f53":1,"0x2bffc7ed":2,"0x2d580ef6":10,"0x2e1a7d4d":120,"0x2e92abdd":4,"0x2eaed480":1,"0x2ebec916":1,"0x2f54bf6e":1,"0x303017bd":1,"0x30301aa0":1,"0x303029ef":1,"0x30302bee":1,"0x30303614":1,"0x30303a3d":1,"0x30303c6a":1,"0x30303c
@holiman
holiman / 10kblocks.json
Created May 8, 2017 11:06
4-byte identifiers, for all calls betwee
{"endblock":3649998,"ids":{"0x00000000":360,"0x005b9b48":3,"0x0121b93f":3,"0x02f2008d":2,"0x03496dae":1,"0x058aace1":8,"0x05f21815":1,"0x07946f50":2,"0x07da68f5":1,"0x07daf2df":3,"0x084da883":1,"0x095ea7b3":312,"0x0a19b14a":346,"0x0d381cad":2,"0x0d59b564":1,"0x0f2c9329":3757,"0x0fb59f95":6,"0x114d081d":4,"0x11610c25":1,"0x11a125ce":4,"0x144fa6d7":2,"0x148105ab":4,"0x154652c8":3,"0x15891148":168,"0x173825d9":2,"0x17be89f0":1,"0x186f161b":11,"0x18cf4469":1,"0x19b667da":1,"0x19c12795":3,"0x1a695230":268,"0x1bbfb029":31,"0x1e9a6950":23,"0x1f21cebb":1,"0x2016890c":1,"0x20987e64":10,"0x20ba018a":1,"0x213ac932":58,"0x219f037a":3,"0x23b872dd":317,"0x257bcd6a":490,"0x25fda176":6,"0x266710ca":1,"0x269673af":1,"0x26cfd794":1,"0x278b8c0e":104,"0x27dc297e":5,"0x29b5b30c":22,"0x29cbdc86":1,"0x29ff4f53":1,"0x2bffc7ed":2,"0x2d580ef6":10,"0x2e1a7d4d":120,"0x2e92abdd":4,"0x2eaed480":1,"0x2ebec916":1,"0x2f54bf6e":1,"0x303017bd":1,"0x30301aa0":1,"0x303029ef":1,"0x30302bee":1,"0x30303614":1,"0x30303a3d":1,"0x30303c6a":1,"0x30303c
@holiman
holiman / 10kblocks.json
Created May 8, 2017 11:06
4-byte identifiers, for all calls betwee
{"endblock":3649998,"ids":{"0x00000000":360,"0x005b9b48":3,"0x0121b93f":3,"0x02f2008d":2,"0x03496dae":1,"0x058aace1":8,"0x05f21815":1,"0x07946f50":2,"0x07da68f5":1,"0x07daf2df":3,"0x084da883":1,"0x095ea7b3":312,"0x0a19b14a":346,"0x0d381cad":2,"0x0d59b564":1,"0x0f2c9329":3757,"0x0fb59f95":6,"0x114d081d":4,"0x11610c25":1,"0x11a125ce":4,"0x144fa6d7":2,"0x148105ab":4,"0x154652c8":3,"0x15891148":168,"0x173825d9":2,"0x17be89f0":1,"0x186f161b":11,"0x18cf4469":1,"0x19b667da":1,"0x19c12795":3,"0x1a695230":268,"0x1bbfb029":31,"0x1e9a6950":23,"0x1f21cebb":1,"0x2016890c":1,"0x20987e64":10,"0x20ba018a":1,"0x213ac932":58,"0x219f037a":3,"0x23b872dd":317,"0x257bcd6a":490,"0x25fda176":6,"0x266710ca":1,"0x269673af":1,"0x26cfd794":1,"0x278b8c0e":104,"0x27dc297e":5,"0x29b5b30c":22,"0x29cbdc86":1,"0x29ff4f53":1,"0x2bffc7ed":2,"0x2d580ef6":10,"0x2e1a7d4d":120,"0x2e92abdd":4,"0x2eaed480":1,"0x2ebec916":1,"0x2f54bf6e":1,"0x303017bd":1,"0x30301aa0":1,"0x303029ef":1,"0x30302bee":1,"0x30303614":1,"0x30303a3d":1,"0x30303c6a":1,"0x30303c