eth/tracers: flatCallTracer error compatible with parity (#30497)

Compatible error message in the flat call tracer with parity-style endpoints.

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
Delweng 2024-11-01 16:51:06 +08:00 committed by GitHub
parent f3b4bbbaf3
commit a1093d98eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 115 additions and 40 deletions

View File

@ -66,8 +66,7 @@
"transactionPosition": 74,
"transactionHash": "0x5ef60b27ac971c22a7d484e546e50093ca62300c8986d165154e47773764b6a4",
"blockNumber": 1555279,
"blockHash": "0xd6c98d1b87dfa92a210d99bad2873adaf0c9e51fe43addc63fd9cca03a5c6f46",
"time": "209.346µs"
"blockHash": "0xd6c98d1b87dfa92a210d99bad2873adaf0c9e51fe43addc63fd9cca03a5c6f46"
},
{
"action": {

View File

@ -66,8 +66,7 @@
"transactionPosition": 141,
"transactionHash": "0x1592cbda0d928b8d18eed98857942b91ade32d088e55b8bf63418917cb0231f1",
"blockNumber": 1555278,
"blockHash": "0x755bd54de4b2f5a7a589a10d69888b4ead48a6311d5d69f2f69ca85ec35fbe0b",
"time": "300.9µs"
"blockHash": "0x755bd54de4b2f5a7a589a10d69888b4ead48a6311d5d69f2f69ca85ec35fbe0b"
},
{
"type": "call",
@ -80,9 +79,7 @@
"callType": "callcode"
},
"error": "out of gas",
"traceAddress": [
0
],
"traceAddress": [0],
"subtraces": 0,
"transactionPosition": 141,
"transactionHash": "0x1592cbda0d928b8d18eed98857942b91ade32d088e55b8bf63418917cb0231f1",

View File

@ -62,8 +62,7 @@
"transactionPosition": 117,
"transactionHash": "0x7fe4dec901e1a62c1a1d96b8267bb9ff9dc1f75def43aa45b998743455eff8f9",
"blockNumber": 1555275,
"blockHash": "0x80945caaff2fc67253cbb0217d2e5a307afde943929e97d8b36e58b88cbb02fd",
"time": "332.877µs"
"blockHash": "0x80945caaff2fc67253cbb0217d2e5a307afde943929e97d8b36e58b88cbb02fd"
},
{
"type": "call",
@ -76,9 +75,7 @@
"callType": "callcode"
},
"error": "invalid input length",
"traceAddress": [
0
],
"traceAddress": [0],
"subtraces": 0,
"transactionPosition": 117,
"transactionHash": "0x7fe4dec901e1a62c1a1d96b8267bb9ff9dc1f75def43aa45b998743455eff8f9",

View File

