Add `op` field to `VMOperation` to determine executed opcode (#1858)
* created opcode enum and added to VMOperation. Fixes #1857 * rebuild trace logs to include missing fields * opcode descriptions for docs + changelog * restore traces and indent trace * opcode 0x20 should be SHA3
This commit is contained in:
parent
caa6f0aa19
commit
936cecc3ad
|
@ -4,6 +4,7 @@
|
|||
|
||||
### Unreleased
|
||||
|
||||
- Add 'ethers_core::types::OpCode' and use in 'ethers_core::types::VMOperation' [1857](https://github.com/gakonst/ethers-rs/issues/1857)
|
||||
- Remove rust_decimals dependency for ethers-core
|
||||
- Add support for numbers greater than 2^96 for `ethers_core::utils::parse_units` [#1822](https://github.com/gakonst/ethers-rs/issues/1822)
|
||||
- Add comment about safety of u8 -> u64 cast in `ethers_core::types::Signature`
|
||||
|
|
|
@ -43,8 +43,8 @@ r#"{
|
|||
"trace": [
|
||||
{
|
||||
"action": {
|
||||
"callType": "call",
|
||||
"from": "0x01f0eb5c4b0a9d8285b67195f5f10ce22971a102",
|
||||
"callType": "call",
|
||||
"gas": "0xa5f8",
|
||||
"input": "0x1a695230000000000000000000000000c227a75b32ed37d3f9d6341b9904d003dad3b1b3",
|
||||
"to": "0x0b95993a39a363d99280ac950f5e4536ab5c5566",
|
||||
|
@ -60,8 +60,8 @@ r#"{
|
|||
},
|
||||
{
|
||||
"action": {
|
||||
"callType": "call",
|
||||
"from": "0x0b95993a39a363d99280ac950f5e4536ab5c5566",
|
||||
"callType": "call",
|
||||
"gas": "0x8fc",
|
||||
"input": "0x",
|
||||
"to": "0xc227a75b32ed37d3f9d6341b9904d003dad3b1b3",
|
||||
|
@ -92,7 +92,9 @@ r#"{
|
|||
"used": 42485
|
||||
},
|
||||
"pc": 0,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-0"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -105,7 +107,9 @@ r#"{
|
|||
"used": 42482
|
||||
},
|
||||
"pc": 2,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-1"
|
||||
},
|
||||
{
|
||||
"cost": 12,
|
||||
|
@ -119,7 +123,9 @@ r#"{
|
|||
"used": 42470
|
||||
},
|
||||
"pc": 4,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "MSTORE",
|
||||
"idx": "15-2"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -132,7 +138,9 @@ r#"{
|
|||
"used": 42468
|
||||
},
|
||||
"pc": 5,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "CALLDATASIZE",
|
||||
"idx": "15-3"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -145,7 +153,9 @@ r#"{
|
|||
"used": 42465
|
||||
},
|
||||
"pc": 6,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "ISZERO",
|
||||
"idx": "15-4"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -158,7 +168,9 @@ r#"{
|
|||
"used": 42462
|
||||
},
|
||||
"pc": 7,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-5"
|
||||
},
|
||||
{
|
||||
"cost": 10,
|
||||
|
@ -169,7 +181,9 @@ r#"{
|
|||
"used": 42452
|
||||
},
|
||||
"pc": 10,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPI",
|
||||
"idx": "15-6"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -182,7 +196,9 @@ r#"{
|
|||
"used": 42449
|
||||
},
|
||||
"pc": 11,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-7"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -195,7 +211,9 @@ r#"{
|
|||
"used": 42446
|
||||
},
|
||||
"pc": 13,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "CALLDATALOAD",
|
||||
"idx": "15-8"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -208,7 +226,9 @@ r#"{
|
|||
"used": 42443
|
||||
},
|
||||
"pc": 14,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH29",
|
||||
"idx": "15-9"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -222,7 +242,9 @@ r#"{
|
|||
"used": 42440
|
||||
},
|
||||
"pc": 44,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-10"
|
||||
},
|
||||
{
|
||||
"cost": 5,
|
||||
|
@ -235,7 +257,9 @@ r#"{
|
|||
"used": 42435
|
||||
},
|
||||
"pc": 45,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DIV",
|
||||
"idx": "15-11"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -248,7 +272,9 @@ r#"{
|
|||
"used": 42432
|
||||
},
|
||||
"pc": 46,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH4",
|
||||
"idx": "15-12"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -261,7 +287,9 @@ r#"{
|
|||
"used": 42429
|
||||
},
|
||||
"pc": 51,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "AND",
|
||||
"idx": "15-13"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -275,7 +303,9 @@ r#"{
|
|||
"used": 42426
|
||||
},
|
||||
"pc": 52,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP1",
|
||||
"idx": "15-14"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -288,7 +318,9 @@ r#"{
|
|||
"used": 42423
|
||||
},
|
||||
"pc": 53,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH4",
|
||||
"idx": "15-15"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -301,7 +333,9 @@ r#"{
|
|||
"used": 42420
|
||||
},
|
||||
"pc": 58,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "EQ",
|
||||
"idx": "15-16"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -314,7 +348,9 @@ r#"{
|
|||
"used": 42417
|
||||
},
|
||||
"pc": 59,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-17"
|
||||
},
|
||||
{
|
||||
"cost": 10,
|
||||
|
@ -325,7 +361,9 @@ r#"{
|
|||
"used": 42407
|
||||
},
|
||||
"pc": 62,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPI",
|
||||
"idx": "15-18"
|
||||
},
|
||||
{
|
||||
"cost": 1,
|
||||
|
@ -336,7 +374,9 @@ r#"{
|
|||
"used": 42406
|
||||
},
|
||||
"pc": 94,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPDEST",
|
||||
"idx": "15-19"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -349,7 +389,9 @@ r#"{
|
|||
"used": 42403
|
||||
},
|
||||
"pc": 95,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-20"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -362,7 +404,9 @@ r#"{
|
|||
"used": 42400
|
||||
},
|
||||
"pc": 98,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-21"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -376,7 +420,9 @@ r#"{
|
|||
"used": 42397
|
||||
},
|
||||
"pc": 100,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP1",
|
||||
"idx": "15-22"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -390,7 +436,9 @@ r#"{
|
|||
"used": 42394
|
||||
},
|
||||
"pc": 101,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP1",
|
||||
"idx": "15-23"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -403,7 +451,9 @@ r#"{
|
|||
"used": 42391
|
||||
},
|
||||
"pc": 102,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "CALLDATALOAD",
|
||||
"idx": "15-24"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -416,7 +466,9 @@ r#"{
|
|||
"used": 42388
|
||||
},
|
||||
"pc": 103,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH20",
|
||||
"idx": "15-25"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -429,7 +481,9 @@ r#"{
|
|||
"used": 42385
|
||||
},
|
||||
"pc": 124,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "AND",
|
||||
"idx": "15-26"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -443,7 +497,9 @@ r#"{
|
|||
"used": 42382
|
||||
},
|
||||
"pc": 125,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-27"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -456,7 +512,9 @@ r#"{
|
|||
"used": 42379
|
||||
},
|
||||
"pc": 126,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-28"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -469,7 +527,9 @@ r#"{
|
|||
"used": 42376
|
||||
},
|
||||
"pc": 128,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "ADD",
|
||||
"idx": "15-29"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -483,7 +543,9 @@ r#"{
|
|||
"used": 42373
|
||||
},
|
||||
"pc": 129,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-30"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -498,7 +560,9 @@ r#"{
|
|||
"used": 42370
|
||||
},
|
||||
"pc": 130,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP2",
|
||||
"idx": "15-31"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -512,7 +576,9 @@ r#"{
|
|||
"used": 42367
|
||||
},
|
||||
"pc": 131,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-32"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -523,7 +589,9 @@ r#"{
|
|||
"used": 42365
|
||||
},
|
||||
"pc": 132,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-33"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -534,7 +602,9 @@ r#"{
|
|||
"used": 42363
|
||||
},
|
||||
"pc": 133,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-34"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -547,7 +617,9 @@ r#"{
|
|||
"used": 42360
|
||||
},
|
||||
"pc": 134,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-35"
|
||||
},
|
||||
{
|
||||
"cost": 8,
|
||||
|
@ -558,7 +630,9 @@ r#"{
|
|||
"used": 42352
|
||||
},
|
||||
"pc": 137,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMP",
|
||||
"idx": "15-36"
|
||||
},
|
||||
{
|
||||
"cost": 1,
|
||||
|
@ -569,7 +643,9 @@ r#"{
|
|||
"used": 42351
|
||||
},
|
||||
"pc": 246,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPDEST",
|
||||
"idx": "15-37"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -583,7 +659,9 @@ r#"{
|
|||
"used": 42348
|
||||
},
|
||||
"pc": 247,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP1",
|
||||
"idx": "15-38"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -596,7 +674,9 @@ r#"{
|
|||
"used": 42345
|
||||
},
|
||||
"pc": 248,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH20",
|
||||
"idx": "15-39"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -609,7 +689,9 @@ r#"{
|
|||
"used": 42342
|
||||
},
|
||||
"pc": 269,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "AND",
|
||||
"idx": "15-40"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -622,7 +704,9 @@ r#"{
|
|||
"used": 42339
|
||||
},
|
||||
"pc": 270,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-41"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -635,7 +719,9 @@ r#"{
|
|||
"used": 42337
|
||||
},
|
||||
"pc": 273,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "CALLVALUE",
|
||||
"idx": "15-42"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -649,7 +735,9 @@ r#"{
|
|||
"used": 42334
|
||||
},
|
||||
"pc": 274,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-43"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -664,7 +752,9 @@ r#"{
|
|||
"used": 42331
|
||||
},
|
||||
"pc": 275,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP2",
|
||||
"idx": "15-44"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -677,7 +767,9 @@ r#"{
|
|||
"used": 42328
|
||||
},
|
||||
"pc": 276,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "ISZERO",
|
||||
"idx": "15-45"
|
||||
},
|
||||
{
|
||||
"cost": 5,
|
||||
|
@ -690,7 +782,9 @@ r#"{
|
|||
"used": 42323
|
||||
},
|
||||
"pc": 277,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "MUL",
|
||||
"idx": "15-46"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -704,7 +798,9 @@ r#"{
|
|||
"used": 42320
|
||||
},
|
||||
"pc": 278,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP1",
|
||||
"idx": "15-47"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -717,7 +813,9 @@ r#"{
|
|||
"used": 42317
|
||||
},
|
||||
"pc": 279,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-48"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -733,7 +831,9 @@ r#"{
|
|||
"used": 42314
|
||||
},
|
||||
"pc": 281,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "MLOAD",
|
||||
"idx": "15-49"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -746,7 +846,9 @@ r#"{
|
|||
"used": 42311
|
||||
},
|
||||
"pc": 282,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-50"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -759,7 +861,9 @@ r#"{
|
|||
"used": 42308
|
||||
},
|
||||
"pc": 284,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH1",
|
||||
"idx": "15-51"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -775,7 +879,9 @@ r#"{
|
|||
"used": 42305
|
||||
},
|
||||
"pc": 286,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "MLOAD",
|
||||
"idx": "15-52"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -789,7 +895,9 @@ r#"{
|
|||
"used": 42302
|
||||
},
|
||||
"pc": 287,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP1",
|
||||
"idx": "15-53"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -806,7 +914,9 @@ r#"{
|
|||
"used": 42299
|
||||
},
|
||||
"pc": 288,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP4",
|
||||
"idx": "15-54"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -819,7 +929,9 @@ r#"{
|
|||
"used": 42296
|
||||
},
|
||||
"pc": 289,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SUB",
|
||||
"idx": "15-55"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -834,7 +946,9 @@ r#"{
|
|||
"used": 42293
|
||||
},
|
||||
"pc": 290,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP2",
|
||||
"idx": "15-56"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -853,7 +967,9 @@ r#"{
|
|||
"used": 42290
|
||||
},
|
||||
"pc": 291,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP6",
|
||||
"idx": "15-57"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -875,7 +991,9 @@ r#"{
|
|||
"used": 42287
|
||||
},
|
||||
"pc": 292,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP9",
|
||||
"idx": "15-58"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -897,7 +1015,9 @@ r#"{
|
|||
"used": 42284
|
||||
},
|
||||
"pc": 293,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "DUP9",
|
||||
"idx": "15-59"
|
||||
},
|
||||
{
|
||||
"cost": 9700,
|
||||
|
@ -913,7 +1033,9 @@ r#"{
|
|||
"sub": {
|
||||
"code": "0x",
|
||||
"ops": []
|
||||
}
|
||||
},
|
||||
"op": "CALL",
|
||||
"idx": "15-60"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -930,7 +1052,9 @@ r#"{
|
|||
"used": 34881
|
||||
},
|
||||
"pc": 295,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "SWAP4",
|
||||
"idx": "15-61"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -941,7 +1065,9 @@ r#"{
|
|||
"used": 34879
|
||||
},
|
||||
"pc": 296,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-62"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -952,7 +1078,9 @@ r#"{
|
|||
"used": 34877
|
||||
},
|
||||
"pc": 297,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-63"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -963,7 +1091,9 @@ r#"{
|
|||
"used": 34875
|
||||
},
|
||||
"pc": 298,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-64"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -974,7 +1104,9 @@ r#"{
|
|||
"used": 34873
|
||||
},
|
||||
"pc": 299,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-65"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -987,7 +1119,9 @@ r#"{
|
|||
"used": 34870
|
||||
},
|
||||
"pc": 300,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "ISZERO",
|
||||
"idx": "15-66"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -1000,7 +1134,9 @@ r#"{
|
|||
"used": 34867
|
||||
},
|
||||
"pc": 301,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "ISZERO",
|
||||
"idx": "15-67"
|
||||
},
|
||||
{
|
||||
"cost": 3,
|
||||
|
@ -1013,7 +1149,9 @@ r#"{
|
|||
"used": 34864
|
||||
},
|
||||
"pc": 302,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "PUSH2",
|
||||
"idx": "15-68"
|
||||
},
|
||||
{
|
||||
"cost": 10,
|
||||
|
@ -1024,7 +1162,9 @@ r#"{
|
|||
"used": 34854
|
||||
},
|
||||
"pc": 305,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPI",
|
||||
"idx": "15-69"
|
||||
},
|
||||
{
|
||||
"cost": 1,
|
||||
|
@ -1035,7 +1175,9 @@ r#"{
|
|||
"used": 34853
|
||||
},
|
||||
"pc": 310,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPDEST",
|
||||
"idx": "15-70"
|
||||
},
|
||||
{
|
||||
"cost": 1,
|
||||
|
@ -1046,7 +1188,9 @@ r#"{
|
|||
"used": 34852
|
||||
},
|
||||
"pc": 311,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPDEST",
|
||||
"idx": "15-71"
|
||||
},
|
||||
{
|
||||
"cost": 2,
|
||||
|
@ -1057,7 +1201,9 @@ r#"{
|
|||
"used": 34850
|
||||
},
|
||||
"pc": 312,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "POP",
|
||||
"idx": "15-72"
|
||||
},
|
||||
{
|
||||
"cost": 8,
|
||||
|
@ -1068,7 +1214,9 @@ r#"{
|
|||
"used": 34842
|
||||
},
|
||||
"pc": 313,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMP",
|
||||
"idx": "15-73"
|
||||
},
|
||||
{
|
||||
"cost": 1,
|
||||
|
@ -1079,7 +1227,9 @@ r#"{
|
|||
"used": 34841
|
||||
},
|
||||
"pc": 138,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "JUMPDEST",
|
||||
"idx": "15-74"
|
||||
},
|
||||
{
|
||||
"cost": 0,
|
||||
|
@ -1090,7 +1240,9 @@ r#"{
|
|||
"used": 34841
|
||||
},
|
||||
"pc": 139,
|
||||
"sub": null
|
||||
"sub": null,
|
||||
"op": "STOP",
|
||||
"idx": "15-75"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ pub use filter::*;
|
|||
mod geth;
|
||||
pub use geth::*;
|
||||
|
||||
mod opcodes;
|
||||
pub use opcodes::*;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
|
||||
/// Description of the type of trace to make
|
||||
pub enum TraceType {
|
||||
|
@ -131,6 +134,9 @@ pub struct VMOperation {
|
|||
/// Subordinate trace of the CALL/CREATE if applicable.
|
||||
// #[serde(bound="VMTrace: Deserialize")]
|
||||
pub sub: Option<VMTrace>,
|
||||
/// The executed opcode name
|
||||
#[serde(rename = "op")]
|
||||
pub op: OpCode,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, Serialize)]
|
||||
|
|
|
@ -0,0 +1,343 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// opcode descriptions taken from evm.codes https://github.com/comitylabs/evm.codes/blob/bc7f102808055d88365559d40c190c5bd6d164c3/opcodes.json
|
||||
// https://github.com/ethereum/go-ethereum/blob/2b1299b1c006077c56ecbad32e79fc16febe3dd6/core/vm/opcodes.go
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Default, Deserialize, Serialize)]
|
||||
/// Name of executed EVM opcode
|
||||
pub enum OpCode {
|
||||
// 0x0 range - arithmetic ops.
|
||||
/// Opcode 0x0 - Halts execution
|
||||
STOP,
|
||||
/// Opcode 0x1 - Addition operation
|
||||
ADD,
|
||||
/// Opcode 0x2 - Multiplication operation
|
||||
MUL,
|
||||
/// Opcode 0x3 - Subtraction operation
|
||||
SUB,
|
||||
/// Opcode 0x4 - Integer division operation
|
||||
DIV,
|
||||
/// Opcode 0x5 - Signed integer division operation (truncated)
|
||||
SDIV,
|
||||
/// Opcode 0x6 - Modulo remainder operation
|
||||
MOD,
|
||||
/// Opcode 0x7 - Signed modulo remainder operation
|
||||
SMOD,
|
||||
/// Opcode 0x8 - Modulo addition operation
|
||||
ADDMOD,
|
||||
/// Opcode 0x9 - Modulo multiplication operation
|
||||
MULMOD,
|
||||
/// Opcode 0xA - Exponential operation
|
||||
EXP,
|
||||
/// Opcode 0xB - Extend length of two’s complement signed integer
|
||||
SIGNEXTEND,
|
||||
|
||||
// 0x0C - 0x0F are invalid
|
||||
|
||||
// 0x10 range - comparison ops.
|
||||
/// Opcode 0x10 - Less-than comparison
|
||||
LT,
|
||||
/// Opcode 0x11 - Greater-than comparison
|
||||
GT,
|
||||
/// Opcode 0x12 - Signed less-than comparison
|
||||
SLT,
|
||||
/// Opcode 0x13 - Signed greater-than comparison
|
||||
SGT,
|
||||
/// Opcode 0x14 - Equality comparison
|
||||
EQ,
|
||||
/// Opcode 0x15 - Simple not operator
|
||||
ISZERO,
|
||||
/// Opcode 0x16 - Bitwise AND operation
|
||||
AND,
|
||||
/// Opcode 0x17 - Bitwise OR operation
|
||||
OR,
|
||||
/// Opcode 0x18 - Bitwise XOR operation
|
||||
XOR,
|
||||
/// Opcode 0x19 - Bitwise NOT operation
|
||||
NOT,
|
||||
/// Opcode 0x1A - Retrieve single byte from word
|
||||
BYTE,
|
||||
/// Opcode 0x1B - Left shift operation
|
||||
SHL,
|
||||
/// Opcode 0x1C - Logical right shift operation
|
||||
SHR,
|
||||
/// Opcode 0x1D - Arithmetic (signed) right shift operation
|
||||
SAR,
|
||||
|
||||
// 0x1E - 0x1F are invalid
|
||||
|
||||
// 0x20 range - crypto.
|
||||
/// Opcode 0x20 - Compute Keccak-256 hash
|
||||
SHA3,
|
||||
|
||||
// 0x21 - 0x2F are invalid
|
||||
|
||||
// 0x30 range - closure state.
|
||||
/// Opcode 0x30 - Get address of currently executing account
|
||||
ADDRESS,
|
||||
/// Opcode 0x31 - Get address of currently executing account
|
||||
BALANCE,
|
||||
/// Opcode 0x32 - Get execution origination address
|
||||
ORIGIN,
|
||||
/// Opcode 0x33 - Get caller address
|
||||
CALLER,
|
||||
/// Opcode 0x34 - Get deposited value by the instruction/transaction responsible for this
|
||||
/// execution
|
||||
CALLVALUE,
|
||||
/// Opcode 0x35 - Get input data of current environment
|
||||
CALLDATALOAD,
|
||||
/// Opcode 0x36 - Get size of input data in current environment
|
||||
CALLDATASIZE,
|
||||
/// Opcode 0x37 - Copy input data in current environment to memory
|
||||
CALLDATACOPY,
|
||||
/// Opcode 0x38 - Get size of code running in current environment
|
||||
CODESIZE,
|
||||
/// Opcode 0x39 - Copy code running in current environment to memory
|
||||
CODECOPY,
|
||||
/// Opcode 0x3A - Get price of gas in current environment
|
||||
GASPRICE,
|
||||
/// Opcode 0x3B - Get size of an account’s code
|
||||
EXTCODESIZE,
|
||||
/// Opcode 0x3C - Copy an account’s code to memory
|
||||
EXTCODECOPY,
|
||||
/// Opcode 0x3D - Get size of output data from the previous call from the current environment
|
||||
RETURNDATASIZE,
|
||||
/// Opcode 0x3E - Copy output data from the previous call to memory
|
||||
RETURNDATACOPY,
|
||||
/// Opcode 0x3F - Get hash of an account’s code
|
||||
EXTCODEHASH,
|
||||
|
||||
// 0x40 range - block operations.
|
||||
/// Opcode 0x40 - Get the hash of one of the 256 most recent complete blocks
|
||||
BLOCKHASH,
|
||||
/// Opcode 0x41 - Get the block’s beneficiary address
|
||||
COINBASE,
|
||||
/// Opcode 0x42 - Get the block’s timestamp
|
||||
TIMESTAMP,
|
||||
/// Opcode 0x43 - Get the block’s number
|
||||
NUMBER,
|
||||
/// Opcode 0x44 - Get the block’s difficulty
|
||||
DIFFICULTY,
|
||||
//RANDOM, // 0x44 // Same as DIFFICULTY
|
||||
//PREVRANDAO, // 0x44 // Same as DIFFICULTY
|
||||
/// Opcode 0x45 - Get the block’s gas limit
|
||||
GASLIMIT,
|
||||
/// Opcode 0x46 - Get the chain ID
|
||||
CHAINID,
|
||||
/// Opcode 0x47 - Get balance of currently executing account
|
||||
SELFBALANCE,
|
||||
/// Opcode 0x48 - Get the base fee
|
||||
BASEFEE,
|
||||
|
||||
// 0x49 - 0x4F are invalid
|
||||
|
||||
// 0x50 range - 'storage' and execution.
|
||||
/// Opcode 0x50 - Remove item from stack
|
||||
POP,
|
||||
/// Opcode 0x51 - Load word from memory
|
||||
MLOAD,
|
||||
/// Opcode 0x52 - Save word to memory
|
||||
MSTORE,
|
||||
/// Opcode 0x53 - Save byte to memory
|
||||
MSTORE8,
|
||||
/// Opcode 0x54 - Load word from storage
|
||||
SLOAD,
|
||||
/// Opcode 0x55 - Save word to storage
|
||||
SSTORE,
|
||||
/// Opcode 0x56 - Alter the program counter
|
||||
JUMP,
|
||||
/// Opcode 0x57 - Conditionally alter the program counter
|
||||
JUMPI,
|
||||
/// Opcode 0x58 - Get the value of the program counter prior to the increment corresponding to
|
||||
/// this instruction
|
||||
PC,
|
||||
/// Opcode 0x59 - Get the size of active memory in bytes
|
||||
MSIZE,
|
||||
/// Opcode 0x5A - Get the amount of available gas, including the corresponding reduction for
|
||||
/// the cost of this instruction
|
||||
GAS,
|
||||
/// Opcode 0x5B - Mark a valid destination for jumps
|
||||
JUMPDEST,
|
||||
|
||||
// 0x5C - 0x5F are invalid
|
||||
|
||||
// 0x60 range - pushes.
|
||||
// PUSH0, // 0x5F (https://eips.ethereum.org/EIPS/eip-3855)
|
||||
/// Opcode 0x60 - Place 1 byte item on stack
|
||||
PUSH1,
|
||||
/// Opcode 0x61 - Place 2 byte item on stack
|
||||
PUSH2,
|
||||
/// Opcode 0x62 - Place 3 byte item on stack
|
||||
PUSH3,
|
||||
/// Opcode 0x63 - Place 4 byte item on stack
|
||||
PUSH4,
|
||||
/// Opcode 0x64 - Place 5 byte item on stack
|
||||
PUSH5,
|
||||
/// Opcode 0x65 - Place 6 byte item on stack
|
||||
PUSH6,
|
||||
/// Opcode 0x66 - Place 7 byte item on stack
|
||||
PUSH7,
|
||||
/// Opcode 0x67 - Place 8 byte item on stack
|
||||
PUSH8,
|
||||
/// Opcode 0x68 - Place 9 byte item on stack
|
||||
PUSH9,
|
||||
/// Opcode 0x69 - Place 10 byte item on stack
|
||||
PUSH10,
|
||||
/// Opcode 0x6A - Place 11 byte item on stack
|
||||
PUSH11,
|
||||
/// Opcode 0x6B - Place 12 byte item on stack
|
||||
PUSH12,
|
||||
/// Opcode 0x6C - Place 13 byte item on stack
|
||||
PUSH13,
|
||||
/// Opcode 0x6D - Place 14 byte item on stack
|
||||
PUSH14,
|
||||
/// Opcode 0x6E - Place 15 byte item on stack
|
||||
PUSH15,
|
||||
/// Opcode 0x6F - Place 16 byte item on stack
|
||||
PUSH16,
|
||||
/// Opcode 0x70 - Place 17 byte item on stack
|
||||
PUSH17,
|
||||
/// Opcode 0x71 - Place 18 byte item on stack
|
||||
PUSH18,
|
||||
/// Opcode 0x72 - Place 19 byte item on stack
|
||||
PUSH19,
|
||||
/// Opcode 0x73 - Place 20 byte item on stack
|
||||
PUSH20,
|
||||
/// Opcode 0x74 - Place 21 byte item on stack
|
||||
PUSH21,
|
||||
/// Opcode 0x75 - Place 22 byte item on stack
|
||||
PUSH22,
|
||||
/// Opcode 0x76 - Place 23 byte item on stack
|
||||
PUSH23,
|
||||
/// Opcode 0x77 - Place 24 byte item on stack
|
||||
PUSH24,
|
||||
/// Opcode 0x78 - Place 25 byte item on stack
|
||||
PUSH25,
|
||||
/// Opcode 0x79 - Place 26 byte item on stack
|
||||
PUSH26,
|
||||
/// Opcode 0x7A - Place 27 byte item on stack
|
||||
PUSH27,
|
||||
/// Opcode 0x7B - Place 28 byte item on stack
|
||||
PUSH28,
|
||||
/// Opcode 0x7C - Place 29 byte item on stack
|
||||
PUSH29,
|
||||
/// Opcode 0x7D - Place 30 byte item on stack
|
||||
PUSH30,
|
||||
/// Opcode 0x7E - Place 31 byte item on stack
|
||||
PUSH31,
|
||||
/// Opcode 0x7F - Place 32 byte item on stack
|
||||
PUSH32,
|
||||
|
||||
// 0x80 range - dups.
|
||||
/// Opcode 0x80 - Duplicate 1st stack item
|
||||
DUP1,
|
||||
/// Opcode 0x81 - Duplicate 2nd stack item
|
||||
DUP2,
|
||||
/// Opcode 0x82 - Duplicate 3rd stack item
|
||||
DUP3,
|
||||
/// Opcode 0x83 - Duplicate 4th stack item
|
||||
DUP4,
|
||||
/// Opcode 0x84 - Duplicate 5th stack item
|
||||
DUP5,
|
||||
/// Opcode 0x85 - Duplicate 6th stack item
|
||||
DUP6,
|
||||
/// Opcode 0x86 - Duplicate 7th stack item
|
||||
DUP7,
|
||||
/// Opcode 0x87 - Duplicate 8th stack item
|
||||
DUP8,
|
||||
/// Opcode 0x88 - Duplicate 9th stack item
|
||||
DUP9,
|
||||
/// Opcode 0x89 - Duplicate 10th stack item
|
||||
DUP10,
|
||||
/// Opcode 0x8A - Duplicate 11th stack item
|
||||
DUP11,
|
||||
/// Opcode 0x8B - Duplicate 12th stack item
|
||||
DUP12,
|
||||
/// Opcode 0x8C - Duplicate 13th stack item
|
||||
DUP13,
|
||||
/// Opcode 0x8D - Duplicate 14th stack item
|
||||
DUP14,
|
||||
/// Opcode 0x8E - Duplicate 15th stack item
|
||||
DUP15,
|
||||
/// Opcode 0x8F - Duplicate 16th stack item
|
||||
DUP16,
|
||||
|
||||
// 0x90 range - swaps.
|
||||
/// Opcode 0x90 - Exchange 1st and 1st stack items
|
||||
SWAP1,
|
||||
/// Opcode 0x91 - Exchange 1st and 2nd stack items
|
||||
SWAP2,
|
||||
/// Opcode 0x92 - Exchange 1st and 3rd stack items
|
||||
SWAP3,
|
||||
/// Opcode 0x93 - Exchange 1st and 4th stack items
|
||||
SWAP4,
|
||||
/// Opcode 0x94 - Exchange 1st and 5th stack items
|
||||
SWAP5,
|
||||
/// Opcode 0x95 - Exchange 1st and 6th stack items
|
||||
SWAP6,
|
||||
/// Opcode 0x96 - Exchange 1st and 7th stack items
|
||||
SWAP7,
|
||||
/// Opcode 0x97 - Exchange 1st and 8th stack items
|
||||
SWAP8,
|
||||
/// Opcode 0x98 - Exchange 1st and 9th stack items
|
||||
SWAP9,
|
||||
/// Opcode 0x99 - Exchange 1st and 10th stack items
|
||||
SWAP10,
|
||||
/// Opcode 0x9A - Exchange 1st and 11th stack items
|
||||
SWAP11,
|
||||
/// Opcode 0x9B - Exchange 1st and 12th stack items
|
||||
SWAP12,
|
||||
/// Opcode 0x9C - Exchange 1st and 13th stack items
|
||||
SWAP13,
|
||||
/// Opcode 0x9D - Exchange 1st and 14th stack items
|
||||
SWAP14,
|
||||
/// Opcode 0x9E - Exchange 1st and 15th stack items
|
||||
SWAP15,
|
||||
/// Opcode 0x9F - Exchange 1st and 16th stack items
|
||||
SWAP16,
|
||||
|
||||
// 0xA0 range - logging ops.
|
||||
/// Opcode 0xA0 - Append log record with one topic
|
||||
LOG0,
|
||||
/// Opcode 0xA1 - Append log record with two topics
|
||||
LOG1,
|
||||
/// Opcode 0xA2 - Append log record with three topics
|
||||
LOG2,
|
||||
/// Opcode 0xA3 - Append log record with four topics
|
||||
LOG3,
|
||||
/// Opcode 0xA4 - Append log record with five topics
|
||||
LOG4,
|
||||
|
||||
// 0xA5 - 0xEF are invalid
|
||||
|
||||
// 0xF0 range - closures.
|
||||
/// Opcode 0xF0 - Create a new account with associated code
|
||||
CREATE,
|
||||
/// Opcode 0xF1 - Message-call into an account
|
||||
CALL,
|
||||
/// Opcode 0xF2 - Message-call into this account with alternative account’s code
|
||||
CALLCODE,
|
||||
/// Opcode 0xF3 - Halt execution returning output data
|
||||
RETURN,
|
||||
/// Opcode 0xF4 - Message-call into this account with an alternative account’s code, but
|
||||
/// persisting the current values for sender and value
|
||||
DELEGATECALL,
|
||||
/// Opcode 0xF5 - Create a new account with associated code at a predictable address
|
||||
CREATE2,
|
||||
|
||||
// 0xF6 - 0xF9 are invalid
|
||||
|
||||
// 0xFA range - closures
|
||||
/// Opcode 0xFA - Static message-call into an account
|
||||
STATICCALL,
|
||||
|
||||
// 0xFB - 0xFC are invalid
|
||||
|
||||
// 0xfd range - closures
|
||||
/// Opcode 0xFD - Halt execution reverting state changes but returning data and remaining gas
|
||||
REVERT,
|
||||
#[default]
|
||||
/// Opcode 0xFE - Designated invalid instruction
|
||||
INVALID,
|
||||
/// Opcode 0xFF - Halt execution and register account for later deletion
|
||||
SELFDESTRUCT,
|
||||
}
|
Loading…
Reference in New Issue