Skip to content

Commit

Permalink
tracer: more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
libotony committed Aug 17, 2023
1 parent 1f2deff commit 34f8cc7
Show file tree
Hide file tree
Showing 16 changed files with 1,687 additions and 957 deletions.
3 changes: 1 addition & 2 deletions tracers/native/prestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to commo

t.lookupAccount(from)
t.lookupAccount(to)
// t.lookupAccount(env.Context.Coinbase)
t.lookupAccount(env.Context.Coinbase)
// tracer hooks run before value transfer, no need to touch balance

if create {
t.contractCreationCount++
if t.config.DiffMode {
Expand Down
31 changes: 19 additions & 12 deletions tracers/testdata/call.json

Large diffs are not rendered by default.

25 changes: 16 additions & 9 deletions tracers/testdata/call_only_top.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"context": {
"blockNumber": 15490,
"blockID": "0x00003c82567d8e90d05704f600ced34e9b9f7ac3091631a5c50fae032c883b7d",
"blockTime": 1530169300,
"beneficiary": "0xb4094c25f86d628fdd571afc4077f0d0196afb48",
"txOrigin": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed",
"clauseIndex": 0,
"txID": "0x206a05ff2db3f86cd9cbdc09f26ea715b21ce5286290c01a78fbc2c240c5d51e"
"txID": "0x206a05ff2db3f86cd9cbdc09f26ea715b21ce5286290c01a78fbc2c240c5d51e",
"gas": "0x20df56"
},
"clause": {
"to": "0xd73a9b349dc06b12301d5968ac333f69d112841a",
Expand All @@ -13,28 +16,32 @@
"state": {
"0x7567d83b7b8d80addcb281a71d54fc7b3364ffed": {
"balance": "0x152d02c7e14af6800000",
"energy":"0x0"
"energy": "0xd27689432b2c80f80000"
},
"0xa1118c817b44c2ad154229a34f00b1af5ba48394": {
"balance": "0x0",
"energy":"0x0",
"energy": "0x0",
"code": "0x608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063967e6e651461005c578063f518904814610087578063f9ea5e79146100ca575b600080fd5b34801561006857600080fd5b50610071610151565b6040518082815260200191505060405180910390f35b34801561009357600080fd5b506100c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061015a565b005b3480156100d657600080fd5b5061013b600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001909291905050506101df565b6040518082815260200191505060405180910390f35b60008054905090565b60008190508073ffffffffffffffffffffffffffffffffffffffff1663416ad2b56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b1580156101c357600080fd5b505af11580156101d7573d6000803e3d6000fd5b505050505050565b600080600081546001019190508190559050929150505600a165627a7a7230582072a3a4f41df2e25405f0df2b19c07fa43c91df02a01d7ad7a66bf7deed99c6860029"
},
"0xb4094c25f86d628fdd571afc4077f0d0196afb48": {
"balance": "0x14adf4b7320334b9000000",
"energy": "0x45cf317c0611a2638fe"
},
"0xd73a9b349dc06b12301d5968ac333f69d112841a": {
"balance": "0x0",
"energy":"0x0",
"energy": "0x0",
"code": "0x608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063416ad2b51461007d578063a92100cb14610094578063d11f17ad146100ab578063d9f51ebf14610106578063f8a8fd6d1461016f578063fc32d7371461019a575b600080fd5b34801561008957600080fd5b506100926101b1565b005b3480156100a057600080fd5b506100a9610285565b005b3480156100b757600080fd5b506100ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102b3565b604051808215151515815260200191505060405180910390f35b34801561011257600080fd5b5061011b6103a5565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561017b57600080fd5b506101846103e7565b6040518082815260200191505060405180910390f35b3480156101a657600080fd5b506101af6103f5565b005b60008073a1118c817b44c2ad154229a34f00b1af5ba4839491508190508073ffffffffffffffffffffffffffffffffffffffff1663f5189048306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561026957600080fd5b505af115801561027d573d6000803e3d6000fd5b505050505050565b60008090505b60648110156102b057600a818115156102a057fe5b069050808060010191505061028b565b50565b60008060405180807f696e63726561736541676528737472696e672c75696e74323536290000000000815250601b019050604051809103902090508273ffffffffffffffffffffffffffffffffffffffff16817c0100000000000000000000000000000000000000000000000000000000900460016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180807f6a61636b000000000000000000000000000000000000000000000000000000008152506020018260ff1681526020019150506000604051808303816000875af192505050915050919050565b60008033905060405180807f696e63726561736541676528737472696e672c75696e74323536290000000000815250601b019050604051809103902091505090565b600080606490508091505090565b6103fd6103f5565b5600a165627a7a723058203554e9ce6726c60f2bf8e3d902a21ffdf86dde6478513a220ef475b6cbc104060029"
}
},
"calls": {
"type": "CALL",
"from": "0x7567d83b7b8d80addcb281a71d54fc7b3364ffed",
"to": "0xd73a9b349dc06b12301d5968ac333f69d112841a",
"value": "0x0",
"gas": "0x20df56",
"gasUsed": "0x529af",
"to": "0xd73a9b349dc06b12301d5968ac333f69d112841a",
"input": "0x416ad2b5",
"error": "execution reverted"
"error": "execution reverted",
"value": "0x0",
"type": "CALL"
},
"config":{
"onlyTopCall": true
Expand Down
131 changes: 131 additions & 0 deletions tracers/testdata/call_with_log.json

Large diffs are not rendered by default.

117 changes: 62 additions & 55 deletions tracers/testdata/calls.json

Large diffs are not rendered by default.

41 changes: 24 additions & 17 deletions tracers/testdata/create_inside.json

Large diffs are not rendered by default.

Loading

0 comments on commit 34f8cc7

Please sign in to comment.