@ -0,0 +1,92 @@
{
"genesis": {
"difficulty": "4639933",
"extraData": "0xd883010b05846765746888676f312e31342e33856c696e7578",
"gasLimit": "9280188",
"hash": "0x9a5f3a98eb1c60f6e3f450658a9cea190157e7021d04f927b752ad6482cf9194",
"miner": "0x73f26d124436b0791169d63a3af29c2ae47765a3",
"mixHash": "0x6b6f8fcaa54b8565c4c1ae7cf0a020e938a53007f4561e758b17bc05c9044d78",
"nonce": "0x773aba50dc51b462",
"number": "1555169",
"stateRoot": "0xc4b9703de3e59ff795baae2c3afa010cf039c37244a7a6af7f3f491a10601348",
"timestamp": "1590794111",
"totalDifficulty": "2242105342155",
"alloc": {
"0x5ac5599fc9df172c89ee7ec55ad9104ccbfed40d": {
"balance": "0x0",
"nonce": "0",
"code": "0x",
"storage": {}
},
"0x877bd459c9b7d8576b44e59e09d076c25946f443": {
"balance": "0x62325b40cbbd0915c4b9",
"nonce": "260875",
"code": "0x",
"storage": {}
}
},
"config": {
"chainId": 63,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
"eip155Block": 0,
"eip158Block": 0,
"ethash": {},
"homesteadBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 301243,
"petersburgBlock": 999983,
"istanbulBlock": 999983
}
},
"context": {
"number": "1555170",
"difficulty": "4642198",
"timestamp": "1590794112",
"gasLimit": "9289249",
"miner": "0x877bd459c9b7d8576b44e59e09d076c25946f443"
},
"input": "0xf8658303fb0b843b9aca0083019ee48080915a600055600060006000f0505a6001550081a2a01a7deb3a16d967b766459ef486b00656c6581e5ad58968184a33701e27e0eb8aa07162ccdfe2018d64360a605310a62c399dd586c7282dd42a88c54f02f51d451f",
"tracerConfig": {
"convertParityErrors": true
},
"result": [
{
"type": "create",
"action": {
"from": "0x877bd459c9b7d8576b44e59e09d076c25946f443",
"value": "0x0",
"gas": "0x19ee4",
"init": "0x5a600055600060006000f0505a60015500"
},
"error": "Out of gas",
"traceAddress": [],
"subtraces": 1,
"transactionPosition": 63,
"transactionHash": "0x60e881fae3884657b5430925c5d0053535b45cce0b8188f2a6be1feee8bcc650",
"blockNumber": 1555170,
"blockHash": "0xea46fbf941d51bf1e4180fbf26d22fda3896f49c7f371d109c226de95dd7b02e"
},
{
"type": "create",
"action": {
"from": "0x9c5cfe45b15eaff4ad617af4250189e26024a4f8",
"value": "0x0",
"gas": "0x3cb",
"init": "0x"
},
"result": {
"gasUsed": "0x0",
"code": "0x",
"address": "0x5ac5599fc9df172c89ee7ec55ad9104ccbfed40d"
},
"traceAddress": [0],
"subtraces": 0,
"transactionPosition": 63,
"transactionHash": "0x60e881fae3884657b5430925c5d0053535b45cce0b8188f2a6be1feee8bcc650",
"blockNumber": 1555170,
"blockHash": "0xea46fbf941d51bf1e4180fbf26d22fda3896f49c7f371d109c226de95dd7b02e"
}
]
}

View File

