From 37b2d02cc7b843b426c26c90e26402cd7104c595 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Fri, 11 Sep 2020 18:55:33 +0200 Subject: [PATCH 1/7] eth/tracers: share tx gas price with js tracer --- eth/api_tracer.go | 2 +- eth/tracers/internal/tracers/assets.go | 195 +++++++----------- .../internal/tracers/prestate_tracer.js | 2 +- eth/tracers/tracer.go | 4 +- eth/tracers/tracer_test.go | 51 +++-- eth/tracers/tracers_test.go | 4 +- 6 files changed, 121 insertions(+), 137 deletions(-) diff --git a/eth/api_tracer.go b/eth/api_tracer.go index 2497c8d95ea0..06b9f1eb21a1 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -794,7 +794,7 @@ func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, v } } // Constuct the JavaScript tracer to execute with - if tracer, err = tracers.New(*config.Tracer); err != nil { + if tracer, err = tracers.New(*config.Tracer, vmctx); err != nil { return nil, err } // Handle timeouts and RPC cancellations diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index 432398ebb58e..4c2b6e08ab3c 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -1,21 +1,19 @@ -// Code generated by go-bindata. DO NOT EDIT. +// Code generated for package tracers by go-bindata DO NOT EDIT. (@generated) // sources: -// 4byte_tracer.js (2.933kB) -// bigram_tracer.js (1.712kB) -// call_tracer.js (8.956kB) -// evmdis_tracer.js (4.195kB) -// noop_tracer.js (1.271kB) -// opcount_tracer.js (1.372kB) -// prestate_tracer.js (4.234kB) -// trigram_tracer.js (1.788kB) -// unigram_tracer.js (1.51kB) - +// 4byte_tracer.js +// bigram_tracer.js +// call_tracer.js +// evmdis_tracer.js +// noop_tracer.js +// opcount_tracer.js +// prestate_tracer.js +// trigram_tracer.js +// unigram_tracer.js package tracers import ( "bytes" "compress/gzip" - "crypto/sha256" "fmt" "io" "io/ioutil" @@ -28,7 +26,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer @@ -36,7 +34,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %v", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err @@ -46,9 +44,8 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte + bytes []byte + info os.FileInfo } type bindataFileInfo struct { @@ -58,21 +55,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return false + return fi.mode&os.ModeDir != 0 } + +// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -92,8 +100,8 @@ func _4byte_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "4byte_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xc5, 0x48, 0x2d, 0xd9, 0x43, 0x95, 0x93, 0x3b, 0x93, 0x2c, 0x47, 0x8c, 0x84, 0x32, 0x3c, 0x8b, 0x2e, 0xf3, 0x72, 0xc4, 0x57, 0xe6, 0x3a, 0xb3, 0xdf, 0x1d, 0xbf, 0x45, 0x3, 0xfc, 0xa}} + info := bindataFileInfo{name: "4byte_tracer.js", size: 2933, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -112,8 +120,8 @@ func bigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "bigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6c, 0xd, 0x24, 0xf2, 0x49, 0xbd, 0x58, 0x8b, 0xb5, 0xd1, 0xc9, 0xcd, 0xcf, 0x5b, 0x3e, 0x5c, 0xfb, 0x14, 0x50, 0xe7, 0xe3, 0xb9, 0xd1, 0x54, 0x69, 0xe6, 0x5e, 0x45, 0xa6, 0x2c, 0x6c}} + info := bindataFileInfo{name: "bigram_tracer.js", size: 1712, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -132,8 +140,8 @@ func call_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "call_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x79, 0xb6, 0xbc, 0xd2, 0xc, 0x25, 0xb1, 0x22, 0x56, 0xef, 0x77, 0xb9, 0x5e, 0x2e, 0xf4, 0xda, 0xb2, 0x2f, 0x53, 0xa4, 0xff, 0xc8, 0xac, 0xbb, 0x75, 0x22, 0x46, 0x59, 0xe3, 0x1d, 0x7d}} + info := bindataFileInfo{name: "call_tracer.js", size: 8956, mode: os.FileMode(436), modTime: time.Unix(1600695632, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -152,8 +160,8 @@ func evmdis_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "evmdis_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0xc8, 0x73, 0x8e, 0xfb, 0x1f, 0x84, 0x7d, 0x37, 0xd9, 0x26, 0x24, 0x37, 0xb8, 0x65, 0xb1, 0xed, 0xa0, 0x76, 0x9a, 0xf0, 0x8e, 0x3a, 0x9b, 0x20, 0x93, 0x27, 0x26, 0x2e, 0xc9, 0x9b, 0xde}} + info := bindataFileInfo{name: "evmdis_tracer.js", size: 4195, mode: os.FileMode(436), modTime: time.Unix(1580938327, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -172,8 +180,8 @@ func noop_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "noop_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xf, 0x1c, 0x6f, 0x65, 0xaf, 0x90, 0x31, 0xab, 0xf, 0xe0, 0xca, 0x54, 0x7, 0xfd, 0xd3, 0xa1, 0x4a, 0x14, 0x1, 0x2a, 0x9d, 0xdc, 0xb9, 0x64, 0x69, 0x83, 0x30, 0xb1, 0x2a, 0xbd, 0xfb}} + info := bindataFileInfo{name: "noop_tracer.js", size: 1271, mode: os.FileMode(436), modTime: time.Unix(1561974705, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -192,12 +200,12 @@ func opcount_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "opcount_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x27, 0xe, 0x97, 0x88, 0x9b, 0x53, 0xbb, 0x20, 0x44, 0xd8, 0xf5, 0xeb, 0x41, 0xd2, 0x7e, 0xd6, 0xda, 0x6b, 0xf5, 0xaf, 0x0, 0x75, 0x9f, 0xd9, 0x22, 0xc, 0x6e, 0x74, 0xac, 0x2a, 0xa9, 0xa7}} + info := bindataFileInfo{name: "opcount_tracer.js", size: 1372, mode: os.FileMode(420), modTime: time.Unix(1533483854, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } -var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\x96\xfe\x8a\x41\x5f\x6c\xa3\xae\xdc\x64\x81\x3d\xc0\xb9\x1c\xa0\xba\x6e\x1b\x20\x9b\x04\xb6\x7b\xb9\xdc\x62\x1f\x28\x72\x24\x73\x4d\x93\x02\x49\xd9\xf1\x15\xf9\xdf\x0f\x43\x7d\xf8\xa3\x49\xd3\xdd\x37\x9b\x1c\xfe\xe6\xfb\x37\xa3\xd1\x08\x26\xa6\xdc\x59\x59\x2c\x3d\x9c\xbf\x3f\xfb\x07\x2c\x96\x08\x85\x79\x87\x7e\x89\x16\xab\x35\xa4\x95\x5f\x1a\xeb\xe2\xd1\x08\x16\x4b\xe9\x20\x97\x0a\x41\x3a\x28\x99\xf5\x60\x72\xf0\x27\xf2\x4a\x66\x96\xd9\x5d\x12\x8f\x46\xf5\x9b\x67\xaf\x09\x21\xb7\x88\xe0\x4c\xee\xb7\xcc\xe2\x18\x76\xa6\x02\xce\x34\x58\x14\xd2\x79\x2b\xb3\xca\x23\x48\x0f\x4c\x8b\x91\xb1\xb0\x36\x42\xe6\x3b\x82\x94\x1e\x2a\x2d\xd0\x06\xd5\x1e\xed\xda\xb5\x76\x7c\xbe\xf9\x0a\xd7\xe8\x1c\x5a\xf8\x8c\x1a\x2d\x53\x70\x57\x65\x4a\x72\xb8\x96\x1c\xb5\x43\x60\x0e\x4a\x3a\x71\x4b\x14\x90\x05\x38\x7a\xf8\x89\x4c\x99\x37\xa6\xc0\x27\x53\x69\xc1\xbc\x34\x7a\x08\x28\xc9\x72\xd8\xa0\x75\xd2\x68\xf8\xa5\x55\xd5\x00\x0e\xc1\x58\x02\xe9\x33\x4f\x0e\x58\x30\x25\xbd\x1b\x00\xd3\x3b\x50\xcc\xef\x9f\xfe\x44\x40\xf6\x7e\x0b\x90\x3a\xa8\x59\x9a\x12\xc1\x2f\x99\x27\xaf\xb7\x52\x29\xc8\x10\x2a\x87\x79\xa5\x86\x84\x96\x55\x1e\xee\xaf\x16\x5f\x6e\xbf\x2e\x20\xbd\x79\x80\xfb\x74\x36\x4b\x6f\x16\x0f\x17\xb0\x95\x7e\x69\x2a\x0f\xb8\xc1\x1a\x4a\xae\x4b\x25\x51\xc0\x96\x59\xcb\xb4\xdf\x81\xc9\x09\xe1\xb7\xe9\x6c\xf2\x25\xbd\x59\xa4\x1f\xae\xae\xaf\x16\x0f\x60\x2c\x7c\xba\x5a\xdc\x4c\xe7\x73\xf8\x74\x3b\x83\x14\xee\xd2\xd9\xe2\x6a\xf2\xf5\x3a\x9d\xc1\xdd\xd7\xd9\xdd\xed\x7c\x9a\xc0\x1c\xc9\x2a\xa4\xf7\xaf\xc7\x3c\x0f\xd9\xb3\x08\x02\x3d\x93\xca\xb5\x91\x78\x30\x15\xb8\xa5\xa9\x94\x80\x25\xdb\x20\x58\xe4\x28\x37\x28\x80\x01\x37\xe5\xee\xa7\x93\x4a\x58\x4c\x19\x5d\x04\x9f\x5f\x2c\x48\xb8\xca\x41\x1b\x3f\x04\x87\x08\xff\x5c\x7a\x5f\x8e\x47\xa3\xed\x76\x9b\x14\xba\x4a\x8c\x2d\x46\xaa\x86\x73\xa3\x7f\x25\x31\x61\x96\x16\x9d\x67\x1e\x17\x96\x71\xb4\x60\x2a\x5f\x56\xde\x81\xab\xf2\x5c\x72\x89\xda\x83\xd4\xb9\xb1\xeb\x50\x29\xe0\x0d\x70\x8b\xcc\x23\x30\x50\x86\x33\x05\xf8\x88\xbc\x0a\x77\x75\xa4\x43\xb9\x5a\xa6\x1d\xe3\xe1\x34\xb7\x66\x4d\xbe\x56\xce\xd3\x0f\xe7\x70\x9d\x29\x14\x50\xa0\x46\x27\x1d\x64\xca\xf0\x55\x12\x7f\x8b\xa3\x03\x63\xa8\x4e\x82\x87\x8d\x50\xa8\x8d\x2d\xf6\x2c\x42\x56\x49\x25\xa4\x2e\x92\x38\x6a\xa5\xc7\xa0\x2b\xa5\x86\x71\x80\x50\xc6\xac\xaa\x32\xe5\xdc\x54\xc1\xf6\x3f\x91\xfb\x1a\xcc\x95\xc8\x65\x4e\xc5\xc1\xba\x5b\x6f\xc2\x55\xa7\xd7\x64\x24\x9f\xc4\xd1\x11\xcc\x18\xf2\x4a\x07\x77\xfa\x4c\x08\x3b\x04\x91\x0d\xbe\xc5\x51\xb4\x61\x96\xb0\xe0\x12\xbc\xf9\x82\x8f\xe1\x72\x70\x11\x47\x91\xcc\xa1\xef\x97\xd2\x25\x2d\xf0\xef\x8c\xf3\x3f\xe0\xf2\xf2\x32\x34\x75\x2e\x35\x8a\x01\x10\x44\xf4\x9c\x58\x7d\x13\x65\x4c\x31\xcd\x71\x0c\xbd\xf7\x8f\x3d\x78\x0b\x22\x4b\x0a\xf4\x1f\xea\xd3\x5a\x59\xe2\xcd\xdc\x5b\xa9\x8b\xfe\xd9\xaf\x83\x61\x78\xa5\x4d\x78\x03\x8d\xf8\x8d\xe9\x84\xeb\x7b\x6e\x44\xb8\x6e\x6c\xae\xa5\x26\x46\x34\x42\x8d\x94\xf3\xc6\xb2\x02\xc7\xf0\xed\x89\xfe\x3f\x91\x57\x4f\x71\xf4\x74\x14\xe5\x79\x2d\xf4\x42\x94\x1b\x08\x40\xed\x6d\x57\xe7\x85\xa4\x4e\x3d\x4c\x40\xc0\xfb\x51\x12\xe6\xad\x29\x27\x49\x58\xe1\xee\xf5\x4c\xd0\x85\x14\x8f\xdd\xc5\x0a\x77\x83\x8b\xf8\xc5\x14\x25\x8d\xd1\xbf\x4b\xf1\xf8\xb3\xf9\x3a\x79\x73\x14\xd7\x39\x49\xed\xed\x1d\x0c\x4e\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x36\x4c\x55\xd8\xab\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\xc7\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\x0f\x4c\xc1\x25\x64\xb2\xb8\xd2\xfe\x24\x79\x75\xd0\xdb\xa7\x83\x3f\x92\xa6\x79\x12\x47\x84\xd7\x3f\x1f\x0c\xe1\xec\xd7\xae\x22\xbc\x21\x28\x78\x1d\xcc\x9b\x97\xa1\xe2\xd3\x62\x78\xfe\x59\x50\x43\x1d\xfc\x36\x68\x4d\x5c\x95\x51\x3a\x6a\x3f\x43\x1c\x8f\xbb\xf8\xe2\x07\xb8\xc7\xbe\xb5\xb8\x4d\x68\x12\x26\xc4\xcb\xa0\x75\x8a\x3e\x22\xb7\xb8\x26\x56\xa7\x2c\x70\xa6\x14\xda\x9e\x83\xc0\x19\xc3\xa6\x9c\x42\xbe\x70\x5d\xfa\x5d\xcb\xf5\x9e\xd9\x02\xbd\x7b\xdd\xb0\x80\xf3\xee\x5d\x4b\x81\x21\x14\xbb\x12\xe1\xf2\x12\x7a\x93\xd9\x34\x5d\x4c\x7b\x4d\x1b\x8d\x46\x70\x8f\x61\x13\xca\x94\xcc\x84\xda\x81\x40\x85\x1e\x6b\xbb\x8c\x0e\x21\xea\x28\x61\x48\x2b\x0d\x2d\x1b\xf8\x28\x9d\x97\xba\x80\x9a\x29\xb6\x34\x57\x1b\xb8\xd0\x23\x9c\x55\x8e\xaa\xf5\x64\x08\x79\x43\x1b\x85\x45\xe2\x15\xe2\xff\xd0\x6e\x4c\xc9\x6e\x03\xc9\xa5\x75\x1e\x4a\xc5\x38\x26\x84\xd7\x19\xf3\x72\x7e\x9b\x4e\x26\xd5\xb3\xd0\x82\x01\x68\x3f\xe0\x98\xa2\x01\x49\xea\x1d\xf4\x5b\x8c\x41\x1c\x45\xb6\x95\x3e\xc0\xbe\xd8\x53\x82\xf3\x58\x1e\x12\x02\x2d\x16\xb8\x41\xa2\xd0\xc0\x06\xf5\x30\x24\x5d\xff\xfe\xad\x99\xbe\xe8\x92\x38\xa2\x77\x07\x7d\xad\x4c\x71\xdc\xd7\xa2\x0e\x0b\xaf\xac\xa5\xfc\x77\x14\x9c\x53\x8f\xff\x59\x39\x4f\x31\xb5\x14\x9e\x86\x2d\x9e\x23\xc9\x40\x89\x34\x6d\x07\xdf\x93\x21\xcd\xad\x30\x27\x48\x5d\x33\xa5\xea\x6d\xae\x34\x1e\xb5\x97\x4c\xa9\x1d\xe5\x61\x6b\x69\x8d\xa1\xc5\x65\x08\x4e\x92\x54\x60\x9c\x20\x2a\x35\x57\x95\xa8\xcb\x20\xd4\x71\x83\xe7\x82\xcd\xc7\xfb\xcf\x1a\x9d\x63\x05\x26\x54\x49\xb9\x7c\x6c\x36\x48\x0d\xbd\x9a\xe4\xfa\x83\x5e\xd2\x19\x79\x4c\x31\xca\x14\x49\x5b\x64\x44\xd3\xa9\x10\x16\x9d\xeb\x0f\x1a\xce\xe9\x32\x7b\xbf\x44\x4d\xc1\x07\x8d\x5b\xe8\x56\x13\xc6\x39\xad\x6a\x62\x08\x4c\x08\xa2\xb6\x93\x35\x22\x8e\x22\xb7\x95\x9e\x2f\x21\x68\x32\xe5\xbe\x17\x07\x4d\xfd\x73\xe6\x10\xde\x4c\xff\xb3\x98\xdc\x7e\x9c\x4e\x6e\xef\x1e\xde\x8c\xe1\xe8\x6c\x7e\xf5\xdf\x69\x77\xf6\x21\xbd\x4e\x6f\x26\xd3\x37\xe3\x30\x9b\x9f\x71\xc8\x9b\xd6\x05\x52\xe8\x3c\xe3\xab\xa4\x44\x5c\xf5\xdf\x1f\xf3\xc0\xde\xc1\x28\xca\x2c\xb2\xd5\xc5\xde\x98\xba\x41\x1b\x1d\x2d\xe5\xc2\x25\xbc\x18\xac\x8b\x97\xad\x99\x34\xf2\xfd\x96\xc8\xf7\xab\x48\xa0\x8a\xd7\xed\x38\xff\xcb\x86\x84\xde\x61\x7c\x35\x06\xc7\x14\x6d\xc0\xf2\x7f\xf4\xe5\x92\xe7\x0e\xfd\x10\x50\x0b\xb3\x25\xe6\xeb\x50\xeb\x9b\x06\xf7\x20\x64\x67\x83\x9a\x41\x6f\xf3\xfe\xa0\x13\x26\xb0\xef\x45\xcf\x9f\x13\x45\x2d\xe0\xb2\x45\x7f\x1b\x5e\xbe\x1e\xa8\xf3\x26\x52\x27\x0a\x7e\x39\xd9\xf0\xc2\xfd\x1a\xd7\xc6\xee\x9a\x71\x74\xe0\xdf\x8f\xa3\x9a\x5e\x5f\x77\xf5\x44\x7f\xa8\xc8\xba\x83\x8f\xd3\xeb\xe9\xe7\x74\x31\x3d\x92\x9a\x2f\xd2\xc5\xd5\xa4\x3e\xfa\xcb\x85\x77\xf6\xd3\x85\xd7\x9b\xcf\x17\xb7\xb3\x69\x6f\xdc\xfc\xbb\xbe\x4d\x3f\xf6\xbe\x53\xd8\x6c\x81\x3f\x6a\x5d\x6f\xee\x8d\x15\x7f\xa7\x03\x0e\x36\xb2\x9c\x3d\xb7\x90\x05\x6a\xe7\xbe\x3a\xf9\xe0\x01\xa6\x5b\x56\xce\xeb\x8f\xbe\x28\xbc\x7f\x96\x87\x9f\xe2\xa7\xf8\xff\x01\x00\x00\xff\xff\xb1\x28\x85\x2a\x8a\x10\x00\x00") +var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\x96\xfe\x8a\x41\x5f\x6c\x5f\x5d\x39\xc9\x02\x7b\x80\x73\x39\x40\x75\xdd\x36\x40\x36\x09\x6c\xf7\x7a\xb9\xc5\x3e\x50\xe4\x48\xe6\x9a\x26\x05\x92\xb2\xe3\x2b\xf2\xbf\x1f\x86\xfa\xf0\x47\x93\xa6\x7b\x6f\x16\x39\xfc\xcd\xf7\x6f\xc6\xa3\x11\x4c\x4c\xb9\xb3\xb2\x58\x7a\xb8\x38\x3b\xff\x3b\x2c\x96\x08\x85\x79\x87\x7e\x89\x16\xab\x35\xa4\x95\x5f\x1a\xeb\xe2\xd1\x08\x16\x4b\xe9\x20\x97\x0a\x41\x3a\x28\x99\xf5\x60\x72\xf0\x27\xf2\x4a\x66\x96\xd9\x5d\x12\x8f\x46\xf5\x9b\x67\xaf\x09\x21\xb7\x88\xe0\x4c\xee\xb7\xcc\xe2\x18\x76\xa6\x02\xce\x34\x58\x14\xd2\x79\x2b\xb3\xca\x23\x48\x0f\x4c\x8b\x91\xb1\xb0\x36\x42\xe6\x3b\x82\x94\x1e\x2a\x2d\xd0\x06\xd5\x1e\xed\xda\xb5\x76\x7c\xba\xfd\x02\x37\xe8\x1c\x5a\xf8\x84\x1a\x2d\x53\x70\x5f\x65\x4a\x72\xb8\x91\x1c\xb5\x43\x60\x0e\x4a\x3a\x71\x4b\x14\x90\x05\x38\x7a\xf8\x91\x4c\x99\x37\xa6\xc0\x47\x53\x69\xc1\xbc\x34\x7a\x08\x28\xc9\x72\xd8\xa0\x75\xd2\x68\xf8\xa5\x55\xd5\x00\x0e\xc1\x58\x02\xe9\x33\x4f\x0e\x58\x30\x25\xbd\x1b\x00\xd3\x3b\x50\xcc\xef\x9f\xfe\x44\x40\xf6\x7e\x0b\x90\x3a\xa8\x59\x9a\x12\xc1\x2f\x99\x27\xaf\xb7\x52\x29\xc8\x10\x2a\x87\x79\xa5\x86\x84\x96\x55\x1e\xbe\x5e\x2f\x3e\xdf\x7d\x59\x40\x7a\xfb\x00\x5f\xd3\xd9\x2c\xbd\x5d\x3c\x5c\xc2\x56\xfa\xa5\xa9\x3c\xe0\x06\x6b\x28\xb9\x2e\x95\x44\x01\x5b\x66\x2d\xd3\x7e\x07\x26\x27\x84\xdf\xa6\xb3\xc9\xe7\xf4\x76\x91\xbe\xbf\xbe\xb9\x5e\x3c\x80\xb1\xf0\xf1\x7a\x71\x3b\x9d\xcf\xe1\xe3\xdd\x0c\x52\xb8\x4f\x67\x8b\xeb\xc9\x97\x9b\x74\x06\xf7\x5f\x66\xf7\x77\xf3\x69\x02\x73\x24\xab\x90\xde\xbf\x1e\xf3\x3c\x64\xcf\x22\x08\xf4\x4c\x2a\xd7\x46\xe2\xc1\x54\xe0\x96\xa6\x52\x02\x96\x6c\x83\x60\x91\xa3\xdc\xa0\x00\x06\xdc\x94\xbb\x9f\x4e\x2a\x61\x31\x65\x74\x11\x7c\x7e\xb1\x20\xe1\x3a\x07\x6d\xfc\x10\x1c\x22\xfc\x63\xe9\x7d\x39\x1e\x8d\xb6\xdb\x6d\x52\xe8\x2a\x31\xb6\x18\xa9\x1a\xce\x8d\xfe\x99\xc4\x84\x59\x5a\x74\x9e\x79\x5c\x58\xc6\xd1\x82\xa9\x7c\x59\x79\x07\xae\xca\x73\xc9\x25\x6a\x0f\x52\xe7\xc6\xae\x43\xa5\x80\x37\xc0\x2d\x32\x8f\xc0\x40\x19\xce\x14\xe0\x23\xf2\x2a\xdc\xd5\x91\x0e\xe5\x6a\x99\x76\x8c\x87\xd3\xdc\x9a\x35\xf9\x5a\x39\x4f\x3f\x9c\xc3\x75\xa6\x50\x40\x81\x1a\x9d\x74\x90\x29\xc3\x57\x49\xfc\x2d\x8e\x0e\x8c\xa1\x3a\x09\x1e\x36\x42\xa1\x36\xb6\xd8\xb3\x08\x59\x25\x95\x90\xba\x48\xe2\xa8\x95\x1e\x83\xae\x94\x1a\xc6\x01\x42\x19\xb3\xaa\xca\x94\x73\x53\x05\xdb\xff\x44\xee\x6b\x30\x57\x22\x97\x39\x15\x07\xeb\x6e\xbd\x09\x57\x9d\x5e\x93\x91\x7c\x12\x47\x47\x30\x63\xc8\x2b\x1d\xdc\xe9\x33\x21\xec\x10\x44\x36\xf8\x16\x47\xd1\x86\x59\xc2\x82\x2b\xf0\xe6\x33\x3e\x86\xcb\xc1\x65\x1c\x45\x32\x87\xbe\x5f\x4a\x97\xb4\xc0\xbf\x33\xce\xff\x80\xab\xab\xab\xd0\xd4\xb9\xd4\x28\x06\x40\x10\xd1\x73\x62\xf5\x4d\x94\x31\xc5\x34\xc7\x31\xf4\xce\x1e\x7b\xf0\x16\x44\x96\x14\xe8\xdf\xd7\xa7\xb5\xb2\xc4\x9b\xb9\xb7\x52\x17\xfd\xf3\x5f\x07\xc3\xf0\x4a\x9b\xf0\x06\x1a\xf1\x5b\xd3\x09\xd7\xf7\xdc\x88\x70\xdd\xd8\x5c\x4b\x4d\x8c\x68\x84\x1a\x29\xe7\x8d\x65\x05\x8e\xe1\xdb\x13\x7d\x3f\x91\x57\x4f\x71\xf4\x74\x14\xe5\x79\x2d\xf4\x42\x94\x1b\x08\x40\xed\x6d\x57\xe7\x85\xa4\x4e\x3d\x4c\x40\xc0\xfb\x51\x12\xe6\xad\x29\x27\x49\x58\xe1\xee\xf5\x4c\xd0\x85\x14\x8f\xdd\xc5\x0a\x77\x83\xcb\xf8\xc5\x14\x25\x8d\xd1\xbf\x4b\xf1\xf8\xb3\xf9\x3a\x79\x73\x14\xd7\x39\x49\xed\xed\x1d\x0c\x4e\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x36\x4c\x55\xd8\xab\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\xc7\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\xf7\x4c\xc1\x15\x64\xb2\xb8\xd6\xfe\x24\x79\x75\xd0\xdb\xa7\x83\x3f\x92\xa6\x79\x12\x47\x84\xd7\xbf\x18\x0c\xe1\xfc\xd7\xae\x22\xbc\x21\x28\x78\x1d\xcc\x9b\x97\xa1\xe2\xd3\x62\x78\xfe\x59\x50\x43\x1d\xfc\x36\x68\x4d\x5c\x95\x51\x3a\x6a\x3f\x43\x1c\x8f\xbb\xf8\xf2\x07\xb8\xc7\xbe\xb5\xb8\x4d\x68\x12\x26\xc4\x21\x28\x7d\x5e\x9c\x9f\x9d\x9d\xc1\xdf\x80\x8e\x0b\xe6\xee\xad\xe4\xdf\xa9\xab\x93\xf7\x01\xb9\xc5\x35\xf1\x3d\xe5\x87\x33\xa5\xd0\xf6\x1c\x04\x36\x19\x36\x85\x16\x32\x89\xeb\xd2\xef\xda\x29\xe0\x99\x2d\xd0\xbb\xd7\x4d\x0e\x38\xef\xde\xb5\xe4\x18\x82\xb4\x2b\x11\xae\xae\xa0\x37\x99\x4d\xd3\xc5\xb4\xd7\x34\xd8\x68\x04\x5f\x31\xec\x48\x99\x92\x99\x50\x3b\x10\xa8\xd0\x63\x6d\x97\xd1\x21\x78\x1d\x59\x0c\x69\xd9\xa1\x35\x04\x1f\xa5\xf3\x52\x17\x50\x73\xc8\x96\x26\x6e\x03\x17\xba\x87\xb3\xca\x51\x1d\x9f\x8c\x27\x6f\x68\xd7\xb0\x48\x8c\x43\x93\x21\x34\x22\x53\xb2\xdb\x4d\x72\x69\x9d\x87\x52\x31\x8e\x09\xe1\x75\xc6\xbc\x9c\xf9\xa6\xc7\x49\xf5\x2c\x34\x67\x00\xda\x8f\x3e\xa6\x68\x74\x92\x7a\x07\xfd\x16\x63\x10\x47\x91\x6d\xa5\x0f\xb0\x2f\xf7\x64\xe1\x3c\x96\x87\x54\x41\x2b\x07\x6e\x90\xc8\x35\xf0\x44\x3d\x26\x49\xd7\xbf\x7e\x6b\xe6\x32\xba\x24\x8e\xe8\xdd\x41\xc7\x2b\x53\x1c\x77\xbc\xa8\xc3\xc2\x2b\x6b\x29\xff\x1d\x39\xe7\xd4\xfd\x7f\x56\xce\x53\x4c\x2d\x85\xa7\xe1\x91\xe7\xe8\x33\x90\x25\xcd\xe1\xc1\xf7\x34\x49\x13\x2d\x4c\x10\x52\xd7\xcc\xaf\x7a\xcf\x2b\x8d\x47\xed\x25\x53\x6a\x47\x79\xd8\x5a\x5a\x70\x68\xa5\x19\x82\x93\x24\x15\xb8\x28\x88\x4a\xcd\x55\x25\xea\x32\x08\x15\xde\xe0\xb9\x60\xf3\xf1\x66\xb4\x46\xe7\x58\x81\x09\x55\x52\x2e\x1f\x9b\xdd\x52\x43\xaf\xa6\xbf\xfe\xa0\x97\x74\x46\x1e\x93\x8f\x32\x45\xd2\x16\x19\x11\x78\x2a\x84\x45\xe7\xfa\x83\x86\x8d\xba\xcc\x7e\x5d\xa2\xa6\xe0\x83\xc6\x2d\x74\x4b\x0b\xe3\x9c\x96\x38\x31\x04\x26\x04\x91\xde\xc9\x82\x11\x47\x91\xdb\x4a\xcf\x97\x10\x34\x99\x72\xdf\x8b\x83\xa6\xfe\x39\x73\x08\x6f\xa6\xff\x5e\x4c\xee\x3e\x4c\x27\x77\xf7\x0f\x6f\xc6\x70\x74\x36\xbf\xfe\xcf\xb4\x3b\x7b\x9f\xde\xa4\xb7\x93\xe9\x9b\x71\x98\xda\xcf\x38\xe4\x4d\xeb\x02\x29\x74\x9e\xf1\x55\x52\x22\xae\xfa\x67\xc7\x3c\xb0\x77\x30\x8a\x32\x8b\x6c\x75\xb9\x37\xa6\x6e\xd0\x46\x47\x4b\xc6\x70\x05\x2f\x06\xeb\xf2\x65\x6b\x26\x8d\x7c\xbf\xa5\xf8\xfd\x92\x12\xa8\xe2\x75\x3b\x2e\xfe\xb2\x21\xa1\x77\x18\x5f\x8d\xc1\x31\x45\xbb\xb1\xfc\x2f\xfd\xa7\xc9\x73\x87\x7e\x08\xa8\x85\xd9\x12\xf3\x75\xa8\xf5\x4d\x83\x7b\x10\xb2\xf3\x41\xcd\xad\x77\x79\x7f\xd0\x09\x13\xd8\xf7\xa2\x17\xcf\x89\xa2\x16\x70\xd5\xa2\xbf\x0d\x2f\x5f\x0f\xd4\x45\x13\xa9\x13\x05\xbf\x9c\xec\x7e\xe1\x7e\x8d\x6b\x63\x77\xcd\xa0\x3a\xf0\xef\xc7\x51\x4d\x6f\x6e\xba\x7a\xa2\x0f\x2a\xb2\xee\xe0\xc3\xf4\x66\xfa\x29\x5d\x4c\x8f\xa4\xe6\x8b\x74\x71\x3d\xa9\x8f\xfe\x72\xe1\x9d\xff\x74\xe1\xf5\xe6\xf3\xc5\xdd\x6c\xda\x1b\x37\x5f\x37\x77\xe9\x87\xde\x77\x0a\x9b\xfd\xf0\x47\xad\xeb\xcd\x57\x63\xc5\xff\xd3\x01\x07\xbb\x5a\xce\x9e\x5b\xd5\x02\xb5\x73\x5f\x9d\xfc\x15\x02\xa6\x5b\x56\xce\xeb\xbf\x83\x51\x78\xff\x2c\x0f\x3f\xc5\x4f\xf1\xff\x02\x00\x00\xff\xff\xca\x4d\x6e\xf4\xa4\x10\x00\x00") func prestate_tracerJsBytes() ([]byte, error) { return bindataRead( @@ -212,8 +220,8 @@ func prestate_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe9, 0x79, 0x70, 0x4f, 0xc5, 0x78, 0x57, 0x63, 0x6f, 0x5, 0x31, 0xce, 0x3e, 0x5d, 0xbd, 0x71, 0x4, 0x46, 0x78, 0xcd, 0x1d, 0xcd, 0xb9, 0xd8, 0x10, 0xff, 0xe6, 0xc5, 0x59, 0xb9, 0x25, 0x6e}} + info := bindataFileInfo{name: "prestate_tracer.js", size: 4260, mode: os.FileMode(436), modTime: time.Unix(1600695632, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -232,8 +240,8 @@ func trigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "trigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x40, 0x63, 0xe1, 0x42, 0x60, 0x7, 0x1b, 0x79, 0x47, 0x1, 0xa1, 0xbf, 0xc4, 0x66, 0x19, 0x9b, 0x2b, 0x5a, 0x1f, 0x82, 0x3d, 0xcf, 0xee, 0xe7, 0x60, 0x25, 0x2c, 0x4f, 0x13, 0x97, 0xc7, 0x18}} + info := bindataFileInfo{name: "trigram_tracer.js", size: 1788, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -252,8 +260,8 @@ func unigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "unigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2f, 0x36, 0x14, 0xc2, 0xf6, 0xc3, 0x80, 0x2b, 0x4a, 0x11, 0x7d, 0xd5, 0x3e, 0xef, 0x23, 0xb5, 0xd6, 0xe6, 0xe6, 0x5, 0x41, 0xf6, 0x14, 0x7a, 0x39, 0xf7, 0xf8, 0xac, 0x89, 0x8e, 0x43, 0xe6}} + info := bindataFileInfo{name: "unigram_tracer.js", size: 1510, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -261,8 +269,8 @@ func unigram_tracerJs() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -272,12 +280,6 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -289,18 +291,12 @@ func MustAsset(name string) []byte { return a } -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -310,33 +306,6 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -348,23 +317,15 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "4byte_tracer.js": _4byte_tracerJs, - - "bigram_tracer.js": bigram_tracerJs, - - "call_tracer.js": call_tracerJs, - - "evmdis_tracer.js": evmdis_tracerJs, - - "noop_tracer.js": noop_tracerJs, - - "opcount_tracer.js": opcount_tracerJs, - + "4byte_tracer.js": _4byte_tracerJs, + "bigram_tracer.js": bigram_tracerJs, + "call_tracer.js": call_tracerJs, + "evmdis_tracer.js": evmdis_tracerJs, + "noop_tracer.js": noop_tracerJs, + "opcount_tracer.js": opcount_tracerJs, "prestate_tracer.js": prestate_tracerJs, - - "trigram_tracer.js": trigram_tracerJs, - - "unigram_tracer.js": unigram_tracerJs, + "trigram_tracer.js": trigram_tracerJs, + "unigram_tracer.js": unigram_tracerJs, } // AssetDir returns the file names below a certain @@ -376,15 +337,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -408,18 +369,18 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "4byte_tracer.js": {_4byte_tracerJs, map[string]*bintree{}}, - "bigram_tracer.js": {bigram_tracerJs, map[string]*bintree{}}, - "call_tracer.js": {call_tracerJs, map[string]*bintree{}}, - "evmdis_tracer.js": {evmdis_tracerJs, map[string]*bintree{}}, - "noop_tracer.js": {noop_tracerJs, map[string]*bintree{}}, - "opcount_tracer.js": {opcount_tracerJs, map[string]*bintree{}}, - "prestate_tracer.js": {prestate_tracerJs, map[string]*bintree{}}, - "trigram_tracer.js": {trigram_tracerJs, map[string]*bintree{}}, - "unigram_tracer.js": {unigram_tracerJs, map[string]*bintree{}}, + "4byte_tracer.js": &bintree{_4byte_tracerJs, map[string]*bintree{}}, + "bigram_tracer.js": &bintree{bigram_tracerJs, map[string]*bintree{}}, + "call_tracer.js": &bintree{call_tracerJs, map[string]*bintree{}}, + "evmdis_tracer.js": &bintree{evmdis_tracerJs, map[string]*bintree{}}, + "noop_tracer.js": &bintree{noop_tracerJs, map[string]*bintree{}}, + "opcount_tracer.js": &bintree{opcount_tracerJs, map[string]*bintree{}}, + "prestate_tracer.js": &bintree{prestate_tracerJs, map[string]*bintree{}}, + "trigram_tracer.js": &bintree{trigram_tracerJs, map[string]*bintree{}}, + "unigram_tracer.js": &bintree{unigram_tracerJs, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory. +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -437,10 +398,14 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// RestoreAssets restores an asset under the given directory recursively. +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -458,6 +423,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } diff --git a/eth/tracers/internal/tracers/prestate_tracer.js b/eth/tracers/internal/tracers/prestate_tracer.js index e0a22bf157d3..1b5d395644a2 100644 --- a/eth/tracers/internal/tracers/prestate_tracer.js +++ b/eth/tracers/internal/tracers/prestate_tracer.js @@ -55,7 +55,7 @@ var toBal = bigInt(this.prestate[toHex(ctx.to)].balance.slice(2), 16); this.prestate[toHex(ctx.to)].balance = '0x'+toBal.subtract(ctx.value).toString(16); - this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).toString(16); + this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).add(21000 * ctx.gasPrice).toString(16); // Decrement the caller's nonce, and remove empty create targets this.prestate[toHex(ctx.from)].nonce--; diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index 5d806d9026d6..f299e560deff 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -316,7 +316,7 @@ type Tracer struct { // New instantiates a new tracer instance. code specifies a Javascript snippet, // which must evaluate to an expression returning an object with 'step', 'fault' // and 'result' functions. -func New(code string) (*Tracer, error) { +func New(code string, txCtx vm.TxContext) (*Tracer, error) { // Resolve any tracers by name and assemble the tracer object if tracer, ok := tracer(code); ok { code = tracer @@ -335,6 +335,8 @@ func New(code string) (*Tracer, error) { depthValue: new(uint), refundValue: new(uint), } + tracer.ctx["gasPrice"] = txCtx.GasPrice + // Set up builtins for this environment tracer.vm.PushGlobalGoFunction("toHex", func(ctx *duktape.Context) int { ctx.PushString(hexutil.Encode(popSlice(ctx))) diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index 554b2282f149..c619b026f9f9 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -50,8 +50,17 @@ type dummyStatedb struct { func (*dummyStatedb) GetRefund() uint64 { return 1337 } -func runTrace(tracer *Tracer) (json.RawMessage, error) { - env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) +type VMContext struct { + blockCtx vm.BlockContext + txCtx vm.TxContext +} + +func vmContext() VMContext { + return VMContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1)}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}} +} + +func runTrace(tracer *Tracer, vmctx VMContext) (json.RawMessage, error) { + env := vm.NewEVM(vmctx.blockCtx, vmctx.txCtx, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000) contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0} @@ -65,44 +74,48 @@ func runTrace(tracer *Tracer) (json.RawMessage, error) { // TestRegressionPanicSlice tests that we don't panic on bad arguments to memory access func TestRegressionPanicSlice(t *testing.T) { - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}") + vmctx := vmContext() + tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - if _, err = runTrace(tracer); err != nil { + if _, err = runTrace(tracer, vmctx); err != nil { t.Fatal(err) } } // TestRegressionPanicSlice tests that we don't panic on bad arguments to stack peeks func TestRegressionPanicPeek(t *testing.T) { - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}") + vmctx := vmContext() + tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - if _, err = runTrace(tracer); err != nil { + if _, err = runTrace(tracer, vmctx); err != nil { t.Fatal(err) } } // TestRegressionPanicSlice tests that we don't panic on bad arguments to memory getUint func TestRegressionPanicGetUint(t *testing.T) { - tracer, err := New("{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}") + vmctx := vmContext() + tracer, err := New("{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - if _, err = runTrace(tracer); err != nil { + if _, err = runTrace(tracer, vmctx); err != nil { t.Fatal(err) } } func TestTracing(t *testing.T) { - tracer, err := New("{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}") + vmctx := vmContext() + tracer, err := New("{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - ret, err := runTrace(tracer) + ret, err := runTrace(tracer, vmctx) if err != nil { t.Fatal(err) } @@ -112,12 +125,13 @@ func TestTracing(t *testing.T) { } func TestStack(t *testing.T) { - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.length()); }, fault: function() {}, result: function() { return this.depths; }}") + vmctx := vmContext() + tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.length()); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - ret, err := runTrace(tracer) + ret, err := runTrace(tracer, vmctx) if err != nil { t.Fatal(err) } @@ -127,12 +141,13 @@ func TestStack(t *testing.T) { } func TestOpcodes(t *testing.T) { - tracer, err := New("{opcodes: [], step: function(log) { this.opcodes.push(log.op.toString()); }, fault: function() {}, result: function() { return this.opcodes; }}") + vmctx := vmContext() + tracer, err := New("{opcodes: [], step: function(log) { this.opcodes.push(log.op.toString()); }, fault: function() {}, result: function() { return this.opcodes; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } - ret, err := runTrace(tracer) + ret, err := runTrace(tracer, vmctx) if err != nil { t.Fatal(err) } @@ -145,7 +160,8 @@ func TestHalt(t *testing.T) { t.Skip("duktape doesn't support abortion") timeout := errors.New("stahp") - tracer, err := New("{step: function() { while(1); }, result: function() { return null; }}") + vmctx := vmContext() + tracer, err := New("{step: function() { while(1); }, result: function() { return null; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } @@ -155,13 +171,14 @@ func TestHalt(t *testing.T) { tracer.Stop(timeout) }() - if _, err = runTrace(tracer); err.Error() != "stahp in server-side tracer function 'step'" { + if _, err = runTrace(tracer, vmctx); err.Error() != "stahp in server-side tracer function 'step'" { t.Errorf("Expected timeout error, got %v", err) } } func TestHaltBetweenSteps(t *testing.T) { - tracer, err := New("{step: function() {}, fault: function() {}, result: function() { return null; }}") + vmctx := vmContext() + tracer, err := New("{step: function() {}, fault: function() {}, result: function() { return null; }}", vmctx.txCtx) if err != nil { t.Fatal(err) } diff --git a/eth/tracers/tracers_test.go b/eth/tracers/tracers_test.go index b749d832b48e..ee27e475cc43 100644 --- a/eth/tracers/tracers_test.go +++ b/eth/tracers/tracers_test.go @@ -173,7 +173,7 @@ func TestPrestateTracerCreate2(t *testing.T) { _, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), alloc, false) // Create the tracer, the EVM environment and run it - tracer, err := New("prestateTracer") + tracer, err := New("prestateTracer", context) if err != nil { t.Fatalf("failed to create call tracer: %v", err) } @@ -248,7 +248,7 @@ func TestCallTracer(t *testing.T) { _, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), test.Genesis.Alloc, false) // Create the tracer, the EVM environment and run it - tracer, err := New("callTracer") + tracer, err := New("callTracer", context) if err != nil { t.Fatalf("failed to create call tracer: %v", err) } From 44877c2c3ee6c37cdd0d974bb37e378684030b4f Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Mon, 21 Sep 2020 15:46:59 +0200 Subject: [PATCH 2/7] eth/tracers: use `go generate` --- eth/tracers/internal/tracers/assets.go | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index 4c2b6e08ab3c..1943144e2b7d 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -100,7 +100,7 @@ func _4byte_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "4byte_tracer.js", size: 2933, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + info := bindataFileInfo{name: "4byte_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -120,7 +120,7 @@ func bigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "bigram_tracer.js", size: 1712, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + info := bindataFileInfo{name: "bigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -140,7 +140,7 @@ func call_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "call_tracer.js", size: 8956, mode: os.FileMode(436), modTime: time.Unix(1600695632, 0)} + info := bindataFileInfo{name: "call_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -160,7 +160,7 @@ func evmdis_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "evmdis_tracer.js", size: 4195, mode: os.FileMode(436), modTime: time.Unix(1580938327, 0)} + info := bindataFileInfo{name: "evmdis_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -180,7 +180,7 @@ func noop_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "noop_tracer.js", size: 1271, mode: os.FileMode(436), modTime: time.Unix(1561974705, 0)} + info := bindataFileInfo{name: "noop_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -200,7 +200,7 @@ func opcount_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "opcount_tracer.js", size: 1372, mode: os.FileMode(420), modTime: time.Unix(1533483854, 0)} + info := bindataFileInfo{name: "opcount_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -220,7 +220,7 @@ func prestate_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "prestate_tracer.js", size: 4260, mode: os.FileMode(436), modTime: time.Unix(1600695632, 0)} + info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -240,7 +240,7 @@ func trigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "trigram_tracer.js", size: 1788, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + info := bindataFileInfo{name: "trigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -260,7 +260,7 @@ func unigram_tracerJs() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "unigram_tracer.js", size: 1510, mode: os.FileMode(436), modTime: time.Unix(1550512401, 0)} + info := bindataFileInfo{name: "unigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -369,15 +369,15 @@ type bintree struct { } var _bintree = &bintree{nil, map[string]*bintree{ - "4byte_tracer.js": &bintree{_4byte_tracerJs, map[string]*bintree{}}, - "bigram_tracer.js": &bintree{bigram_tracerJs, map[string]*bintree{}}, - "call_tracer.js": &bintree{call_tracerJs, map[string]*bintree{}}, - "evmdis_tracer.js": &bintree{evmdis_tracerJs, map[string]*bintree{}}, - "noop_tracer.js": &bintree{noop_tracerJs, map[string]*bintree{}}, - "opcount_tracer.js": &bintree{opcount_tracerJs, map[string]*bintree{}}, - "prestate_tracer.js": &bintree{prestate_tracerJs, map[string]*bintree{}}, - "trigram_tracer.js": &bintree{trigram_tracerJs, map[string]*bintree{}}, - "unigram_tracer.js": &bintree{unigram_tracerJs, map[string]*bintree{}}, + "4byte_tracer.js": {_4byte_tracerJs, map[string]*bintree{}}, + "bigram_tracer.js": {bigram_tracerJs, map[string]*bintree{}}, + "call_tracer.js": {call_tracerJs, map[string]*bintree{}}, + "evmdis_tracer.js": {evmdis_tracerJs, map[string]*bintree{}}, + "noop_tracer.js": {noop_tracerJs, map[string]*bintree{}}, + "opcount_tracer.js": {opcount_tracerJs, map[string]*bintree{}}, + "prestate_tracer.js": {prestate_tracerJs, map[string]*bintree{}}, + "trigram_tracer.js": {trigram_tracerJs, map[string]*bintree{}}, + "unigram_tracer.js": {unigram_tracerJs, map[string]*bintree{}}, }} // RestoreAsset restores an asset under the given directory From 86b6908275067868696d590174a757b3ca36b6d8 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Mon, 21 Sep 2020 19:10:52 +0200 Subject: [PATCH 3/7] eth/tracers: try with another version of go-bindata --- eth/tracers/internal/tracers/assets.go | 136 +++++++++++++++---------- 1 file changed, 83 insertions(+), 53 deletions(-) diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index 1943144e2b7d..acf9ae322472 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -1,19 +1,21 @@ -// Code generated for package tracers by go-bindata DO NOT EDIT. (@generated) +// Code generated by go-bindata. DO NOT EDIT. // sources: -// 4byte_tracer.js -// bigram_tracer.js -// call_tracer.js -// evmdis_tracer.js -// noop_tracer.js -// opcount_tracer.js -// prestate_tracer.js -// trigram_tracer.js -// unigram_tracer.js +// 4byte_tracer.js (2.933kB) +// bigram_tracer.js (1.712kB) +// call_tracer.js (8.956kB) +// evmdis_tracer.js (4.195kB) +// noop_tracer.js (1.271kB) +// opcount_tracer.js (1.372kB) +// prestate_tracer.js (4.26kB) +// trigram_tracer.js (1.788kB) +// unigram_tracer.js (1.51kB) + package tracers import ( "bytes" "compress/gzip" + "crypto/sha256" "fmt" "io" "io/ioutil" @@ -26,7 +28,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } var buf bytes.Buffer @@ -34,7 +36,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %w", name, err) } if clErr != nil { return nil, err @@ -44,8 +46,9 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo + bytes []byte + info os.FileInfo + digest [sha256.Size]byte } type bindataFileInfo struct { @@ -55,32 +58,21 @@ type bindataFileInfo struct { modTime time.Time } -// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } - -// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } - -// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } - -// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } - -// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 + return false } - -// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -101,7 +93,7 @@ func _4byte_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "4byte_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xc5, 0x48, 0x2d, 0xd9, 0x43, 0x95, 0x93, 0x3b, 0x93, 0x2c, 0x47, 0x8c, 0x84, 0x32, 0x3c, 0x8b, 0x2e, 0xf3, 0x72, 0xc4, 0x57, 0xe6, 0x3a, 0xb3, 0xdf, 0x1d, 0xbf, 0x45, 0x3, 0xfc, 0xa}} return a, nil } @@ -121,7 +113,7 @@ func bigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "bigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6c, 0xd, 0x24, 0xf2, 0x49, 0xbd, 0x58, 0x8b, 0xb5, 0xd1, 0xc9, 0xcd, 0xcf, 0x5b, 0x3e, 0x5c, 0xfb, 0x14, 0x50, 0xe7, 0xe3, 0xb9, 0xd1, 0x54, 0x69, 0xe6, 0x5e, 0x45, 0xa6, 0x2c, 0x6c}} return a, nil } @@ -141,7 +133,7 @@ func call_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "call_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x79, 0xb6, 0xbc, 0xd2, 0xc, 0x25, 0xb1, 0x22, 0x56, 0xef, 0x77, 0xb9, 0x5e, 0x2e, 0xf4, 0xda, 0xb2, 0x2f, 0x53, 0xa4, 0xff, 0xc8, 0xac, 0xbb, 0x75, 0x22, 0x46, 0x59, 0xe3, 0x1d, 0x7d}} return a, nil } @@ -161,7 +153,7 @@ func evmdis_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "evmdis_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0xc8, 0x73, 0x8e, 0xfb, 0x1f, 0x84, 0x7d, 0x37, 0xd9, 0x26, 0x24, 0x37, 0xb8, 0x65, 0xb1, 0xed, 0xa0, 0x76, 0x9a, 0xf0, 0x8e, 0x3a, 0x9b, 0x20, 0x93, 0x27, 0x26, 0x2e, 0xc9, 0x9b, 0xde}} return a, nil } @@ -181,7 +173,7 @@ func noop_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "noop_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xf, 0x1c, 0x6f, 0x65, 0xaf, 0x90, 0x31, 0xab, 0xf, 0xe0, 0xca, 0x54, 0x7, 0xfd, 0xd3, 0xa1, 0x4a, 0x14, 0x1, 0x2a, 0x9d, 0xdc, 0xb9, 0x64, 0x69, 0x83, 0x30, 0xb1, 0x2a, 0xbd, 0xfb}} return a, nil } @@ -201,7 +193,7 @@ func opcount_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "opcount_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x27, 0xe, 0x97, 0x88, 0x9b, 0x53, 0xbb, 0x20, 0x44, 0xd8, 0xf5, 0xeb, 0x41, 0xd2, 0x7e, 0xd6, 0xda, 0x6b, 0xf5, 0xaf, 0x0, 0x75, 0x9f, 0xd9, 0x22, 0xc, 0x6e, 0x74, 0xac, 0x2a, 0xa9, 0xa7}} return a, nil } @@ -221,7 +213,7 @@ func prestate_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x73, 0x5f, 0xcd, 0x1d, 0xb2, 0x77, 0x18, 0x8d, 0x8c, 0x9a, 0x2d, 0x65, 0xc7, 0x35, 0x6a, 0x6e, 0xec, 0xc9, 0x80, 0x29, 0x78, 0x98, 0x1f, 0xc5, 0xe7, 0xf5, 0xb2, 0x13, 0x5d, 0x37, 0xcf}} return a, nil } @@ -241,7 +233,7 @@ func trigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "trigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x40, 0x63, 0xe1, 0x42, 0x60, 0x7, 0x1b, 0x79, 0x47, 0x1, 0xa1, 0xbf, 0xc4, 0x66, 0x19, 0x9b, 0x2b, 0x5a, 0x1f, 0x82, 0x3d, 0xcf, 0xee, 0xe7, 0x60, 0x25, 0x2c, 0x4f, 0x13, 0x97, 0xc7, 0x18}} return a, nil } @@ -261,7 +253,7 @@ func unigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "unigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2f, 0x36, 0x14, 0xc2, 0xf6, 0xc3, 0x80, 0x2b, 0x4a, 0x11, 0x7d, 0xd5, 0x3e, 0xef, 0x23, 0xb5, 0xd6, 0xe6, 0xe6, 0x5, 0x41, 0xf6, 0x14, 0x7a, 0x39, 0xf7, 0xf8, 0xac, 0x89, 0x8e, 0x43, 0xe6}} return a, nil } @@ -269,8 +261,8 @@ func unigram_tracerJs() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -280,6 +272,12 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -291,12 +289,18 @@ func MustAsset(name string) []byte { return a } +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -306,6 +310,33 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -328,6 +359,9 @@ var _bindata = map[string]func() (*asset, error){ "unigram_tracer.js": unigram_tracerJs, } +// AssetDebug is true if the assets were built with the debug flag enabled. +const AssetDebug = false + // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -337,15 +371,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -380,7 +414,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "unigram_tracer.js": {unigram_tracerJs, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory +// RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -398,14 +432,10 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } -// RestoreAssets restores an asset under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -423,6 +453,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } From ad40b6adba496084db6eb4722c4d612d9ace26f9 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet Date: Mon, 21 Sep 2020 19:26:36 +0200 Subject: [PATCH 4/7] eth/tracers: export txGas --- eth/tracers/internal/tracers/assets.go | 6 +++--- eth/tracers/internal/tracers/prestate_tracer.js | 2 +- eth/tracers/tracer.go | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index acf9ae322472..224b030dcbdc 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -6,7 +6,7 @@ // evmdis_tracer.js (4.195kB) // noop_tracer.js (1.271kB) // opcount_tracer.js (1.372kB) -// prestate_tracer.js (4.26kB) +// prestate_tracer.js (4.264kB) // trigram_tracer.js (1.788kB) // unigram_tracer.js (1.51kB) @@ -197,7 +197,7 @@ func opcount_tracerJs() (*asset, error) { return a, nil } -var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\x96\xfe\x8a\x41\x5f\x6c\x5f\x5d\x39\xc9\x02\x7b\x80\x73\x39\x40\x75\xdd\x36\x40\x36\x09\x6c\xf7\x7a\xb9\xc5\x3e\x50\xe4\x48\xe6\x9a\x26\x05\x92\xb2\xe3\x2b\xf2\xbf\x1f\x86\xfa\xf0\x47\x93\xa6\x7b\x6f\x16\x39\xfc\xcd\xf7\x6f\xc6\xa3\x11\x4c\x4c\xb9\xb3\xb2\x58\x7a\xb8\x38\x3b\xff\x3b\x2c\x96\x08\x85\x79\x87\x7e\x89\x16\xab\x35\xa4\x95\x5f\x1a\xeb\xe2\xd1\x08\x16\x4b\xe9\x20\x97\x0a\x41\x3a\x28\x99\xf5\x60\x72\xf0\x27\xf2\x4a\x66\x96\xd9\x5d\x12\x8f\x46\xf5\x9b\x67\xaf\x09\x21\xb7\x88\xe0\x4c\xee\xb7\xcc\xe2\x18\x76\xa6\x02\xce\x34\x58\x14\xd2\x79\x2b\xb3\xca\x23\x48\x0f\x4c\x8b\x91\xb1\xb0\x36\x42\xe6\x3b\x82\x94\x1e\x2a\x2d\xd0\x06\xd5\x1e\xed\xda\xb5\x76\x7c\xba\xfd\x02\x37\xe8\x1c\x5a\xf8\x84\x1a\x2d\x53\x70\x5f\x65\x4a\x72\xb8\x91\x1c\xb5\x43\x60\x0e\x4a\x3a\x71\x4b\x14\x90\x05\x38\x7a\xf8\x91\x4c\x99\x37\xa6\xc0\x47\x53\x69\xc1\xbc\x34\x7a\x08\x28\xc9\x72\xd8\xa0\x75\xd2\x68\xf8\xa5\x55\xd5\x00\x0e\xc1\x58\x02\xe9\x33\x4f\x0e\x58\x30\x25\xbd\x1b\x00\xd3\x3b\x50\xcc\xef\x9f\xfe\x44\x40\xf6\x7e\x0b\x90\x3a\xa8\x59\x9a\x12\xc1\x2f\x99\x27\xaf\xb7\x52\x29\xc8\x10\x2a\x87\x79\xa5\x86\x84\x96\x55\x1e\xbe\x5e\x2f\x3e\xdf\x7d\x59\x40\x7a\xfb\x00\x5f\xd3\xd9\x2c\xbd\x5d\x3c\x5c\xc2\x56\xfa\xa5\xa9\x3c\xe0\x06\x6b\x28\xb9\x2e\x95\x44\x01\x5b\x66\x2d\xd3\x7e\x07\x26\x27\x84\xdf\xa6\xb3\xc9\xe7\xf4\x76\x91\xbe\xbf\xbe\xb9\x5e\x3c\x80\xb1\xf0\xf1\x7a\x71\x3b\x9d\xcf\xe1\xe3\xdd\x0c\x52\xb8\x4f\x67\x8b\xeb\xc9\x97\x9b\x74\x06\xf7\x5f\x66\xf7\x77\xf3\x69\x02\x73\x24\xab\x90\xde\xbf\x1e\xf3\x3c\x64\xcf\x22\x08\xf4\x4c\x2a\xd7\x46\xe2\xc1\x54\xe0\x96\xa6\x52\x02\x96\x6c\x83\x60\x91\xa3\xdc\xa0\x00\x06\xdc\x94\xbb\x9f\x4e\x2a\x61\x31\x65\x74\x11\x7c\x7e\xb1\x20\xe1\x3a\x07\x6d\xfc\x10\x1c\x22\xfc\x63\xe9\x7d\x39\x1e\x8d\xb6\xdb\x6d\x52\xe8\x2a\x31\xb6\x18\xa9\x1a\xce\x8d\xfe\x99\xc4\x84\x59\x5a\x74\x9e\x79\x5c\x58\xc6\xd1\x82\xa9\x7c\x59\x79\x07\xae\xca\x73\xc9\x25\x6a\x0f\x52\xe7\xc6\xae\x43\xa5\x80\x37\xc0\x2d\x32\x8f\xc0\x40\x19\xce\x14\xe0\x23\xf2\x2a\xdc\xd5\x91\x0e\xe5\x6a\x99\x76\x8c\x87\xd3\xdc\x9a\x35\xf9\x5a\x39\x4f\x3f\x9c\xc3\x75\xa6\x50\x40\x81\x1a\x9d\x74\x90\x29\xc3\x57\x49\xfc\x2d\x8e\x0e\x8c\xa1\x3a\x09\x1e\x36\x42\xa1\x36\xb6\xd8\xb3\x08\x59\x25\x95\x90\xba\x48\xe2\xa8\x95\x1e\x83\xae\x94\x1a\xc6\x01\x42\x19\xb3\xaa\xca\x94\x73\x53\x05\xdb\xff\x44\xee\x6b\x30\x57\x22\x97\x39\x15\x07\xeb\x6e\xbd\x09\x57\x9d\x5e\x93\x91\x7c\x12\x47\x47\x30\x63\xc8\x2b\x1d\xdc\xe9\x33\x21\xec\x10\x44\x36\xf8\x16\x47\xd1\x86\x59\xc2\x82\x2b\xf0\xe6\x33\x3e\x86\xcb\xc1\x65\x1c\x45\x32\x87\xbe\x5f\x4a\x97\xb4\xc0\xbf\x33\xce\xff\x80\xab\xab\xab\xd0\xd4\xb9\xd4\x28\x06\x40\x10\xd1\x73\x62\xf5\x4d\x94\x31\xc5\x34\xc7\x31\xf4\xce\x1e\x7b\xf0\x16\x44\x96\x14\xe8\xdf\xd7\xa7\xb5\xb2\xc4\x9b\xb9\xb7\x52\x17\xfd\xf3\x5f\x07\xc3\xf0\x4a\x9b\xf0\x06\x1a\xf1\x5b\xd3\x09\xd7\xf7\xdc\x88\x70\xdd\xd8\x5c\x4b\x4d\x8c\x68\x84\x1a\x29\xe7\x8d\x65\x05\x8e\xe1\xdb\x13\x7d\x3f\x91\x57\x4f\x71\xf4\x74\x14\xe5\x79\x2d\xf4\x42\x94\x1b\x08\x40\xed\x6d\x57\xe7\x85\xa4\x4e\x3d\x4c\x40\xc0\xfb\x51\x12\xe6\xad\x29\x27\x49\x58\xe1\xee\xf5\x4c\xd0\x85\x14\x8f\xdd\xc5\x0a\x77\x83\xcb\xf8\xc5\x14\x25\x8d\xd1\xbf\x4b\xf1\xf8\xb3\xf9\x3a\x79\x73\x14\xd7\x39\x49\xed\xed\x1d\x0c\x4e\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x36\x4c\x55\xd8\xab\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\xc7\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\xf7\x4c\xc1\x15\x64\xb2\xb8\xd6\xfe\x24\x79\x75\xd0\xdb\xa7\x83\x3f\x92\xa6\x79\x12\x47\x84\xd7\xbf\x18\x0c\xe1\xfc\xd7\xae\x22\xbc\x21\x28\x78\x1d\xcc\x9b\x97\xa1\xe2\xd3\x62\x78\xfe\x59\x50\x43\x1d\xfc\x36\x68\x4d\x5c\x95\x51\x3a\x6a\x3f\x43\x1c\x8f\xbb\xf8\xf2\x07\xb8\xc7\xbe\xb5\xb8\x4d\x68\x12\x26\xc4\x21\x28\x7d\x5e\x9c\x9f\x9d\x9d\xc1\xdf\x80\x8e\x0b\xe6\xee\xad\xe4\xdf\xa9\xab\x93\xf7\x01\xb9\xc5\x35\xf1\x3d\xe5\x87\x33\xa5\xd0\xf6\x1c\x04\x36\x19\x36\x85\x16\x32\x89\xeb\xd2\xef\xda\x29\xe0\x99\x2d\xd0\xbb\xd7\x4d\x0e\x38\xef\xde\xb5\xe4\x18\x82\xb4\x2b\x11\xae\xae\xa0\x37\x99\x4d\xd3\xc5\xb4\xd7\x34\xd8\x68\x04\x5f\x31\xec\x48\x99\x92\x99\x50\x3b\x10\xa8\xd0\x63\x6d\x97\xd1\x21\x78\x1d\x59\x0c\x69\xd9\xa1\x35\x04\x1f\xa5\xf3\x52\x17\x50\x73\xc8\x96\x26\x6e\x03\x17\xba\x87\xb3\xca\x51\x1d\x9f\x8c\x27\x6f\x68\xd7\xb0\x48\x8c\x43\x93\x21\x34\x22\x53\xb2\xdb\x4d\x72\x69\x9d\x87\x52\x31\x8e\x09\xe1\x75\xc6\xbc\x9c\xf9\xa6\xc7\x49\xf5\x2c\x34\x67\x00\xda\x8f\x3e\xa6\x68\x74\x92\x7a\x07\xfd\x16\x63\x10\x47\x91\x6d\xa5\x0f\xb0\x2f\xf7\x64\xe1\x3c\x96\x87\x54\x41\x2b\x07\x6e\x90\xc8\x35\xf0\x44\x3d\x26\x49\xd7\xbf\x7e\x6b\xe6\x32\xba\x24\x8e\xe8\xdd\x41\xc7\x2b\x53\x1c\x77\xbc\xa8\xc3\xc2\x2b\x6b\x29\xff\x1d\x39\xe7\xd4\xfd\x7f\x56\xce\x53\x4c\x2d\x85\xa7\xe1\x91\xe7\xe8\x33\x90\x25\xcd\xe1\xc1\xf7\x34\x49\x13\x2d\x4c\x10\x52\xd7\xcc\xaf\x7a\xcf\x2b\x8d\x47\xed\x25\x53\x6a\x47\x79\xd8\x5a\x5a\x70\x68\xa5\x19\x82\x93\x24\x15\xb8\x28\x88\x4a\xcd\x55\x25\xea\x32\x08\x15\xde\xe0\xb9\x60\xf3\xf1\x66\xb4\x46\xe7\x58\x81\x09\x55\x52\x2e\x1f\x9b\xdd\x52\x43\xaf\xa6\xbf\xfe\xa0\x97\x74\x46\x1e\x93\x8f\x32\x45\xd2\x16\x19\x11\x78\x2a\x84\x45\xe7\xfa\x83\x86\x8d\xba\xcc\x7e\x5d\xa2\xa6\xe0\x83\xc6\x2d\x74\x4b\x0b\xe3\x9c\x96\x38\x31\x04\x26\x04\x91\xde\xc9\x82\x11\x47\x91\xdb\x4a\xcf\x97\x10\x34\x99\x72\xdf\x8b\x83\xa6\xfe\x39\x73\x08\x6f\xa6\xff\x5e\x4c\xee\x3e\x4c\x27\x77\xf7\x0f\x6f\xc6\x70\x74\x36\xbf\xfe\xcf\xb4\x3b\x7b\x9f\xde\xa4\xb7\x93\xe9\x9b\x71\x98\xda\xcf\x38\xe4\x4d\xeb\x02\x29\x74\x9e\xf1\x55\x52\x22\xae\xfa\x67\xc7\x3c\xb0\x77\x30\x8a\x32\x8b\x6c\x75\xb9\x37\xa6\x6e\xd0\x46\x47\x4b\xc6\x70\x05\x2f\x06\xeb\xf2\x65\x6b\x26\x8d\x7c\xbf\xa5\xf8\xfd\x92\x12\xa8\xe2\x75\x3b\x2e\xfe\xb2\x21\xa1\x77\x18\x5f\x8d\xc1\x31\x45\xbb\xb1\xfc\x2f\xfd\xa7\xc9\x73\x87\x7e\x08\xa8\x85\xd9\x12\xf3\x75\xa8\xf5\x4d\x83\x7b\x10\xb2\xf3\x41\xcd\xad\x77\x79\x7f\xd0\x09\x13\xd8\xf7\xa2\x17\xcf\x89\xa2\x16\x70\xd5\xa2\xbf\x0d\x2f\x5f\x0f\xd4\x45\x13\xa9\x13\x05\xbf\x9c\xec\x7e\xe1\x7e\x8d\x6b\x63\x77\xcd\xa0\x3a\xf0\xef\xc7\x51\x4d\x6f\x6e\xba\x7a\xa2\x0f\x2a\xb2\xee\xe0\xc3\xf4\x66\xfa\x29\x5d\x4c\x8f\xa4\xe6\x8b\x74\x71\x3d\xa9\x8f\xfe\x72\xe1\x9d\xff\x74\xe1\xf5\xe6\xf3\xc5\xdd\x6c\xda\x1b\x37\x5f\x37\x77\xe9\x87\xde\x77\x0a\x9b\xfd\xf0\x47\xad\xeb\xcd\x57\x63\xc5\xff\xd3\x01\x07\xbb\x5a\xce\x9e\x5b\xd5\x02\xb5\x73\x5f\x9d\xfc\x15\x02\xa6\x5b\x56\xce\xeb\xbf\x83\x51\x78\xff\x2c\x0f\x3f\xc5\x4f\xf1\xff\x02\x00\x00\xff\xff\xca\x4d\x6e\xf4\xa4\x10\x00\x00") +var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\x96\xfe\x8a\x41\x5f\x6c\x5f\x5d\xb9\xc9\x02\x7b\x80\x73\x39\x40\x75\xdd\x36\x40\x36\x09\x6c\xf7\x72\xb9\xc5\x3e\x50\xe4\x48\xe6\x9a\x26\x05\x92\xb2\xe3\x2b\xf2\xbf\x1f\x86\xfa\xf0\x47\x93\xa6\x7b\x6f\x16\x39\xfc\xcd\xf7\x6f\xc6\xa3\x11\x4c\x4c\xb9\xb3\xb2\x58\x7a\x38\x7f\x7f\xf6\x77\x58\x2c\x11\x0a\xf3\x0e\xfd\x12\x2d\x56\x6b\x48\x2b\xbf\x34\xd6\xc5\xa3\x11\x2c\x96\xd2\x41\x2e\x15\x82\x74\x50\x32\xeb\xc1\xe4\xe0\x4f\xe4\x95\xcc\x2c\xb3\xbb\x24\x1e\x8d\xea\x37\xcf\x5e\x13\x42\x6e\x11\xc1\x99\xdc\x6f\x99\xc5\x31\xec\x4c\x05\x9c\x69\xb0\x28\xa4\xf3\x56\x66\x95\x47\x90\x1e\x98\x16\x23\x63\x61\x6d\x84\xcc\x77\x04\x29\x3d\x54\x5a\xa0\x0d\xaa\x3d\xda\xb5\x6b\xed\xf8\x7c\xf3\x15\xae\xd1\x39\xb4\xf0\x19\x35\x5a\xa6\xe0\xae\xca\x94\xe4\x70\x2d\x39\x6a\x87\xc0\x1c\x94\x74\xe2\x96\x28\x20\x0b\x70\xf4\xf0\x13\x99\x32\x6f\x4c\x81\x4f\xa6\xd2\x82\x79\x69\xf4\x10\x50\x92\xe5\xb0\x41\xeb\xa4\xd1\xf0\x4b\xab\xaa\x01\x1c\x82\xb1\x04\xd2\x67\x9e\x1c\xb0\x60\x4a\x7a\x37\x00\xa6\x77\xa0\x98\xdf\x3f\xfd\x89\x80\xec\xfd\x16\x20\x75\x50\xb3\x34\x25\x82\x5f\x32\x4f\x5e\x6f\xa5\x52\x90\x21\x54\x0e\xf3\x4a\x0d\x09\x2d\xab\x3c\xdc\x5f\x2d\xbe\xdc\x7e\x5d\x40\x7a\xf3\x00\xf7\xe9\x6c\x96\xde\x2c\x1e\x2e\x60\x2b\xfd\xd2\x54\x1e\x70\x83\x35\x94\x5c\x97\x4a\xa2\x80\x2d\xb3\x96\x69\xbf\x03\x93\x13\xc2\x6f\xd3\xd9\xe4\x4b\x7a\xb3\x48\x3f\x5c\x5d\x5f\x2d\x1e\xc0\x58\xf8\x74\xb5\xb8\x99\xce\xe7\xf0\xe9\x76\x06\x29\xdc\xa5\xb3\xc5\xd5\xe4\xeb\x75\x3a\x83\xbb\xaf\xb3\xbb\xdb\xf9\x34\x81\x39\x92\x55\x48\xef\x5f\x8f\x79\x1e\xb2\x67\x11\x04\x7a\x26\x95\x6b\x23\xf1\x60\x2a\x70\x4b\x53\x29\x01\x4b\xb6\x41\xb0\xc8\x51\x6e\x50\x00\x03\x6e\xca\xdd\x4f\x27\x95\xb0\x98\x32\xba\x08\x3e\xbf\x58\x90\x70\x95\x83\x36\x7e\x08\x0e\x11\xfe\xb1\xf4\xbe\x1c\x8f\x46\xdb\xed\x36\x29\x74\x95\x18\x5b\x8c\x54\x0d\xe7\x46\xff\x4c\x62\xc2\x2c\x2d\x3a\xcf\x3c\x2e\x2c\xe3\x68\xc1\x54\xbe\xac\xbc\x03\x57\xe5\xb9\xe4\x12\xb5\x07\xa9\x73\x63\xd7\xa1\x52\xc0\x1b\xe0\x16\x99\x47\x60\xa0\x0c\x67\x0a\xf0\x11\x79\x15\xee\xea\x48\x87\x72\xb5\x4c\x3b\xc6\xc3\x69\x6e\xcd\x9a\x7c\xad\x9c\xa7\x1f\xce\xe1\x3a\x53\x28\xa0\x40\x8d\x4e\x3a\xc8\x94\xe1\xab\x24\xfe\x16\x47\x07\xc6\x50\x9d\x04\x0f\x1b\xa1\x50\x1b\x5b\xec\x59\x84\xac\x92\x4a\x48\x5d\x24\x71\xd4\x4a\x8f\x41\x57\x4a\x0d\xe3\x00\xa1\x8c\x59\x55\x65\xca\xb9\xa9\x82\xed\x7f\x22\xf7\x35\x98\x2b\x91\xcb\x9c\x8a\x83\x75\xb7\xde\x84\xab\x4e\xaf\xc9\x48\x3e\x89\xa3\x23\x98\x31\xe4\x95\x0e\xee\xf4\x99\x10\x76\x08\x22\x1b\x7c\x8b\xa3\x68\xc3\x2c\x61\xc1\x25\x78\xf3\x05\x1f\xc3\xe5\xe0\x22\x8e\x22\x99\x43\xdf\x2f\xa5\x4b\x5a\xe0\xdf\x19\xe7\x7f\xc0\xe5\xe5\x65\x68\xea\x5c\x6a\x14\x03\x20\x88\xe8\x39\xb1\xfa\x26\xca\x98\x62\x9a\xe3\x18\x7a\xef\x1f\x7b\xf0\x16\x44\x96\x14\xe8\x3f\xd4\xa7\xb5\xb2\xc4\x9b\xb9\xb7\x52\x17\xfd\xb3\x5f\x07\xc3\xf0\x4a\x9b\xf0\x06\x1a\xf1\x1b\xd3\x09\xd7\xf7\xdc\x88\x70\xdd\xd8\x5c\x4b\x4d\x8c\x68\x84\x1a\x29\xe7\x8d\x65\x05\x8e\xe1\xdb\x13\x7d\x3f\x91\x57\x4f\x71\xf4\x74\x14\xe5\x79\x2d\xf4\x42\x94\x1b\x08\x40\xed\x6d\x57\xe7\x85\xa4\x4e\x3d\x4c\x40\xc0\xfb\x51\x12\xe6\xad\x29\x27\x49\x58\xe1\xee\xf5\x4c\xd0\x85\x14\x8f\xdd\xc5\x0a\x77\x83\x8b\xf8\xc5\x14\x25\x8d\xd1\xbf\x4b\xf1\xf8\xb3\xf9\x3a\x79\x73\x14\xd7\x39\x49\xed\xed\x1d\x0c\x4e\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x36\x4c\x55\xd8\xab\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\xc7\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\x0f\x4c\xc1\x25\x64\xb2\xb8\xd2\xfe\x24\x79\x75\xd0\xdb\xa7\x83\x3f\x92\xa6\x79\x12\x47\x84\xd7\x3f\x1f\x0c\xe1\xec\xd7\xae\x22\xbc\x21\x28\x78\x1d\xcc\x9b\x97\xa1\xe2\xd3\x62\x78\xfe\x59\x50\x43\x1d\xfc\x36\x68\x4d\x5c\x95\x51\x3a\x6a\x3f\x43\x1c\x8f\xbb\xf8\xe2\x07\xb8\xc7\xbe\xb5\xb8\x4d\x68\x12\x26\xc4\x21\x68\xfb\xe9\x1f\x3f\x33\x07\x7f\x03\xfa\x5d\x30\x77\x67\x25\xff\x4e\x65\x9d\xc0\x8f\xc8\x2d\xae\x89\xf3\x29\x47\x9c\x29\x85\xb6\xe7\x20\x30\xca\xb0\x29\xb6\x90\x4d\x5c\x97\x7e\xd7\x4e\x02\xcf\x6c\x81\xde\xbd\x6e\x76\xc0\x79\xf7\xae\x25\xc8\x60\xdb\xae\x44\xb8\xbc\x84\xde\x64\x36\x4d\x17\xd3\x5e\xd3\x64\xa3\x11\xdc\x63\xd8\x93\x32\x25\x33\xa1\x76\x20\x50\xa1\xc7\xda\x2e\xa3\x43\x00\x3b\xc2\x18\xd2\xc2\x43\xab\x08\x3e\x4a\xe7\xa5\x2e\xa0\xe6\x91\x2d\x4d\xdd\x06\x2e\x74\x10\x67\x95\xa3\x5a\x3e\x19\x51\xde\xd0\xbe\x61\x91\x58\x87\xa6\x43\x68\x46\xa6\x64\xb7\x9f\xe4\xd2\x3a\x0f\xa5\x62\x1c\x13\xc2\xeb\x8c\x79\x39\xfb\x4d\x9f\x93\xea\x59\x68\xd0\x00\xb4\x1f\x7f\x4c\xd1\xf8\x24\xf5\x0e\xfa\x2d\xc6\x20\x8e\x22\xdb\x4a\x1f\x60\x5f\xec\x09\xc3\x79\x2c\x0f\xe9\x82\xd6\x0e\xdc\x20\x11\x6c\xe0\x8a\x7a\x54\x92\xae\x7f\xfd\xd6\xcc\x66\x74\x49\x1c\xd1\xbb\x83\xae\x57\xa6\x38\xee\x7a\x51\x87\x85\x57\xd6\x52\xfe\x3b\x82\xce\x89\x01\xfe\xac\x9c\xa7\x98\x5a\x0a\x4f\xc3\x25\xcf\x51\x68\x20\x4c\x9a\xc5\x83\xef\xa9\x92\xa6\x5a\x98\x22\xa4\xae\x99\x61\xf5\xae\x57\x1a\x8f\xda\x4b\xa6\xd4\x8e\xf2\xb0\xb5\xb4\xe4\xd0\x5a\x33\x04\x27\x49\x2a\xf0\x51\x10\x95\x9a\xab\x4a\xd4\x65\x10\xaa\xbc\xc1\x73\xc1\xe6\xe3\xed\x68\x8d\xce\xb1\x02\x13\xaa\xa4\x5c\x3e\x36\xfb\xa5\x86\x5e\x4d\x81\xfd\x41\x2f\xe9\x8c\x3c\x26\x20\x65\x8a\xa4\x2d\x32\x22\xf1\x54\x08\x8b\xce\xf5\x07\x0d\x23\x75\x99\xbd\x5f\xa2\xa6\xe0\x83\xc6\x2d\x74\x8b\x0b\xe3\x9c\x16\x39\x31\x04\x26\x04\x11\xdf\xc9\x92\x11\x47\x91\xdb\x4a\xcf\x97\x10\x34\x99\x72\xdf\x8b\x83\xa6\xfe\x39\x73\x08\x6f\xa6\xff\x5e\x4c\x6e\x3f\x4e\x27\xb7\x77\x0f\x6f\xc6\x70\x74\x36\xbf\xfa\xcf\xb4\x3b\xfb\x90\x5e\xa7\x37\x93\xe9\x9b\x71\x98\xdc\xcf\x38\xe4\x4d\xeb\x02\x29\x74\x9e\xf1\x55\x52\x22\xae\xfa\xef\x8f\x79\x60\xef\x60\x14\x65\x16\xd9\xea\x62\x6f\x4c\xdd\xa0\x8d\x8e\x96\x90\xe1\x12\x5e\x0c\xd6\xc5\xcb\xd6\x4c\x1a\xf9\x7e\x4b\xf3\xfb\x45\x25\x50\xc5\xeb\x76\x9c\xff\x65\x43\x42\xef\x30\xbe\x1a\x83\x63\x8a\xf6\x63\xf9\x5f\xfa\x5f\x93\xe7\x0e\xfd\x10\x50\x0b\xb3\x25\xe6\xeb\x50\xeb\x9b\x06\xf7\x20\x64\x67\x83\x9a\x5f\x6f\xf3\xfe\xa0\x13\x26\xb0\xef\x45\xcf\x9f\x13\x45\x2d\xe0\xb2\x45\x7f\x1b\x5e\xbe\x1e\xa8\xf3\x26\x52\x27\x0a\x7e\x39\xd9\xff\xc2\xfd\x1a\xd7\xc6\xee\x9a\x61\x75\xe0\xdf\x8f\xa3\x9a\x5e\x5f\x77\xf5\x44\x1f\x54\x64\xdd\xc1\xc7\xe9\xf5\xf4\x73\xba\x98\x1e\x49\xcd\x17\xe9\xe2\x6a\x52\x1f\xfd\xe5\xc2\x3b\xfb\xe9\xc2\xeb\xcd\xe7\x8b\xdb\xd9\xb4\x37\x6e\xbe\xae\x6f\xd3\x8f\xbd\xef\x14\x36\x3b\xe2\x8f\x5a\xd7\x9b\x7b\x63\xc5\xff\xd3\x01\x07\xfb\x5a\xce\x9e\x5b\xd7\x02\xb5\x73\x5f\x9d\xfc\x1d\x02\xa6\x5b\x56\xce\xeb\xbf\x84\x51\x78\xff\x2c\x0f\x3f\xc5\x4f\xf1\xff\x02\x00\x00\xff\xff\x4c\x7e\x8c\xce\xa8\x10\x00\x00") func prestate_tracerJsBytes() ([]byte, error) { return bindataRead( @@ -213,7 +213,7 @@ func prestate_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x48, 0x73, 0x5f, 0xcd, 0x1d, 0xb2, 0x77, 0x18, 0x8d, 0x8c, 0x9a, 0x2d, 0x65, 0xc7, 0x35, 0x6a, 0x6e, 0xec, 0xc9, 0x80, 0x29, 0x78, 0x98, 0x1f, 0xc5, 0xe7, 0xf5, 0xb2, 0x13, 0x5d, 0x37, 0xcf}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0xe9, 0xd4, 0x9b, 0xe9, 0xc4, 0x8e, 0xad, 0xa8, 0xa9, 0x5d, 0xa5, 0xf2, 0xb1, 0x53, 0x79, 0xa6, 0xa3, 0x24, 0xd5, 0xce, 0x8b, 0x80, 0x32, 0xbb, 0xbc, 0xd0, 0x3c, 0xf3, 0x9, 0xd9, 0xd1}} return a, nil } diff --git a/eth/tracers/internal/tracers/prestate_tracer.js b/eth/tracers/internal/tracers/prestate_tracer.js index 1b5d395644a2..31d67f7ad427 100644 --- a/eth/tracers/internal/tracers/prestate_tracer.js +++ b/eth/tracers/internal/tracers/prestate_tracer.js @@ -55,7 +55,7 @@ var toBal = bigInt(this.prestate[toHex(ctx.to)].balance.slice(2), 16); this.prestate[toHex(ctx.to)].balance = '0x'+toBal.subtract(ctx.value).toString(16); - this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).add(21000 * ctx.gasPrice).toString(16); + this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).add(ctx.txGas * ctx.gasPrice).toString(16); // Decrement the caller's nonce, and remove empty create targets this.prestate[toHex(ctx.from)].nonce--; diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index f299e560deff..704ba9181e74 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -30,7 +30,8 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" - "gopkg.in/olebedev/go-duktape.v3" + "github.com/ethereum/go-ethereum/params" + duktape "gopkg.in/olebedev/go-duktape.v3" ) // bigIntegerJS is the minified version of https://github.com/peterolson/BigInteger.js. @@ -336,6 +337,7 @@ func New(code string, txCtx vm.TxContext) (*Tracer, error) { refundValue: new(uint), } tracer.ctx["gasPrice"] = txCtx.GasPrice + tracer.ctx["txGas"] = params.TxGas // Set up builtins for this environment tracer.vm.PushGlobalGoFunction("toHex", func(ctx *duktape.Context) int { From c4e1371cab2257066b6b4eee0048607a03d66780 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Thu, 17 Dec 2020 13:44:05 +0100 Subject: [PATCH 5/7] eth, eth/tracers: pass intrinsic gas to js tracers eth/tracers: include tx gas in tracers usedGas eth/tracers: fix prestate tracer's sender balance eth/tracers: rm unnecessary import eth/tracers: pass intrinsicGas separately to tracer eth/tracers: fix tests broken by lack of txdata eth, eth/tracers: minor fix --- eth/api_tracer.go | 2 +- eth/tracers/internal/tracers/assets.go | 138 +++++++----------- .../internal/tracers/prestate_tracer.js | 2 +- eth/tracers/tracer.go | 19 ++- eth/tracers/tracer_test.go | 5 + eth/tracers/tracers_test.go | 4 +- 6 files changed, 79 insertions(+), 91 deletions(-) diff --git a/eth/api_tracer.go b/eth/api_tracer.go index 06b9f1eb21a1..c68b762255f4 100644 --- a/eth/api_tracer.go +++ b/eth/api_tracer.go @@ -794,7 +794,7 @@ func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, v } } // Constuct the JavaScript tracer to execute with - if tracer, err = tracers.New(*config.Tracer, vmctx); err != nil { + if tracer, err = tracers.New(*config.Tracer, txContext); err != nil { return nil, err } // Handle timeouts and RPC cancellations diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index 224b030dcbdc..5baafbe95b70 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -1,21 +1,19 @@ -// Code generated by go-bindata. DO NOT EDIT. +// Code generated for package tracers by go-bindata DO NOT EDIT. (@generated) // sources: -// 4byte_tracer.js (2.933kB) -// bigram_tracer.js (1.712kB) -// call_tracer.js (8.956kB) -// evmdis_tracer.js (4.195kB) -// noop_tracer.js (1.271kB) -// opcount_tracer.js (1.372kB) -// prestate_tracer.js (4.264kB) -// trigram_tracer.js (1.788kB) -// unigram_tracer.js (1.51kB) - +// 4byte_tracer.js +// bigram_tracer.js +// call_tracer.js +// evmdis_tracer.js +// noop_tracer.js +// opcount_tracer.js +// prestate_tracer.js +// trigram_tracer.js +// unigram_tracer.js package tracers import ( "bytes" "compress/gzip" - "crypto/sha256" "fmt" "io" "io/ioutil" @@ -28,7 +26,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("read %q: %w", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } var buf bytes.Buffer @@ -36,7 +34,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("read %q: %w", name, err) + return nil, fmt.Errorf("Read %q: %v", name, err) } if clErr != nil { return nil, err @@ -46,9 +44,8 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo - digest [sha256.Size]byte + bytes []byte + info os.FileInfo } type bindataFileInfo struct { @@ -58,21 +55,32 @@ type bindataFileInfo struct { modTime time.Time } +// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } + +// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } + +// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } + +// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } + +// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return false + return fi.mode&os.ModeDir != 0 } + +// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -93,7 +101,7 @@ func _4byte_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "4byte_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xc5, 0x48, 0x2d, 0xd9, 0x43, 0x95, 0x93, 0x3b, 0x93, 0x2c, 0x47, 0x8c, 0x84, 0x32, 0x3c, 0x8b, 0x2e, 0xf3, 0x72, 0xc4, 0x57, 0xe6, 0x3a, 0xb3, 0xdf, 0x1d, 0xbf, 0x45, 0x3, 0xfc, 0xa}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -113,7 +121,7 @@ func bigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "bigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6c, 0xd, 0x24, 0xf2, 0x49, 0xbd, 0x58, 0x8b, 0xb5, 0xd1, 0xc9, 0xcd, 0xcf, 0x5b, 0x3e, 0x5c, 0xfb, 0x14, 0x50, 0xe7, 0xe3, 0xb9, 0xd1, 0x54, 0x69, 0xe6, 0x5e, 0x45, 0xa6, 0x2c, 0x6c}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -133,7 +141,7 @@ func call_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "call_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x79, 0xb6, 0xbc, 0xd2, 0xc, 0x25, 0xb1, 0x22, 0x56, 0xef, 0x77, 0xb9, 0x5e, 0x2e, 0xf4, 0xda, 0xb2, 0x2f, 0x53, 0xa4, 0xff, 0xc8, 0xac, 0xbb, 0x75, 0x22, 0x46, 0x59, 0xe3, 0x1d, 0x7d}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -153,7 +161,7 @@ func evmdis_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "evmdis_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0xc8, 0x73, 0x8e, 0xfb, 0x1f, 0x84, 0x7d, 0x37, 0xd9, 0x26, 0x24, 0x37, 0xb8, 0x65, 0xb1, 0xed, 0xa0, 0x76, 0x9a, 0xf0, 0x8e, 0x3a, 0x9b, 0x20, 0x93, 0x27, 0x26, 0x2e, 0xc9, 0x9b, 0xde}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -173,7 +181,7 @@ func noop_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "noop_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xf, 0x1c, 0x6f, 0x65, 0xaf, 0x90, 0x31, 0xab, 0xf, 0xe0, 0xca, 0x54, 0x7, 0xfd, 0xd3, 0xa1, 0x4a, 0x14, 0x1, 0x2a, 0x9d, 0xdc, 0xb9, 0x64, 0x69, 0x83, 0x30, 0xb1, 0x2a, 0xbd, 0xfb}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -193,11 +201,11 @@ func opcount_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "opcount_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x27, 0xe, 0x97, 0x88, 0x9b, 0x53, 0xbb, 0x20, 0x44, 0xd8, 0xf5, 0xeb, 0x41, 0xd2, 0x7e, 0xd6, 0xda, 0x6b, 0xf5, 0xaf, 0x0, 0x75, 0x9f, 0xd9, 0x22, 0xc, 0x6e, 0x74, 0xac, 0x2a, 0xa9, 0xa7}} + a := &asset{bytes: bytes, info: info} return a, nil } -var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\x96\xfe\x8a\x41\x5f\x6c\x5f\x5d\xb9\xc9\x02\x7b\x80\x73\x39\x40\x75\xdd\x36\x40\x36\x09\x6c\xf7\x72\xb9\xc5\x3e\x50\xe4\x48\xe6\x9a\x26\x05\x92\xb2\xe3\x2b\xf2\xbf\x1f\x86\xfa\xf0\x47\x93\xa6\x7b\x6f\x16\x39\xfc\xcd\xf7\x6f\xc6\xa3\x11\x4c\x4c\xb9\xb3\xb2\x58\x7a\x38\x7f\x7f\xf6\x77\x58\x2c\x11\x0a\xf3\x0e\xfd\x12\x2d\x56\x6b\x48\x2b\xbf\x34\xd6\xc5\xa3\x11\x2c\x96\xd2\x41\x2e\x15\x82\x74\x50\x32\xeb\xc1\xe4\xe0\x4f\xe4\x95\xcc\x2c\xb3\xbb\x24\x1e\x8d\xea\x37\xcf\x5e\x13\x42\x6e\x11\xc1\x99\xdc\x6f\x99\xc5\x31\xec\x4c\x05\x9c\x69\xb0\x28\xa4\xf3\x56\x66\x95\x47\x90\x1e\x98\x16\x23\x63\x61\x6d\x84\xcc\x77\x04\x29\x3d\x54\x5a\xa0\x0d\xaa\x3d\xda\xb5\x6b\xed\xf8\x7c\xf3\x15\xae\xd1\x39\xb4\xf0\x19\x35\x5a\xa6\xe0\xae\xca\x94\xe4\x70\x2d\x39\x6a\x87\xc0\x1c\x94\x74\xe2\x96\x28\x20\x0b\x70\xf4\xf0\x13\x99\x32\x6f\x4c\x81\x4f\xa6\xd2\x82\x79\x69\xf4\x10\x50\x92\xe5\xb0\x41\xeb\xa4\xd1\xf0\x4b\xab\xaa\x01\x1c\x82\xb1\x04\xd2\x67\x9e\x1c\xb0\x60\x4a\x7a\x37\x00\xa6\x77\xa0\x98\xdf\x3f\xfd\x89\x80\xec\xfd\x16\x20\x75\x50\xb3\x34\x25\x82\x5f\x32\x4f\x5e\x6f\xa5\x52\x90\x21\x54\x0e\xf3\x4a\x0d\x09\x2d\xab\x3c\xdc\x5f\x2d\xbe\xdc\x7e\x5d\x40\x7a\xf3\x00\xf7\xe9\x6c\x96\xde\x2c\x1e\x2e\x60\x2b\xfd\xd2\x54\x1e\x70\x83\x35\x94\x5c\x97\x4a\xa2\x80\x2d\xb3\x96\x69\xbf\x03\x93\x13\xc2\x6f\xd3\xd9\xe4\x4b\x7a\xb3\x48\x3f\x5c\x5d\x5f\x2d\x1e\xc0\x58\xf8\x74\xb5\xb8\x99\xce\xe7\xf0\xe9\x76\x06\x29\xdc\xa5\xb3\xc5\xd5\xe4\xeb\x75\x3a\x83\xbb\xaf\xb3\xbb\xdb\xf9\x34\x81\x39\x92\x55\x48\xef\x5f\x8f\x79\x1e\xb2\x67\x11\x04\x7a\x26\x95\x6b\x23\xf1\x60\x2a\x70\x4b\x53\x29\x01\x4b\xb6\x41\xb0\xc8\x51\x6e\x50\x00\x03\x6e\xca\xdd\x4f\x27\x95\xb0\x98\x32\xba\x08\x3e\xbf\x58\x90\x70\x95\x83\x36\x7e\x08\x0e\x11\xfe\xb1\xf4\xbe\x1c\x8f\x46\xdb\xed\x36\x29\x74\x95\x18\x5b\x8c\x54\x0d\xe7\x46\xff\x4c\x62\xc2\x2c\x2d\x3a\xcf\x3c\x2e\x2c\xe3\x68\xc1\x54\xbe\xac\xbc\x03\x57\xe5\xb9\xe4\x12\xb5\x07\xa9\x73\x63\xd7\xa1\x52\xc0\x1b\xe0\x16\x99\x47\x60\xa0\x0c\x67\x0a\xf0\x11\x79\x15\xee\xea\x48\x87\x72\xb5\x4c\x3b\xc6\xc3\x69\x6e\xcd\x9a\x7c\xad\x9c\xa7\x1f\xce\xe1\x3a\x53\x28\xa0\x40\x8d\x4e\x3a\xc8\x94\xe1\xab\x24\xfe\x16\x47\x07\xc6\x50\x9d\x04\x0f\x1b\xa1\x50\x1b\x5b\xec\x59\x84\xac\x92\x4a\x48\x5d\x24\x71\xd4\x4a\x8f\x41\x57\x4a\x0d\xe3\x00\xa1\x8c\x59\x55\x65\xca\xb9\xa9\x82\xed\x7f\x22\xf7\x35\x98\x2b\x91\xcb\x9c\x8a\x83\x75\xb7\xde\x84\xab\x4e\xaf\xc9\x48\x3e\x89\xa3\x23\x98\x31\xe4\x95\x0e\xee\xf4\x99\x10\x76\x08\x22\x1b\x7c\x8b\xa3\x68\xc3\x2c\x61\xc1\x25\x78\xf3\x05\x1f\xc3\xe5\xe0\x22\x8e\x22\x99\x43\xdf\x2f\xa5\x4b\x5a\xe0\xdf\x19\xe7\x7f\xc0\xe5\xe5\x65\x68\xea\x5c\x6a\x14\x03\x20\x88\xe8\x39\xb1\xfa\x26\xca\x98\x62\x9a\xe3\x18\x7a\xef\x1f\x7b\xf0\x16\x44\x96\x14\xe8\x3f\xd4\xa7\xb5\xb2\xc4\x9b\xb9\xb7\x52\x17\xfd\xb3\x5f\x07\xc3\xf0\x4a\x9b\xf0\x06\x1a\xf1\x1b\xd3\x09\xd7\xf7\xdc\x88\x70\xdd\xd8\x5c\x4b\x4d\x8c\x68\x84\x1a\x29\xe7\x8d\x65\x05\x8e\xe1\xdb\x13\x7d\x3f\x91\x57\x4f\x71\xf4\x74\x14\xe5\x79\x2d\xf4\x42\x94\x1b\x08\x40\xed\x6d\x57\xe7\x85\xa4\x4e\x3d\x4c\x40\xc0\xfb\x51\x12\xe6\xad\x29\x27\x49\x58\xe1\xee\xf5\x4c\xd0\x85\x14\x8f\xdd\xc5\x0a\x77\x83\x8b\xf8\xc5\x14\x25\x8d\xd1\xbf\x4b\xf1\xf8\xb3\xf9\x3a\x79\x73\x14\xd7\x39\x49\xed\xed\x1d\x0c\x4e\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x36\x4c\x55\xd8\xab\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\xc7\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\x0f\x4c\xc1\x25\x64\xb2\xb8\xd2\xfe\x24\x79\x75\xd0\xdb\xa7\x83\x3f\x92\xa6\x79\x12\x47\x84\xd7\x3f\x1f\x0c\xe1\xec\xd7\xae\x22\xbc\x21\x28\x78\x1d\xcc\x9b\x97\xa1\xe2\xd3\x62\x78\xfe\x59\x50\x43\x1d\xfc\x36\x68\x4d\x5c\x95\x51\x3a\x6a\x3f\x43\x1c\x8f\xbb\xf8\xe2\x07\xb8\xc7\xbe\xb5\xb8\x4d\x68\x12\x26\xc4\x21\x68\xfb\xe9\x1f\x3f\x33\x07\x7f\x03\xfa\x5d\x30\x77\x67\x25\xff\x4e\x65\x9d\xc0\x8f\xc8\x2d\xae\x89\xf3\x29\x47\x9c\x29\x85\xb6\xe7\x20\x30\xca\xb0\x29\xb6\x90\x4d\x5c\x97\x7e\xd7\x4e\x02\xcf\x6c\x81\xde\xbd\x6e\x76\xc0\x79\xf7\xae\x25\xc8\x60\xdb\xae\x44\xb8\xbc\x84\xde\x64\x36\x4d\x17\xd3\x5e\xd3\x64\xa3\x11\xdc\x63\xd8\x93\x32\x25\x33\xa1\x76\x20\x50\xa1\xc7\xda\x2e\xa3\x43\x00\x3b\xc2\x18\xd2\xc2\x43\xab\x08\x3e\x4a\xe7\xa5\x2e\xa0\xe6\x91\x2d\x4d\xdd\x06\x2e\x74\x10\x67\x95\xa3\x5a\x3e\x19\x51\xde\xd0\xbe\x61\x91\x58\x87\xa6\x43\x68\x46\xa6\x64\xb7\x9f\xe4\xd2\x3a\x0f\xa5\x62\x1c\x13\xc2\xeb\x8c\x79\x39\xfb\x4d\x9f\x93\xea\x59\x68\xd0\x00\xb4\x1f\x7f\x4c\xd1\xf8\x24\xf5\x0e\xfa\x2d\xc6\x20\x8e\x22\xdb\x4a\x1f\x60\x5f\xec\x09\xc3\x79\x2c\x0f\xe9\x82\xd6\x0e\xdc\x20\x11\x6c\xe0\x8a\x7a\x54\x92\xae\x7f\xfd\xd6\xcc\x66\x74\x49\x1c\xd1\xbb\x83\xae\x57\xa6\x38\xee\x7a\x51\x87\x85\x57\xd6\x52\xfe\x3b\x82\xce\x89\x01\xfe\xac\x9c\xa7\x98\x5a\x0a\x4f\xc3\x25\xcf\x51\x68\x20\x4c\x9a\xc5\x83\xef\xa9\x92\xa6\x5a\x98\x22\xa4\xae\x99\x61\xf5\xae\x57\x1a\x8f\xda\x4b\xa6\xd4\x8e\xf2\xb0\xb5\xb4\xe4\xd0\x5a\x33\x04\x27\x49\x2a\xf0\x51\x10\x95\x9a\xab\x4a\xd4\x65\x10\xaa\xbc\xc1\x73\xc1\xe6\xe3\xed\x68\x8d\xce\xb1\x02\x13\xaa\xa4\x5c\x3e\x36\xfb\xa5\x86\x5e\x4d\x81\xfd\x41\x2f\xe9\x8c\x3c\x26\x20\x65\x8a\xa4\x2d\x32\x22\xf1\x54\x08\x8b\xce\xf5\x07\x0d\x23\x75\x99\xbd\x5f\xa2\xa6\xe0\x83\xc6\x2d\x74\x8b\x0b\xe3\x9c\x16\x39\x31\x04\x26\x04\x11\xdf\xc9\x92\x11\x47\x91\xdb\x4a\xcf\x97\x10\x34\x99\x72\xdf\x8b\x83\xa6\xfe\x39\x73\x08\x6f\xa6\xff\x5e\x4c\x6e\x3f\x4e\x27\xb7\x77\x0f\x6f\xc6\x70\x74\x36\xbf\xfa\xcf\xb4\x3b\xfb\x90\x5e\xa7\x37\x93\xe9\x9b\x71\x98\xdc\xcf\x38\xe4\x4d\xeb\x02\x29\x74\x9e\xf1\x55\x52\x22\xae\xfa\xef\x8f\x79\x60\xef\x60\x14\x65\x16\xd9\xea\x62\x6f\x4c\xdd\xa0\x8d\x8e\x96\x90\xe1\x12\x5e\x0c\xd6\xc5\xcb\xd6\x4c\x1a\xf9\x7e\x4b\xf3\xfb\x45\x25\x50\xc5\xeb\x76\x9c\xff\x65\x43\x42\xef\x30\xbe\x1a\x83\x63\x8a\xf6\x63\xf9\x5f\xfa\x5f\x93\xe7\x0e\xfd\x10\x50\x0b\xb3\x25\xe6\xeb\x50\xeb\x9b\x06\xf7\x20\x64\x67\x83\x9a\x5f\x6f\xf3\xfe\xa0\x13\x26\xb0\xef\x45\xcf\x9f\x13\x45\x2d\xe0\xb2\x45\x7f\x1b\x5e\xbe\x1e\xa8\xf3\x26\x52\x27\x0a\x7e\x39\xd9\xff\xc2\xfd\x1a\xd7\xc6\xee\x9a\x61\x75\xe0\xdf\x8f\xa3\x9a\x5e\x5f\x77\xf5\x44\x1f\x54\x64\xdd\xc1\xc7\xe9\xf5\xf4\x73\xba\x98\x1e\x49\xcd\x17\xe9\xe2\x6a\x52\x1f\xfd\xe5\xc2\x3b\xfb\xe9\xc2\xeb\xcd\xe7\x8b\xdb\xd9\xb4\x37\x6e\xbe\xae\x6f\xd3\x8f\xbd\xef\x14\x36\x3b\xe2\x8f\x5a\xd7\x9b\x7b\x63\xc5\xff\xd3\x01\x07\xfb\x5a\xce\x9e\x5b\xd7\x02\xb5\x73\x5f\x9d\xfc\x1d\x02\xa6\x5b\x56\xce\xeb\xbf\x84\x51\x78\xff\x2c\x0f\x3f\xc5\x4f\xf1\xff\x02\x00\x00\xff\xff\x4c\x7e\x8c\xce\xa8\x10\x00\x00") +var _prestate_tracerJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xdd\x6f\xdb\x38\x12\x7f\xb6\xfe\x8a\x41\x5f\x6c\x5d\x5d\xb9\xcd\x02\x7b\x80\x73\x39\x40\x75\xdd\x36\x40\x36\x09\x6c\xe7\x72\xb9\xc5\x3e\x50\xe4\x48\xe6\x9a\x26\x05\x92\xb2\xe3\x2b\xf2\xbf\x1f\x86\xfa\xf0\x47\x93\xa6\x7b\x6f\x16\x39\xfc\xcd\xf7\x6f\xc6\xa3\x11\x4c\x4c\xb9\xb3\xb2\x58\x7a\x38\x7b\xff\xe1\xef\xb0\x58\x22\x14\xe6\x1d\xfa\x25\x5a\xac\xd6\x90\x56\x7e\x69\xac\x8b\x46\x23\x58\x2c\xa5\x83\x5c\x2a\x04\xe9\xa0\x64\xd6\x83\xc9\xc1\x9f\xc8\x2b\x99\x59\x66\x77\x49\x34\x1a\xd5\x6f\x9e\xbd\x26\x84\xdc\x22\x82\x33\xb9\xdf\x32\x8b\x63\xd8\x99\x0a\x38\xd3\x60\x51\x48\xe7\xad\xcc\x2a\x8f\x20\x3d\x30\x2d\x46\xc6\xc2\xda\x08\x99\xef\x08\x52\x7a\xa8\xb4\x40\x1b\x54\x7b\xb4\x6b\xd7\xda\xf1\xe5\xfa\x0e\xae\xd0\x39\xb4\xf0\x05\x35\x5a\xa6\xe0\xb6\xca\x94\xe4\x70\x25\x39\x6a\x87\xc0\x1c\x94\x74\xe2\x96\x28\x20\x0b\x70\xf4\xf0\x33\x99\x32\x6f\x4c\x81\xcf\xa6\xd2\x82\x79\x69\xf4\x10\x50\x92\xe5\xb0\x41\xeb\xa4\xd1\xf0\x4b\xab\xaa\x01\x1c\x82\xb1\x04\x32\x60\x9e\x1c\xb0\x60\x4a\x7a\x17\x03\xd3\x3b\x50\xcc\xef\x9f\xfe\x44\x40\xf6\x7e\x0b\x90\x3a\xa8\x59\x9a\x12\xc1\x2f\x99\x27\xaf\xb7\x52\x29\xc8\x10\x2a\x87\x79\xa5\x86\x84\x96\x55\x1e\xee\x2f\x17\x5f\x6f\xee\x16\x90\x5e\x3f\xc0\x7d\x3a\x9b\xa5\xd7\x8b\x87\x73\xd8\x4a\xbf\x34\x95\x07\xdc\x60\x0d\x25\xd7\xa5\x92\x28\x60\xcb\xac\x65\xda\xef\xc0\xe4\x84\xf0\xdb\x74\x36\xf9\x9a\x5e\x2f\xd2\x8f\x97\x57\x97\x8b\x07\x30\x16\x3e\x5f\x2e\xae\xa7\xf3\x39\x7c\xbe\x99\x41\x0a\xb7\xe9\x6c\x71\x39\xb9\xbb\x4a\x67\x70\x7b\x37\xbb\xbd\x99\x4f\x13\x98\x23\x59\x85\xf4\xfe\xf5\x98\xe7\x21\x7b\x16\x41\xa0\x67\x52\xb9\x36\x12\x0f\xa6\x02\xb7\x34\x95\x12\xb0\x64\x1b\x04\x8b\x1c\xe5\x06\x05\x30\xe0\xa6\xdc\xfd\x74\x52\x09\x8b\x29\xa3\x8b\xe0\xf3\x8b\x05\x09\x97\x39\x68\xe3\x87\xe0\x10\xe1\x1f\x4b\xef\xcb\xf1\x68\xb4\xdd\x6e\x93\x42\x57\x89\xb1\xc5\x48\xd5\x70\x6e\xf4\xcf\x24\x22\xcc\xd2\xa2\xf3\xcc\xe3\xc2\x32\x8e\x16\x4c\xe5\xcb\xca\x3b\x70\x55\x9e\x4b\x2e\x51\x7b\x90\x3a\x37\x76\x1d\x2a\x05\xbc\x01\x6e\x91\x79\x04\x06\xca\x70\xa6\x00\x1f\x91\x57\xe1\xae\x8e\x74\x28\x57\xcb\xb4\x63\x3c\x9c\xe6\xd6\xac\xc9\xd7\xca\x79\xfa\xe1\x1c\xae\x33\x85\x02\x0a\xd4\xe8\xa4\x83\x4c\x19\xbe\x4a\xa2\x6f\x51\xef\xc0\x18\xaa\x93\xe0\x61\x23\x14\x6a\x63\x8b\x7d\x8b\x90\x55\x52\x09\xa9\x8b\x24\xea\xb5\xd2\x63\xd0\x95\x52\xc3\x28\x40\x28\x63\x56\x55\x99\x72\x6e\xaa\x60\xfb\x9f\xc8\x7d\x0d\xe6\x4a\xe4\x32\xa7\xe2\x60\xdd\xad\x37\xe1\xaa\xd3\x6b\x32\x92\x4f\xa2\xde\x11\xcc\x18\xf2\x4a\x07\x77\x06\x4c\x08\x3b\x04\x91\xc5\xdf\xa2\x5e\x6f\xc3\x2c\x61\xc1\x05\x78\xf3\x15\x1f\xc3\x65\x7c\x1e\xf5\x7a\x32\x87\x81\x5f\x4a\x97\xb4\xc0\xbf\x33\xce\xff\x80\x8b\x8b\x8b\xd0\xd4\xb9\xd4\x28\x62\x20\x88\xde\x73\x62\xf5\x4d\x2f\x63\x8a\x69\x8e\x63\xe8\xbf\x7f\xec\xc3\x5b\x10\x59\x52\xa0\xff\x58\x9f\xd6\xca\x12\x6f\xe6\xde\x4a\x5d\x0c\x3e\xfc\x1a\x0f\xc3\x2b\x6d\xc2\x1b\x68\xc4\xaf\x4d\x27\x5c\xdf\x73\x23\xc2\x75\x63\x73\x2d\x35\x31\xa2\x11\x6a\xa4\x9c\x37\x96\x15\x38\x86\x6f\x4f\xf4\xfd\x44\x5e\x3d\x45\xbd\xa7\xa3\x28\xcf\x6b\xa1\x17\xa2\xdc\x40\x00\x6a\x6f\xbb\x3a\x2f\x24\x75\xea\x61\x02\x02\xde\x8f\x92\x30\x6f\x4d\x39\x49\xc2\x0a\x77\xaf\x67\x82\x2e\xa4\x78\xec\x2e\x56\xb8\x8b\xcf\xa3\x17\x53\x94\x34\x46\xff\x2e\xc5\xe3\xcf\xe6\xeb\xe4\xcd\x51\x5c\xe7\x24\xb5\xb7\x37\x8e\x4f\xe2\x68\xd1\x55\xca\x53\xb9\x4b\xbd\x31\x2b\x22\xae\x25\xc5\x47\xa9\x10\x12\x53\x52\xb6\x5c\xcd\x1c\x19\xa2\x06\xe9\xd1\x32\xa2\x4e\xb3\x41\x4b\x53\x03\x2c\xfa\xca\x6a\xd7\x85\x31\x97\x9a\xa9\x16\xb8\x89\xba\xb7\x8c\xd7\x3d\x53\x9f\x1f\xc4\x92\xfb\xc7\x10\xc5\xe0\xdd\x68\x04\xa9\x07\x72\x11\x4a\x23\xb5\x1f\xc2\x16\x41\x23\x0a\x6a\x7c\x81\xa2\xe2\x3e\xe0\xf5\x37\x4c\x55\xd8\xaf\x9b\x9b\x28\x32\x3c\x35\x15\x4d\x82\x83\xe6\x1f\x06\x03\xd7\x66\x13\x46\x5c\xc6\xf8\x0a\x9a\x86\x33\x56\x16\x52\x47\x4d\x38\x8f\x9a\x8d\x2c\x4a\x08\x38\x98\x15\x72\x45\x49\xa4\x93\x8f\x4c\xc1\x05\x64\xb2\xb8\xd4\xfe\x24\x79\x75\xd0\xdb\xa7\xf1\x1f\x49\xd3\x3c\x89\x23\xc2\x1b\x9c\xc5\x43\xf8\xf0\x6b\x57\x11\xde\x10\x14\xbc\x0e\xe6\xcd\xcb\x50\xd1\x69\x31\x3c\xff\x2c\xa8\xa1\x0e\x7e\x1b\xb4\x26\xae\xca\x28\x1d\xb5\x9f\x21\x8e\xc7\x5d\x7c\xfe\x03\xdc\x63\xdf\x5a\xdc\x26\x34\x09\x13\xe2\x10\x94\x3e\xc3\x77\xc1\xdc\x9d\x43\x01\x6f\x81\xbe\xa4\x26\x55\x4e\xf2\x2f\xcc\xc5\xf0\x37\x68\x24\x6e\xad\xe4\xdf\x59\x52\xe7\xf5\x13\x72\x8b\x6b\x1a\x05\x94\x3a\xce\x94\x42\xdb\x77\x10\x88\x66\xd8\xd4\x60\x48\x32\xae\x4b\xbf\x6b\x07\x84\x67\xb6\x40\xef\x5e\xf7\x26\xe0\xbc\x7b\xd7\xf2\x66\x88\xdf\xae\x44\xb8\xb8\x80\xfe\x64\x36\x4d\x17\xd3\x7e\xd3\x7b\xa3\x11\xdc\x63\x58\x9f\x32\x25\x33\xa1\x76\x20\x50\xa1\xc7\xda\x2e\xa3\x43\x5c\x3b\x1e\x19\xd2\x1e\x44\x1b\x0a\x3e\x4a\xe7\xa5\x2e\xa0\xa6\x97\x2d\x0d\xe3\x06\x2e\x34\x16\x67\x15\x85\xe7\x74\x72\x79\x43\x6b\x88\x45\x22\x23\x1a\x1a\xa1\x47\x99\x92\xdd\xda\x92\x4b\xeb\x3c\x94\x8a\x71\x4c\x08\xaf\x33\xe6\xe5\xa2\x68\xda\x9f\x54\xcf\x42\xdf\x06\xa0\xfd\x54\x64\x8a\xa6\x2a\xa9\x77\x30\x68\x31\xe2\xa8\xd7\xb3\xad\xf4\x01\xf6\xf9\x9e\x47\x9c\xc7\xf2\x90\x45\x68\x1b\xc1\x0d\x12\xef\x06\x0a\xa9\x27\x28\xe9\xfa\xd7\x6f\xcd\xc8\x46\x97\x44\x3d\x7a\x77\x40\x06\xca\x14\xc7\x64\x20\xea\xb0\xf0\xca\x5a\xca\x7f\xc7\xdb\x39\x11\xc3\x9f\x95\xf3\x14\x53\x4b\xe1\x69\x28\xe6\x39\x66\x0d\x3c\x4a\x23\x3a\xfe\x9e\x41\x69\xd8\x85\xe1\x42\xea\x9a\xd1\x56\xaf\x80\xa5\xf1\xa8\xbd\x64\x4a\xed\x28\x0f\x5b\x4b\xbb\x0f\x6d\x3b\x43\x70\x92\xa4\x02\x4d\x05\x51\xa9\xb9\xaa\x44\x5d\x06\xa1\xf8\x1b\x3c\x17\x6c\x3e\x5e\x9a\xd6\xe8\x1c\x2b\x30\xa1\x4a\xca\xe5\x63\xb3\x76\x6a\xe8\xd7\xcc\x38\x88\xfb\x49\x67\xe4\x31\x2f\x29\x53\x24\x6d\x91\x11\xb7\xa7\x42\x58\x74\x6e\x10\x37\x44\xd5\x65\xf6\x7e\x89\x9a\x82\x0f\x1a\xb7\xd0\xed\x33\x8c\x73\xda\xef\xc4\x10\x98\x10\xc4\x87\x27\xbb\x47\xd4\xeb\xb9\xad\xf4\x7c\x09\x41\x93\x29\xf7\xbd\x18\x37\xf5\xcf\x99\x43\x78\x33\xfd\xf7\x62\x72\xf3\x69\x3a\xb9\xb9\x7d\x78\x33\x86\xa3\xb3\xf9\xe5\x7f\xa6\xdd\xd9\xc7\xf4\x2a\xbd\x9e\x4c\xdf\x8c\xc3\x40\x7f\xc6\x21\x6f\x5a\x17\x48\xa1\xf3\x8c\xaf\x92\x12\x71\x35\x78\x7f\xcc\x03\x7b\x07\x7b\xbd\xcc\x22\x5b\x9d\xef\x8d\xa9\x1b\xb4\xd1\xd1\xf2\x34\x5c\xc0\x8b\xc1\x3a\x7f\xd9\x9a\x49\x23\x3f\x68\xd9\x7f\xbf\xbf\x04\xaa\x78\xdd\x8e\xb3\xbf\x6c\x48\xe8\x1d\xc6\x57\x63\x70\x4c\xd1\xda\x2c\xff\x4b\x7f\x77\xf2\xdc\xa1\x1f\x02\x6a\x61\xb6\xc4\x7c\x1d\x6a\x7d\xd3\xe0\x1e\x84\xec\x43\x5c\xd3\xee\x4d\x3e\x88\x3b\x61\x02\xfb\x5e\xf4\xec\x39\x51\xd4\x02\x2e\x5a\xf4\xb7\xe1\xe5\xeb\x81\x3a\x6b\x22\x75\xa2\xe0\x97\x93\xb5\x30\xdc\xaf\x71\x6d\xec\xae\x99\x61\x07\xfe\xfd\x38\xaa\xe9\xd5\x55\x57\x4f\xf4\x41\x45\xd6\x1d\x7c\x9a\x5e\x4d\xbf\xa4\x8b\xe9\x91\xd4\x7c\x91\x2e\x2e\x27\xf5\xd1\x5f\x2e\xbc\x0f\x3f\x5d\x78\xfd\xf9\x7c\x71\x33\x9b\xf6\xc7\xcd\xd7\xd5\x4d\xfa\xa9\xff\x9d\xc2\x66\x75\xfc\x51\xeb\x7a\x73\x6f\xac\xf8\x7f\x3a\xe0\x60\x8d\xcb\xd9\x73\x5b\x5c\xa0\x76\xee\xab\x93\x7f\x49\xc0\x74\xcb\xca\x79\xfd\x4f\xb1\x17\xde\x3f\xcb\xc3\x4f\xd1\x53\xf4\xbf\x00\x00\x00\xff\xff\x3a\xb7\x37\x41\xbf\x10\x00\x00") func prestate_tracerJsBytes() ([]byte, error) { return bindataRead( @@ -213,7 +221,7 @@ func prestate_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe7, 0xe9, 0xd4, 0x9b, 0xe9, 0xc4, 0x8e, 0xad, 0xa8, 0xa9, 0x5d, 0xa5, 0xf2, 0xb1, 0x53, 0x79, 0xa6, 0xa3, 0x24, 0xd5, 0xce, 0x8b, 0x80, 0x32, 0xbb, 0xbc, 0xd0, 0x3c, 0xf3, 0x9, 0xd9, 0xd1}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -233,7 +241,7 @@ func trigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "trigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x40, 0x63, 0xe1, 0x42, 0x60, 0x7, 0x1b, 0x79, 0x47, 0x1, 0xa1, 0xbf, 0xc4, 0x66, 0x19, 0x9b, 0x2b, 0x5a, 0x1f, 0x82, 0x3d, 0xcf, 0xee, 0xe7, 0x60, 0x25, 0x2c, 0x4f, 0x13, 0x97, 0xc7, 0x18}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -253,7 +261,7 @@ func unigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "unigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2f, 0x36, 0x14, 0xc2, 0xf6, 0xc3, 0x80, 0x2b, 0x4a, 0x11, 0x7d, 0xd5, 0x3e, 0xef, 0x23, 0xb5, 0xd6, 0xe6, 0xe6, 0x5, 0x41, 0xf6, 0x14, 0x7a, 0x39, 0xf7, 0xf8, 0xac, 0x89, 0x8e, 0x43, 0xe6}} + a := &asset{bytes: bytes, info: info} return a, nil } @@ -261,8 +269,8 @@ func unigram_tracerJs() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -272,12 +280,6 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } -// AssetString returns the asset contents as a string (instead of a []byte). -func AssetString(name string) (string, error) { - data, err := Asset(name) - return string(data), err -} - // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -289,18 +291,12 @@ func MustAsset(name string) []byte { return a } -// MustAssetString is like AssetString but panics when Asset would return an -// error. It simplifies safe initialization of global variables. -func MustAssetString(name string) string { - return string(MustAsset(name)) -} - // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -310,33 +306,6 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } -// AssetDigest returns the digest of the file with the given name. It returns an -// error if the asset could not be found or the digest could not be loaded. -func AssetDigest(name string) ([sha256.Size]byte, error) { - canonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[canonicalName]; ok { - a, err := f() - if err != nil { - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) - } - return a.digest, nil - } - return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) -} - -// Digests returns a map of all known files and their checksums. -func Digests() (map[string][sha256.Size]byte, error) { - mp := make(map[string][sha256.Size]byte, len(_bindata)) - for name := range _bindata { - a, err := _bindata[name]() - if err != nil { - return nil, err - } - mp[name] = a.digest - } - return mp, nil -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -359,9 +328,6 @@ var _bindata = map[string]func() (*asset, error){ "unigram_tracer.js": unigram_tracerJs, } -// AssetDebug is true if the assets were built with the debug flag enabled. -const AssetDebug = false - // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -371,15 +337,15 @@ const AssetDebug = false // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"}, -// AssetDir("data/img") would return []string{"a.png", "b.png"}, -// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - canonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(canonicalName, "/") + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -414,7 +380,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "unigram_tracer.js": {unigram_tracerJs, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory. +// RestoreAsset restores an asset under the given directory func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -432,10 +398,14 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil } -// RestoreAssets restores an asset under the given directory recursively. +// RestoreAssets restores an asset under the given directory recursively func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -453,6 +423,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - canonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } diff --git a/eth/tracers/internal/tracers/prestate_tracer.js b/eth/tracers/internal/tracers/prestate_tracer.js index 31d67f7ad427..084c04ec46b8 100644 --- a/eth/tracers/internal/tracers/prestate_tracer.js +++ b/eth/tracers/internal/tracers/prestate_tracer.js @@ -55,7 +55,7 @@ var toBal = bigInt(this.prestate[toHex(ctx.to)].balance.slice(2), 16); this.prestate[toHex(ctx.to)].balance = '0x'+toBal.subtract(ctx.value).toString(16); - this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).add(ctx.txGas * ctx.gasPrice).toString(16); + this.prestate[toHex(ctx.from)].balance = '0x'+fromBal.add(ctx.value).add((ctx.gasUsed + ctx.intrinsicGas) * ctx.gasPrice).toString(16); // Decrement the caller's nonce, and remove empty create targets this.prestate[toHex(ctx.from)].nonce--; diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index 704ba9181e74..f2ad6b4e8e62 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -27,10 +27,10 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/params" duktape "gopkg.in/olebedev/go-duktape.v3" ) @@ -337,7 +337,6 @@ func New(code string, txCtx vm.TxContext) (*Tracer, error) { refundValue: new(uint), } tracer.ctx["gasPrice"] = txCtx.GasPrice - tracer.ctx["txGas"] = params.TxGas // Set up builtins for this environment tracer.vm.PushGlobalGoFunction("toHex", func(ctx *duktape.Context) int { @@ -550,6 +549,20 @@ func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost // Initialize the context if it wasn't done yet if !jst.inited { jst.ctx["block"] = env.Context.BlockNumber.Uint64() + + // Compute intrinsic gas + isHomestead := env.ChainConfig().IsHomestead(env.Context.BlockNumber) + isIstanbul := env.ChainConfig().IsIstanbul(env.Context.BlockNumber) + input, ok := jst.ctx["input"].([]byte) + if !ok { + return errors.New("Tracer received invalid input data") + } + intrinsicGas, err := core.IntrinsicGas(input, jst.ctx["type"] == "CREATE", isHomestead, isIstanbul) + if err != nil { + return err + } + jst.ctx["intrinsicGas"] = intrinsicGas + jst.inited = true } // If tracing was interrupted, set the error and stop @@ -601,8 +614,8 @@ func (jst *Tracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost // CaptureEnd is called after the call finishes to finalize the tracing. func (jst *Tracer) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error { jst.ctx["output"] = output - jst.ctx["gasUsed"] = gasUsed jst.ctx["time"] = t.String() + jst.ctx["gasUsed"] = gasUsed if err != nil { jst.ctx["error"] = err.Error() diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index c619b026f9f9..16551a2447c4 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -65,6 +65,9 @@ func runTrace(tracer *Tracer, vmctx VMContext) (json.RawMessage, error) { contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000) contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0} + // Needed for intrinsic gas computation + tracer.ctx["input"] = []byte{} + _, err := env.Interpreter().Run(contract, []byte{}, false) if err != nil { return nil, err @@ -182,6 +185,8 @@ func TestHaltBetweenSteps(t *testing.T) { if err != nil { t.Fatal(err) } + // Needed for intrinsic gas computation + tracer.ctx["input"] = []byte{} env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0) diff --git a/eth/tracers/tracers_test.go b/eth/tracers/tracers_test.go index ee27e475cc43..9dc4c696311c 100644 --- a/eth/tracers/tracers_test.go +++ b/eth/tracers/tracers_test.go @@ -173,7 +173,7 @@ func TestPrestateTracerCreate2(t *testing.T) { _, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), alloc, false) // Create the tracer, the EVM environment and run it - tracer, err := New("prestateTracer", context) + tracer, err := New("prestateTracer", txContext) if err != nil { t.Fatalf("failed to create call tracer: %v", err) } @@ -248,7 +248,7 @@ func TestCallTracer(t *testing.T) { _, statedb := tests.MakePreState(rawdb.NewMemoryDatabase(), test.Genesis.Alloc, false) // Create the tracer, the EVM environment and run it - tracer, err := New("callTracer", context) + tracer, err := New("callTracer", txContext) if err != nil { t.Fatalf("failed to create call tracer: %v", err) } From f8173aba88569b3dfde62f3de281955af9c4a66c Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 21 Dec 2020 14:42:35 +0100 Subject: [PATCH 6/7] eth/tracers: regenerate assets + unexport test-struct + add testcase --- eth/tracers/internal/tracers/assets.go | 157 +++++++++++++++---------- eth/tracers/tracer.go | 6 +- eth/tracers/tracer_test.go | 54 ++++++--- 3 files changed, 135 insertions(+), 82 deletions(-) diff --git a/eth/tracers/internal/tracers/assets.go b/eth/tracers/internal/tracers/assets.go index 5baafbe95b70..8b89ad418203 100644 --- a/eth/tracers/internal/tracers/assets.go +++ b/eth/tracers/internal/tracers/assets.go @@ -1,19 +1,21 @@ -// Code generated for package tracers by go-bindata DO NOT EDIT. (@generated) +// Code generated by go-bindata. DO NOT EDIT. // sources: -// 4byte_tracer.js -// bigram_tracer.js -// call_tracer.js -// evmdis_tracer.js -// noop_tracer.js -// opcount_tracer.js -// prestate_tracer.js -// trigram_tracer.js -// unigram_tracer.js +// 4byte_tracer.js (2.933kB) +// bigram_tracer.js (1.712kB) +// call_tracer.js (8.956kB) +// evmdis_tracer.js (4.195kB) +// noop_tracer.js (1.271kB) +// opcount_tracer.js (1.372kB) +// prestate_tracer.js (4.287kB) +// trigram_tracer.js (1.788kB) +// unigram_tracer.js (1.51kB) + package tracers import ( "bytes" "compress/gzip" + "crypto/sha256" "fmt" "io" "io/ioutil" @@ -26,7 +28,7 @@ import ( func bindataRead(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } var buf bytes.Buffer @@ -34,7 +36,7 @@ func bindataRead(data []byte, name string) ([]byte, error) { clErr := gz.Close() if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) + return nil, fmt.Errorf("read %q: %v", name, err) } if clErr != nil { return nil, err @@ -44,8 +46,9 @@ func bindataRead(data []byte, name string) ([]byte, error) { } type asset struct { - bytes []byte - info os.FileInfo + bytes []byte + info os.FileInfo + digest [sha256.Size]byte } type bindataFileInfo struct { @@ -55,32 +58,21 @@ type bindataFileInfo struct { modTime time.Time } -// Name return file name func (fi bindataFileInfo) Name() string { return fi.name } - -// Size return file size func (fi bindataFileInfo) Size() int64 { return fi.size } - -// Mode return file mode func (fi bindataFileInfo) Mode() os.FileMode { return fi.mode } - -// Mode return file modify time func (fi bindataFileInfo) ModTime() time.Time { return fi.modTime } - -// IsDir return file whether a directory func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 + return false } - -// Sys return file is sys mode func (fi bindataFileInfo) Sys() interface{} { return nil } @@ -101,7 +93,7 @@ func _4byte_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "4byte_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb4, 0xc5, 0x48, 0x2d, 0xd9, 0x43, 0x95, 0x93, 0x3b, 0x93, 0x2c, 0x47, 0x8c, 0x84, 0x32, 0x3c, 0x8b, 0x2e, 0xf3, 0x72, 0xc4, 0x57, 0xe6, 0x3a, 0xb3, 0xdf, 0x1d, 0xbf, 0x45, 0x3, 0xfc, 0xa}} return a, nil } @@ -121,7 +113,7 @@ func bigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "bigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x77, 0x6c, 0xd, 0x24, 0xf2, 0x49, 0xbd, 0x58, 0x8b, 0xb5, 0xd1, 0xc9, 0xcd, 0xcf, 0x5b, 0x3e, 0x5c, 0xfb, 0x14, 0x50, 0xe7, 0xe3, 0xb9, 0xd1, 0x54, 0x69, 0xe6, 0x5e, 0x45, 0xa6, 0x2c, 0x6c}} return a, nil } @@ -141,7 +133,7 @@ func call_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "call_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x46, 0x79, 0xb6, 0xbc, 0xd2, 0xc, 0x25, 0xb1, 0x22, 0x56, 0xef, 0x77, 0xb9, 0x5e, 0x2e, 0xf4, 0xda, 0xb2, 0x2f, 0x53, 0xa4, 0xff, 0xc8, 0xac, 0xbb, 0x75, 0x22, 0x46, 0x59, 0xe3, 0x1d, 0x7d}} return a, nil } @@ -161,7 +153,7 @@ func evmdis_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "evmdis_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xb5, 0xc8, 0x73, 0x8e, 0xfb, 0x1f, 0x84, 0x7d, 0x37, 0xd9, 0x26, 0x24, 0x37, 0xb8, 0x65, 0xb1, 0xed, 0xa0, 0x76, 0x9a, 0xf0, 0x8e, 0x3a, 0x9b, 0x20, 0x93, 0x27, 0x26, 0x2e, 0xc9, 0x9b, 0xde}} return a, nil } @@ -181,7 +173,7 @@ func noop_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "noop_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe3, 0xf, 0x1c, 0x6f, 0x65, 0xaf, 0x90, 0x31, 0xab, 0xf, 0xe0, 0xca, 0x54, 0x7, 0xfd, 0xd3, 0xa1, 0x4a, 0x14, 0x1, 0x2a, 0x9d, 0xdc, 0xb9, 0x64, 0x69, 0x83, 0x30, 0xb1, 0x2a, 0xbd, 0xfb}} return a, nil } @@ -201,7 +193,7 @@ func opcount_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "opcount_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x27, 0xe, 0x97, 0x88, 0x9b, 0x53, 0xbb, 0x20, 0x44, 0xd8, 0xf5, 0xeb, 0x41, 0xd2, 0x7e, 0xd6, 0xda, 0x6b, 0xf5, 0xaf, 0x0, 0x75, 0x9f, 0xd9, 0x22, 0xc, 0x6e, 0x74, 0xac, 0x2a, 0xa9, 0xa7}} return a, nil } @@ -221,7 +213,7 @@ func prestate_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "prestate_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xd4, 0x9, 0xf9, 0x44, 0x13, 0x31, 0x89, 0xf7, 0x35, 0x9a, 0xc6, 0xf0, 0x86, 0x9d, 0xb2, 0xe3, 0x57, 0xe2, 0xc0, 0xde, 0xc9, 0x3a, 0x4c, 0x4a, 0x94, 0x90, 0xa5, 0x92, 0x2f, 0xbf, 0xc0, 0xb8}} return a, nil } @@ -241,7 +233,7 @@ func trigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "trigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x40, 0x63, 0xe1, 0x42, 0x60, 0x7, 0x1b, 0x79, 0x47, 0x1, 0xa1, 0xbf, 0xc4, 0x66, 0x19, 0x9b, 0x2b, 0x5a, 0x1f, 0x82, 0x3d, 0xcf, 0xee, 0xe7, 0x60, 0x25, 0x2c, 0x4f, 0x13, 0x97, 0xc7, 0x18}} return a, nil } @@ -261,7 +253,7 @@ func unigram_tracerJs() (*asset, error) { } info := bindataFileInfo{name: "unigram_tracer.js", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x2f, 0x36, 0x14, 0xc2, 0xf6, 0xc3, 0x80, 0x2b, 0x4a, 0x11, 0x7d, 0xd5, 0x3e, 0xef, 0x23, 0xb5, 0xd6, 0xe6, 0xe6, 0x5, 0x41, 0xf6, 0x14, 0x7a, 0x39, 0xf7, 0xf8, 0xac, 0x89, 0x8e, 0x43, 0xe6}} return a, nil } @@ -269,8 +261,8 @@ func unigram_tracerJs() (*asset, error) { // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) @@ -280,6 +272,12 @@ func Asset(name string) ([]byte, error) { return nil, fmt.Errorf("Asset %s not found", name) } +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + // MustAsset is like Asset but panics when Asset would return an error. // It simplifies safe initialization of global variables. func MustAsset(name string) []byte { @@ -291,12 +289,18 @@ func MustAsset(name string) []byte { return a } +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + // AssetInfo loads and returns the asset info for the given name. // It returns an error if the asset could not be found or // could not be loaded. func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { a, err := f() if err != nil { return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) @@ -306,6 +310,33 @@ func AssetInfo(name string) (os.FileInfo, error) { return nil, fmt.Errorf("AssetInfo %s not found", name) } +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -317,15 +348,23 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "4byte_tracer.js": _4byte_tracerJs, - "bigram_tracer.js": bigram_tracerJs, - "call_tracer.js": call_tracerJs, - "evmdis_tracer.js": evmdis_tracerJs, - "noop_tracer.js": noop_tracerJs, - "opcount_tracer.js": opcount_tracerJs, + "4byte_tracer.js": _4byte_tracerJs, + + "bigram_tracer.js": bigram_tracerJs, + + "call_tracer.js": call_tracerJs, + + "evmdis_tracer.js": evmdis_tracerJs, + + "noop_tracer.js": noop_tracerJs, + + "opcount_tracer.js": opcount_tracerJs, + "prestate_tracer.js": prestate_tracerJs, - "trigram_tracer.js": trigram_tracerJs, - "unigram_tracer.js": unigram_tracerJs, + + "trigram_tracer.js": trigram_tracerJs, + + "unigram_tracer.js": unigram_tracerJs, } // AssetDir returns the file names below a certain @@ -337,15 +376,15 @@ var _bindata = map[string]func() (*asset, error){ // img/ // a.png // b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and // AssetDir("") will return []string{"data"}. func AssetDir(name string) ([]string, error) { node := _bintree if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") for _, p := range pathList { node = node.Children[p] if node == nil { @@ -380,7 +419,7 @@ var _bintree = &bintree{nil, map[string]*bintree{ "unigram_tracer.js": {unigram_tracerJs, map[string]*bintree{}}, }} -// RestoreAsset restores an asset under the given directory +// RestoreAsset restores an asset under the given directory. func RestoreAsset(dir, name string) error { data, err := Asset(name) if err != nil { @@ -398,14 +437,10 @@ func RestoreAsset(dir, name string) error { if err != nil { return err } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) } -// RestoreAssets restores an asset under the given directory recursively +// RestoreAssets restores an asset under the given directory recursively. func RestoreAssets(dir, name string) error { children, err := AssetDir(name) // File @@ -423,6 +458,6 @@ func RestoreAssets(dir, name string) error { } func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) } diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index f2ad6b4e8e62..dfe855f86977 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -553,9 +553,9 @@ func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost // Compute intrinsic gas isHomestead := env.ChainConfig().IsHomestead(env.Context.BlockNumber) isIstanbul := env.ChainConfig().IsIstanbul(env.Context.BlockNumber) - input, ok := jst.ctx["input"].([]byte) - if !ok { - return errors.New("Tracer received invalid input data") + var input []byte + if data, ok := jst.ctx["input"].([]byte); ok { + input = data } intrinsicGas, err := core.IntrinsicGas(input, jst.ctx["type"] == "CREATE", isHomestead, isIstanbul) if err != nil { diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index 16551a2447c4..80926c1a7b29 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -50,25 +50,27 @@ type dummyStatedb struct { func (*dummyStatedb) GetRefund() uint64 { return 1337 } -type VMContext struct { +type vmContext struct { blockCtx vm.BlockContext txCtx vm.TxContext } -func vmContext() VMContext { - return VMContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1)}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}} +func testCtx() *vmContext { + return &vmContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1)}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}} } -func runTrace(tracer *Tracer, vmctx VMContext) (json.RawMessage, error) { +func runTrace(tracer *Tracer, vmctx *vmContext) (json.RawMessage, error) { env := vm.NewEVM(vmctx.blockCtx, vmctx.txCtx, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) - - contract := vm.NewContract(account{}, account{}, big.NewInt(0), 10000) + var( + startGas uint64 = 10000 + value = big.NewInt(0) + ) + contract := vm.NewContract(account{}, account{}, value, startGas) contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0} - // Needed for intrinsic gas computation - tracer.ctx["input"] = []byte{} - - _, err := env.Interpreter().Run(contract, []byte{}, false) + tracer.CaptureStart(contract.Caller(), contract.Address(), false, []byte{}, startGas, value) + ret, err := env.Interpreter().Run(contract, []byte{}, false) + tracer.CaptureEnd(ret, startGas-contract.Gas, 1, err) if err != nil { return nil, err } @@ -77,7 +79,7 @@ func runTrace(tracer *Tracer, vmctx VMContext) (json.RawMessage, error) { // TestRegressionPanicSlice tests that we don't panic on bad arguments to memory access func TestRegressionPanicSlice(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -89,7 +91,7 @@ func TestRegressionPanicSlice(t *testing.T) { // TestRegressionPanicSlice tests that we don't panic on bad arguments to stack peeks func TestRegressionPanicPeek(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -101,7 +103,7 @@ func TestRegressionPanicPeek(t *testing.T) { // TestRegressionPanicSlice tests that we don't panic on bad arguments to memory getUint func TestRegressionPanicGetUint(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -112,7 +114,7 @@ func TestRegressionPanicGetUint(t *testing.T) { } func TestTracing(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -128,7 +130,7 @@ func TestTracing(t *testing.T) { } func TestStack(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.length()); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -144,7 +146,7 @@ func TestStack(t *testing.T) { } func TestOpcodes(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{opcodes: [], step: function(log) { this.opcodes.push(log.op.toString()); }, fault: function() {}, result: function() { return this.opcodes; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -163,7 +165,7 @@ func TestHalt(t *testing.T) { t.Skip("duktape doesn't support abortion") timeout := errors.New("stahp") - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{step: function() { while(1); }, result: function() { return null; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -180,7 +182,7 @@ func TestHalt(t *testing.T) { } func TestHaltBetweenSteps(t *testing.T) { - vmctx := vmContext() + vmctx := testCtx() tracer, err := New("{step: function() {}, fault: function() {}, result: function() { return null; }}", vmctx.txCtx) if err != nil { t.Fatal(err) @@ -200,3 +202,19 @@ func TestHaltBetweenSteps(t *testing.T) { t.Errorf("Expected timeout error, got %v", err) } } + +func TestIntrinsicGas(t *testing.T) { + vmctx := testCtx() + tracer, err := New("{depths: [], step: function() {}, fault: function() {}, result: function(ctx) { return ctx.gasPrice+'.'+ctx.gasUsed+'.'+ctx.intrinsicGas; }}", vmctx.txCtx) + if err != nil { + t.Fatal(err) + } + + ret, err := runTrace(tracer, vmctx) + if err != nil { + t.Fatal(err) + } + if have, want := ret, []byte(`"100000.6.21000"`); !bytes.Equal(have, want) { + t.Errorf("Expected return value to be %s got %s", string(want), string(have)) + } +} From 87dffcff2de23b5c9021bf73ef5dfad6c9b413e5 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 21 Dec 2020 15:14:42 +0100 Subject: [PATCH 7/7] eth/tracers: simplify tests + make table-driven --- eth/tracers/tracer.go | 2 - eth/tracers/tracer_test.go | 149 ++++++++++++------------------------- 2 files changed, 46 insertions(+), 105 deletions(-) diff --git a/eth/tracers/tracer.go b/eth/tracers/tracer.go index dfe855f86977..c9f00d7371ed 100644 --- a/eth/tracers/tracer.go +++ b/eth/tracers/tracer.go @@ -549,7 +549,6 @@ func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost // Initialize the context if it wasn't done yet if !jst.inited { jst.ctx["block"] = env.Context.BlockNumber.Uint64() - // Compute intrinsic gas isHomestead := env.ChainConfig().IsHomestead(env.Context.BlockNumber) isIstanbul := env.ChainConfig().IsIstanbul(env.Context.BlockNumber) @@ -562,7 +561,6 @@ func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost return err } jst.ctx["intrinsicGas"] = intrinsicGas - jst.inited = true } // If tracing was interrupted, set the error and stop diff --git a/eth/tracers/tracer_test.go b/eth/tracers/tracer_test.go index 80926c1a7b29..f28e14864bd1 100644 --- a/eth/tracers/tracer_test.go +++ b/eth/tracers/tracer_test.go @@ -17,7 +17,6 @@ package tracers import ( - "bytes" "encoding/json" "errors" "math/big" @@ -61,9 +60,9 @@ func testCtx() *vmContext { func runTrace(tracer *Tracer, vmctx *vmContext) (json.RawMessage, error) { env := vm.NewEVM(vmctx.blockCtx, vmctx.txCtx, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) - var( + var ( startGas uint64 = 10000 - value = big.NewInt(0) + value = big.NewInt(0) ) contract := vm.NewContract(account{}, account{}, value, startGas) contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x1, 0x0} @@ -77,87 +76,50 @@ func runTrace(tracer *Tracer, vmctx *vmContext) (json.RawMessage, error) { return tracer.GetResult() } -// TestRegressionPanicSlice tests that we don't panic on bad arguments to memory access -func TestRegressionPanicSlice(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - if _, err = runTrace(tracer, vmctx); err != nil { - t.Fatal(err) - } -} - -// TestRegressionPanicSlice tests that we don't panic on bad arguments to stack peeks -func TestRegressionPanicPeek(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - if _, err = runTrace(tracer, vmctx); err != nil { - t.Fatal(err) - } -} - -// TestRegressionPanicSlice tests that we don't panic on bad arguments to memory getUint -func TestRegressionPanicGetUint(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - if _, err = runTrace(tracer, vmctx); err != nil { - t.Fatal(err) - } -} - -func TestTracing(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - - ret, err := runTrace(tracer, vmctx) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(ret, []byte("3")) { - t.Errorf("Expected return value to be 3, got %s", string(ret)) - } -} - -func TestStack(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{depths: [], step: function(log) { this.depths.push(log.stack.length()); }, fault: function() {}, result: function() { return this.depths; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - - ret, err := runTrace(tracer, vmctx) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(ret, []byte("[0,1,2]")) { - t.Errorf("Expected return value to be [0,1,2], got %s", string(ret)) - } -} - -func TestOpcodes(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{opcodes: [], step: function(log) { this.opcodes.push(log.op.toString()); }, fault: function() {}, result: function() { return this.opcodes; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - - ret, err := runTrace(tracer, vmctx) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(ret, []byte("[\"PUSH1\",\"PUSH1\",\"STOP\"]")) { - t.Errorf("Expected return value to be [\"PUSH1\",\"PUSH1\",\"STOP\"], got %s", string(ret)) +func TestTracer(t *testing.T) { + execTracer := func(code string) []byte { + t.Helper() + ctx := &vmContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1)}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}} + tracer, err := New(code, ctx.txCtx) + if err != nil { + t.Fatal(err) + } + ret, err := runTrace(tracer, ctx) + if err != nil { + t.Fatal(err) + } + return ret + } + for i, tt := range []struct { + code string + want string + }{ + { // tests that we don't panic on bad arguments to memory access + code: "{depths: [], step: function(log) { this.depths.push(log.memory.slice(-1,-2)); }, fault: function() {}, result: function() { return this.depths; }}", + want: `[{},{},{}]`, + }, { // tests that we don't panic on bad arguments to stack peeks + code: "{depths: [], step: function(log) { this.depths.push(log.stack.peek(-1)); }, fault: function() {}, result: function() { return this.depths; }}", + want: `["0","0","0"]`, + }, { // tests that we don't panic on bad arguments to memory getUint + code: "{ depths: [], step: function(log, db) { this.depths.push(log.memory.getUint(-64));}, fault: function() {}, result: function() { return this.depths; }}", + want: `["0","0","0"]`, + }, { // tests some general counting + code: "{count: 0, step: function() { this.count += 1; }, fault: function() {}, result: function() { return this.count; }}", + want: `3`, + }, { // tests that depth is reported correctly + code: "{depths: [], step: function(log) { this.depths.push(log.stack.length()); }, fault: function() {}, result: function() { return this.depths; }}", + want: `[0,1,2]`, + }, { // tests to-string of opcodes + code: "{opcodes: [], step: function(log) { this.opcodes.push(log.op.toString()); }, fault: function() {}, result: function() { return this.opcodes; }}", + want: `["PUSH1","PUSH1","STOP"]`, + }, { // tests intrinsic gas + code: "{depths: [], step: function() {}, fault: function() {}, result: function(ctx) { return ctx.gasPrice+'.'+ctx.gasUsed+'.'+ctx.intrinsicGas; }}", + want: `"100000.6.21000"`, + }, + } { + if have := execTracer(tt.code); tt.want != string(have) { + t.Errorf("testcase %d: expected return value to be %s got %s\n\tcode: %v", i, tt.want, string(have), tt.code) + } } } @@ -187,9 +149,6 @@ func TestHaltBetweenSteps(t *testing.T) { if err != nil { t.Fatal(err) } - // Needed for intrinsic gas computation - tracer.ctx["input"] = []byte{} - env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer}) contract := vm.NewContract(&account{}, &account{}, big.NewInt(0), 0) @@ -202,19 +161,3 @@ func TestHaltBetweenSteps(t *testing.T) { t.Errorf("Expected timeout error, got %v", err) } } - -func TestIntrinsicGas(t *testing.T) { - vmctx := testCtx() - tracer, err := New("{depths: [], step: function() {}, fault: function() {}, result: function(ctx) { return ctx.gasPrice+'.'+ctx.gasUsed+'.'+ctx.intrinsicGas; }}", vmctx.txCtx) - if err != nil { - t.Fatal(err) - } - - ret, err := runTrace(tracer, vmctx) - if err != nil { - t.Fatal(err) - } - if have, want := ret, []byte(`"100000.6.21000"`); !bytes.Equal(have, want) { - t.Errorf("Expected return value to be %s got %s", string(want), string(have)) - } -}