-
Notifications
You must be signed in to change notification settings - Fork 114
Description
We recently merged 1.7.0 of reth and thought that would have solved the js tracer bugs after the change I made for gas calculation however I have found something a little strange.
In rundler we have 2 different validation tracers, one for entrypoint 0.7 https://github.com/alchemyplatform/rundler/blob/main/crates/sim/tracer/src/validationTracerV0_7.ts and one for entrypoint 0.6 https://github.com/alchemyplatform/rundler/blob/main/crates/sim/tracer/src/validationTracerV0_6.ts.
Once we changed our nodes to 1.7.0, the validation tracer for 0.7 worked fine as requested however when I test with 0.6 we get some strange results.
Here is an example input/output for geth
and reth
input.json
{
"method": "debug_traceCall",
"params": [
{
"to": "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789",
"gas": "0x4c4b40",
"input": "0xee2194230000000000000000000000000000000000000000000000000000000000000020000000000000000000000000b0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9f2cc77c2d724ddde01b8f43d6636e553396250f3dbe5af24000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000276f000000000000000000000000000000000000000000000000000000000001425a000000000000000000000000000000000000000000000000000000000001117200000000000000000000000000000000000000000000000000000001cf45caae00000000000000000000000000000000000000000000000000000000746a528800000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a4b61d27f6000000000000000000000000b0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000004d087d288000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000754fd9098af9ddcb41da48a1d78f91f1398965addc000000000000000068cc50a10000000000000000000000000000000000000000fd004e232678fc9c924b5cf28e4fbf2a9f6856255da137e93bdb5df8d1078ad66b23d21ea929ba973c82214891e175e1d07d4d00588f9491f0797582ce18b39d1c00000000000000000000000000000000000000000000000000000000000000000000000000000000000041d34accce5343b83541640a229aae806aa66b7a02ad8cf60a6139be6e7482806179403b27df698829fb54df3aabc43d5adda697cb46b1ec6f26f5606ec61bfc441b00000000000000000000000000000000000000000000000000000000000000"
},
{
"blockHash": "0xd944cde1a6d10e66b215dcc11be036364d38fb6c05c178454ee0b418beeefdbf"
},
{
"tracer": "(function(){var e=function e(e){var t={};e.forEach(function(e){return t[e]=true});return t};var t=function e(){return{contractAddress:\"\",forbiddenOpcodesUsed:{},forbiddenPrecompilesUsed:{},storageAccesses:{},calledBannedEntryPointMethod:false,addressesCallingWithValue:{},calledNonEntryPointWithValue:false,ranOutOfGas:false,undeployedContractAccesses:{},extCodeAccessInfo:{}}};var r=function e(){var e=S.calledBannedEntryPointMethod,r=S.calledNonEntryPointWithValue,a=S.ranOutOfGas,s=S.extCodeAccessInfo;var n=Object.keys(S.forbiddenOpcodesUsed);var o=Object.keys(S.forbiddenPrecompilesUsed);var c=Object.keys(S.addressesCallingWithValue);var d=Object.keys(S.undeployedContractAccesses);var i={contractAddress:S.contractAddress,forbiddenOpcodesUsed:n,forbiddenPrecompilesUsed:o,storageAccesses:S.storageAccesses,calledBannedEntryPointMethod:e,addressesCallingWithValue:c,calledNonEntryPointWithValue:r,ranOutOfGas:a,undeployedContractAccesses:d,extCodeAccessInfo:s};E.push(i);S=t()};var a=function e(e){return parseInt(e.toString())};var s=function e(e,t,r){var a=e[t];if(a!==undefined){return a}var s=r();e[t]=s;return s};var n=function e(e){return[S.contractAddress,e].join(\":\")};var o=function e(e,t){var r;e[t]=((r=e[t])!==null&&r!==void 0?r:0)+1};var c=\"0xb760faf9\";var d=2300;var i=e([\"GASPRICE\",\"GASLIMIT\",\"DIFFICULTY\",\"TIMESTAMP\",\"BASEFEE\",\"BLOCKHASH\",\"BLOBBASEFEE\",\"BLOBHASH\",\"NUMBER\",\"SELFBALANCE\",\"BALANCE\",\"ORIGIN\",\"CREATE\",\"COINBASE\",\"SELFDESTRUCT\"]);var l=e([\"CALL\",\"CALLCODE\",\"DELEGATECALL\",\"STATICCALL\"]);var f=e([\"EXTCODECOPY\",\"EXTCODEHASH\",\"EXTCODESIZE\"]);var u=e([\"SSTORE\",\"SLOAD\",\"TSTORE\",\"TLOAD\"]);var v=e([\"0x0000000000000000000000000000000000000001\",\"0x0000000000000000000000000000000000000002\",\"0x0000000000000000000000000000000000000003\",\"0x0000000000000000000000000000000000000004\",\"0x0000000000000000000000000000000000000005\",\"0x0000000000000000000000000000000000000006\",\"0x0000000000000000000000000000000000000007\",\"0x0000000000000000000000000000000000000008\",\"0x0000000000000000000000000000000000000009\",\"0x0000000000000000000000000000000000000100\"]);var E=[];var A=null;var C={};var O={};var p={};var g=0;var S=t();var x=\"\";var k=\"\";var h=null;var y=null;return{result:function e(e,t){r();var a={};Object.keys(O).forEach(function(e){var t=O[e];a[e]=Object.keys(t)});var s={};Object.keys(p).forEach(function(e){var t=p[e];var r={};var a=false;Object.keys(t).forEach(function(e){var s=t[e];if(s){r[e]=s;a=true}});if(a){s[e]=r}});return{phases:E,revertData:A,accessedContracts:C,associatedSlotsByAddress:a,factoryCalledCreate2Twice:g>1,expectedStorage:s}},fault:function e(e,t){},step:function e(e,t){if(!x){x=toHex(e.contract.getAddress())}var c=toHex(e.contract.getAddress());if(c!==x&&S.contractAddress===\"\"){S.contractAddress=c}var T=e.op.toString();if(e.getGas()<e.getCost()||T===\"SSTORE\"&&e.getGas()<d){S.ranOutOfGas=true}if(k){var L=toHex(toWord(e.stack.peek(0).toString(16)));s(O,k,function(){return{}})[L]=true;k=\"\"}var b=e.getDepth()===1;if(b){if(T===\"NUMBER\"){r()}else if(T===\"REVERT\"){var H=a(e.stack.peek(0));var I=a(e.stack.peek(1));A=toHex(e.memory.slice(H,H+I))}}else{if((h===null||h===void 0?void 0:h.opcode)===\"GAS\"&&!l[T]){S.forbiddenOpcodesUsed[n(\"GAS\")]=true}if(i[T]){S.forbiddenOpcodesUsed[n(T)]=true}}if(y&&f[y.opcode]){var B=\"\".concat(y.opcode,\" \").concat(h===null||h===void 0?void 0:h.opcode);if((y===null||y===void 0?void 0:y.stackEnd)&&B!==\"EXTCODESIZE ISZERO\"){var P=toAddress(y.stackEnd.toString(16));var D=toHex(P);S.extCodeAccessInfo[D]=T}}if(T===\"CREATE2\"){if(E.length===0){g++}else{S.forbiddenOpcodesUsed[n(T)]=true}}else if(T===\"KECCAK256\"){var U=a(e.stack.peek(0));var R=a(e.stack.peek(1));if(R>=32){var G=toHex(e.memory.slice(U,U+32));if(G.startsWith(\"0x000000000000000000000000\")){k=\"0x\"+G.slice(26)}}}else if(u[T]){var W=e.contract.getAddress();var m=toHex(W);var N=toWord(e.stack.peek(0).toString(16));var V=toHex(N);var j=s(S.storageAccesses,m,function(){return{reads:{},writes:{}}});if(!b){if(T==\"SLOAD\"){if(j.reads[V]==null&&j.writes[V]==null){j.reads[V]=toHex(t.getState(W,N))}}else{o(j.writes,V)}}var M=s(p,m,function(){return{}});if(!(V in M)){var F=T===\"SLOAD\"?toHex(t.getState(W,N)):null;M[V]=F}}else if(f[T]||l[T]){var w=f[T]?0:1;var X=toAddress(e.stack.peek(w).toString(16));var K=toHex(X);if(!isPrecompiled(X)&&!v[K]){if(!C[K]||S.undeployedContractAccesses[K]){if(t.getCode(X).length===0){S.undeployedContractAccesses[K]=true}else{delete S.undeployedContractAccesses[K]}}C[K]={header:toHex(t.getCode(X).subarray(0,3)),opcode:T,length:t.getCode(X).length}}else if(!v[K]){S.forbiddenPrecompilesUsed[n(K)]=true}}y=h;var Z=e.stack.length()>0?e.stack.peek(0):null;h={opcode:T,stackEnd:Z}},enter:function e(e){var t=toHex(e.getFrom());if(t===x){return}var r=toHex(e.getTo())===x;if(r){var a=e.getInput();if(a.length>0&&toHex(a).substring(0,10)!==c){S.calledBannedEntryPointMethod=true}}var s=e.getValue();if(s!=null&&s.toString()!=\"0\"){if(r){S.addressesCallingWithValue[t]=true}else{S.calledNonEntryPointWithValue=true}}},exit:function e(e){}}})()",
"timeout": "10s",
"stateOverrides": {}
}
],
"id": 233,
"jsonrpc": "2.0"
}
geth output:
{
"jsonrpc": "2.0",
"id": 233,
"result": {
"phases": [
{
"contractAddress": "",
"forbiddenOpcodesUsed": [],
"forbiddenPrecompilesUsed": [],
"storageAccesses": {},
"calledBannedEntryPointMethod": false,
"addressesCallingWithValue": [],
"calledNonEntryPointWithValue": false,
"ranOutOfGas": false,
"undeployedContractAccesses": [],
"extCodeAccessInfo": {}
},
{
"contractAddress": "0xb0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9",
"forbiddenOpcodesUsed": [],
"forbiddenPrecompilesUsed": [],
"storageAccesses": {
"0xb0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9": {
"reads": {
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000ae8c656ad28f2b59a196ab61815c16a0ae1c3cba",
"0x691ec1a18226d004c07c9f8e5c4a6ff15a7b38db267cf7e3c945aef8be512200": "0x000000000000000000000000f7f00d283ce4cdbefd1a7c7c22d3e3b7189f2fd1"
},
"writes": {}
},
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789": {
"reads": {},
"writes": {}
}
},
"calledBannedEntryPointMethod": false,
"addressesCallingWithValue": [],
"calledNonEntryPointWithValue": false,
"ranOutOfGas": false,
"undeployedContractAccesses": [],
"extCodeAccessInfo": {}
},
{
"contractAddress": "0x4fd9098af9ddcb41da48a1d78f91f1398965addc",
"forbiddenOpcodesUsed": [],
"forbiddenPrecompilesUsed": [],
"storageAccesses": {
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789": {
"reads": {},
"writes": {}
},
"0x4fd9098af9ddcb41da48a1d78f91f1398965addc": {
"reads": {
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008505d426baabf0ab923801c3e460fad3b3da9c4f",
"0x0000000000000000000000000000000000000000000000000000000000000065": "0x0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789",
"0x00000000000000000000000000000000000000000000000000000000000000ca": "0x00000000000000000000000013dc4c4458941ef33e02c9b5a34c4d55b6f5dbc2"
},
"writes": {}
}
},
"calledBannedEntryPointMethod": false,
"addressesCallingWithValue": [],
"calledNonEntryPointWithValue": false,
"ranOutOfGas": false,
"undeployedContractAccesses": [],
"extCodeAccessInfo": {}
}
],
"revertData": "0xe0cff05f00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000021bbf00000000000000000000000000000000000000000000000000090c3e31c38a72000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000068cc50a100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000",
"accessedContracts": {
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789": {
"header": "0x608060",
"opcode": "STATICCALL",
"length": 23689
},
"0xb0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9": {
"header": "0x608060",
"opcode": "CALL",
"length": 231
},
"0x4fd9098af9ddcb41da48a1d78f91f1398965addc": {
"header": "0x608060",
"opcode": "CALL",
"length": 231
},
"0xae8c656ad28f2b59a196ab61815c16a0ae1c3cba": {
"header": "0x608060",
"opcode": "DELEGATECALL",
"length": 9609
},
"0x8505d426baabf0ab923801c3e460fad3b3da9c4f": {
"header": "0x608060",
"opcode": "DELEGATECALL",
"length": 13302
}
},
"associatedSlotsByAddress": {
"0xb0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9": [
"0xb795ecd85ae00b54342437107a6c127b94e4510ff8a9a462cf2291dc49147bf1",
"0x95e162292e985ab59add4416813307daa3fe3c53ed84e5c694e1a34874ebd9c1",
"0xc1c55208add43f9e032c75b07776bc1cf062bd5f72c5c6fdf5f6a421875a62d2",
"0x7a1b5a18e25eba5adfd34f315c31d92c24b00f680cf1b5fd3cacc2304f4505f0"
],
"0x4fd9098af9ddcb41da48a1d78f91f1398965addc": [
"0x99d8c1e2036a43ea4d6643cca4ec007af8fc8d04217e219b6d996799e9f08c40"
],
"0x0000000000000000000000000000000000000000": [
"0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5"
]
},
"factoryCalledCreate2Twice": false,
"expectedStorage": {
"0xb0ffcc28fd10c06a4c26f962bce6dfcb285f6bd9": {
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000ae8c656ad28f2b59a196ab61815c16a0ae1c3cba",
"0x691ec1a18226d004c07c9f8e5c4a6ff15a7b38db267cf7e3c945aef8be512200": "0x000000000000000000000000f7f00d283ce4cdbefd1a7c7c22d3e3b7189f2fd1"
},
"0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789": {
"0x1ea452ed78d3cd6d51159c2f1880829b0fcd107c40df13ef9112d8624ea9c9ec": "0x0000000000000000000000000000000000000000000000000000000000000000",
"0x99d8c1e2036a43ea4d6643cca4ec007af8fc8d04217e219b6d996799e9f08c40": "0x0000000000000000000de0b6b3a76400000100000000000002dc38e23b4ca7d2",
"0x99d8c1e2036a43ea4d6643cca4ec007af8fc8d04217e219b6d996799e9f08c41": "0x0000000000000000000000000000000000000000000000000000000000015180",
"0x7a1b5a18e25eba5adfd34f315c31d92c24b00f680cf1b5fd3cacc2304f4505f0": "0x0000000000000000000000000000000000000000000000000000000000000000",
"0x7a1b5a18e25eba5adfd34f315c31d92c24b00f680cf1b5fd3cacc2304f4505f1": "0x0000000000000000000000000000000000000000000000000000000000000000",
"0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5": "0x0000000000000000000000000000000000000000000000000000000000000000",
"0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb6": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"0x4fd9098af9ddcb41da48a1d78f91f1398965addc": {
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008505d426baabf0ab923801c3e460fad3b3da9c4f",
"0x0000000000000000000000000000000000000000000000000000000000000065": "0x0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789",
"0x00000000000000000000000000000000000000000000000000000000000000ca": "0x00000000000000000000000013dc4c4458941ef33e02c9b5a34c4d55b6f5dbc2"
}
}
}
}
reth output:
{
"jsonrpc": "2.0",
"id": 233,
"result": {
"accessedContracts": {},
"associatedSlotsByAddress": {},
"expectedStorage": {},
"factoryCalledCreate2Twice": false,
"phases": [
{
"addressesCallingWithValue": [],
"calledBannedEntryPointMethod": false,
"calledNonEntryPointWithValue": false,
"contractAddress": "",
"extCodeAccessInfo": {},
"forbiddenOpcodesUsed": [],
"forbiddenPrecompilesUsed": [],
"ranOutOfGas": false,
"storageAccesses": {},
"undeployedContractAccesses": []
}
],
"revertData": null
}
}
I dug a little deeper with some debug messages and seems like it returning when the opcode reaches EXTCODESIZE but have not gone too deep yet however it seems like it is exiting early for some reason I cannot yet find in the revm-inspectors code