@ -66,8 +66,7 @@
"transactionPosition": 18,
"transactionHash": "0xc1c42a325856d513523aec464811923b2e2926f54015c7ba37877064cf889803",
"blockNumber": 1555275,
"blockHash": "0x80945caaff2fc67253cbb0217d2e5a307afde943929e97d8b36e58b88cbb02fd",
"time": "453.925µs"
"blockHash": "0x80945caaff2fc67253cbb0217d2e5a307afde943929e97d8b36e58b88cbb02fd"
},
{
"type": "call",

View File

@ -66,8 +66,7 @@
"transactionPosition": 23,
"transactionHash": "0xe267552ce8437a5bc7081385c99f912de5723ad34b958db215dbc41abd5f6c03",
"blockNumber": 555462,
"blockHash": "0x38bba9e3965b57205097ea5ec53fc403cf3941bec2e4c933faae244de5ca4ba1",
"time": "1.147715ms"
"blockHash": "0x38bba9e3965b57205097ea5ec53fc403cf3941bec2e4c933faae244de5ca4ba1"
},
{
"type": "create",

View File

@ -66,8 +66,7 @@
"transactionPosition": 31,
"transactionHash": "0x1257b698c5833c54ce786734087002b097275abc3877af082b5c2a538e894a41",
"blockNumber": 1555161,
"blockHash": "0xb0793dd508dd106a19794b8ce1dfc0ff8d98c76aab61bf32a11799854149a171",
"time": "889.048µs"
"blockHash": "0xb0793dd508dd106a19794b8ce1dfc0ff8d98c76aab61bf32a11799854149a171"
},
{
"type": "create",

View File

@ -62,8 +62,7 @@
"transactionPosition": 63,
"transactionHash": "0x60e881fae3884657b5430925c5d0053535b45cce0b8188f2a6be1feee8bcc650",
"blockNumber": 1555170,
"blockHash": "0xea46fbf941d51bf1e4180fbf26d22fda3896f49c7f371d109c226de95dd7b02e",
"time": "952.736µs"
"blockHash": "0xea46fbf941d51bf1e4180fbf26d22fda3896f49c7f371d109c226de95dd7b02e"
},
{
"type": "create",

View File

@ -73,8 +73,7 @@
"transactionPosition": 26,
"transactionHash": "0xcb1090fa85d2a3da8326b75333e92b3dca89963c895d9c981bfdaa64643135e4",
"blockNumber": 839247,
"blockHash": "0xce7ff7d84ca97f0f89d6065e2c12409a795c9f607cdb14aef0713cad5d7e311c",
"time": "182.267µs"
"blockHash": "0xce7ff7d84ca97f0f89d6065e2c12409a795c9f607cdb14aef0713cad5d7e311c"
},
{
"action": {

View File

@ -80,8 +80,7 @@
"transactionPosition": 5,
"transactionHash": "0x04d2029a5cbbed30969cdc0a2ca9e9fc6b719e323af0802b52466f07ee0ecada",
"blockNumber": 553416,
"blockHash": "0x8df024322173d225a09681d35edeaa528aca60743a11a70f854c158862bf5282",
"time": "617.42µs"
"blockHash": "0x8df024322173d225a09681d35edeaa528aca60743a11a70f854c158862bf5282"
},
{
"type": "call",
@ -97,9 +96,7 @@
"gasUsed": "0x0",
"output": "0x"
},
"traceAddress": [
0
],
"traceAddress": [0],
"subtraces": 0,
"transactionPosition": 5,
"transactionHash": "0x04d2029a5cbbed30969cdc0a2ca9e9fc6b719e323af0802b52466f07ee0ecada",

View File

@ -66,8 +66,7 @@
"transactionPosition": 14,
"transactionHash": "0xdd76f02407e2f8329303ba688e111cae4f7008ad0d14d6e42c5698424ea36d79",
"blockNumber": 1555146,
"blockHash": "0xafb4f1dd27b9054c805acb81a88ed04384788cb31d84164c21874935c81e5c7e",
"time": "187.145µs"
"blockHash": "0xafb4f1dd27b9054c805acb81a88ed04384788cb31d84164c21874935c81e5c7e"
},
{
"action": {
@ -90,9 +89,7 @@
"balance": "0x0"
},
"result": null,
"traceAddress": [
1
],
"traceAddress": [1],
"subtraces": 0,
"transactionPosition": 14,
"transactionHash": "0xdd76f02407e2f8329303ba688e111cae4f7008ad0d14d6e42c5698424ea36d79",

View File

@ -62,8 +62,7 @@
"transactionPosition": 16,
"transactionHash": "0x384487e5ae8d2997aece8e28403d393cb9752425e6de358891bed981c5af1c05",
"blockNumber": 1555285,
"blockHash": "0x93231d8e9662adb4c5c703583a92c7b3112cd5448f43ab4fa1f0f00a0183ed3f",
"time": "665.278µs"
"blockHash": "0x93231d8e9662adb4c5c703583a92c7b3112cd5448f43ab4fa1f0f00a0183ed3f"
},
{
"action": {

View File

@ -55,6 +55,7 @@ var parityErrorMapping = map[string]string{
}
var parityErrorMappingStartingWith = map[string]string{
"out of gas:": "Out of gas", // convert OOG wrapped errors, eg `out of gas: not enough gas for reentrancy sentry`
"invalid opcode:": "Bad instruction",
"stack underflow": "Stack underflow",
}
@ -370,6 +371,7 @@ func convertErrorToParity(call *flatCallFrame) {
for gethError, parityError := range parityErrorMappingStartingWith {
if strings.HasPrefix(call.Error, gethError) {
call.Error = parityError
break
}
}
}