diff --git a/CHANGELOG.md b/CHANGELOG.md index 76fe911ae..e4455d486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ Documentation of all notable changes to the **EVMC** project. The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning]. +## [11.0.0] — unreleased + +### Added + +- The Prague EVM revision (anticipated after Cancun) + [#683](https://github.com/ethereum/evmc/pull/683) + + ## [10.0.0] — 2022-08-25 ### Added diff --git a/bindings/go/evmc/evmc.go b/bindings/go/evmc/evmc.go index 825bfdbb7..f18e1eef4 100644 --- a/bindings/go/evmc/evmc.go +++ b/bindings/go/evmc/evmc.go @@ -108,6 +108,7 @@ const ( Paris Revision = C.EVMC_PARIS Shanghai Revision = C.EVMC_SHANGHAI Cancun Revision = C.EVMC_CANCUN + Prague Revision = C.EVMC_PRAGUE MaxRevision Revision = C.EVMC_MAX_REVISION LatestStableRevision Revision = C.EVMC_LATEST_STABLE_REVISION ) diff --git a/bindings/go/evmc/evmc_test.go b/bindings/go/evmc/evmc_test.go index 74694843b..68d8f0b4e 100644 --- a/bindings/go/evmc/evmc_test.go +++ b/bindings/go/evmc/evmc_test.go @@ -61,7 +61,7 @@ func TestExecuteEmptyCode(t *testing.T) { } func TestRevision(t *testing.T) { - if MaxRevision != Cancun { + if MaxRevision != Prague { t.Errorf("missing constant for revision %d", MaxRevision) } if LatestStableRevision != London { diff --git a/include/evmc/evmc.h b/include/evmc/evmc.h index 408fa964d..129a7bd2d 100644 --- a/include/evmc/evmc.h +++ b/include/evmc/evmc.h @@ -964,11 +964,19 @@ enum evmc_revision * The Cancun revision. * * The future next revision after Shanghai. + * https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md */ EVMC_CANCUN = 12, + /** + * The Prague revision. + * + * The future next revision after Cancun. + */ + EVMC_PRAGUE = 13, + /** The maximum EVM revision supported. */ - EVMC_MAX_REVISION = EVMC_CANCUN, + EVMC_MAX_REVISION = EVMC_PRAGUE, /** * The latest known EVM revision with finalized specification. diff --git a/include/evmc/helpers.h b/include/evmc/helpers.h index 17db3d194..7c430726b 100644 --- a/include/evmc/helpers.h +++ b/include/evmc/helpers.h @@ -297,6 +297,8 @@ static inline const char* evmc_revision_to_string(enum evmc_revision rev) return "Shanghai"; case EVMC_CANCUN: return "Cancun"; + case EVMC_PRAGUE: + return "Prague"; } return ""; } diff --git a/lib/instructions/instruction_metrics.c b/lib/instructions/instruction_metrics.c index 059ba76f0..6c5f1a6da 100644 --- a/lib/instructions/instruction_metrics.c +++ b/lib/instructions/instruction_metrics.c @@ -33,6 +33,264 @@ enum WARM_STORAGE_READ_COST = 100 }; +static struct evmc_instruction_metrics prague_metrics[256] = { + /* STOP = 0x00 */ {ZERO, 0, 0}, + /* ADD = 0x01 */ {VERYLOW, 2, -1}, + /* MUL = 0x02 */ {LOW, 2, -1}, + /* SUB = 0x03 */ {VERYLOW, 2, -1}, + /* DIV = 0x04 */ {LOW, 2, -1}, + /* SDIV = 0x05 */ {LOW, 2, -1}, + /* MOD = 0x06 */ {LOW, 2, -1}, + /* SMOD = 0x07 */ {LOW, 2, -1}, + /* ADDMOD = 0x08 */ {MID, 3, -2}, + /* MULMOD = 0x09 */ {MID, 3, -2}, + /* EXP = 0x0a */ {HIGH, 2, -1}, + /* SIGNEXTEND = 0x0b */ {LOW, 2, -1}, + /* = 0x0c */ {UNDEFINED, 0, 0}, + /* = 0x0d */ {UNDEFINED, 0, 0}, + /* = 0x0e */ {UNDEFINED, 0, 0}, + /* = 0x0f */ {UNDEFINED, 0, 0}, + /* LT = 0x10 */ {VERYLOW, 2, -1}, + /* GT = 0x11 */ {VERYLOW, 2, -1}, + /* SLT = 0x12 */ {VERYLOW, 2, -1}, + /* SGT = 0x13 */ {VERYLOW, 2, -1}, + /* EQ = 0x14 */ {VERYLOW, 2, -1}, + /* ISZERO = 0x15 */ {VERYLOW, 1, 0}, + /* AND = 0x16 */ {VERYLOW, 2, -1}, + /* OR = 0x17 */ {VERYLOW, 2, -1}, + /* XOR = 0x18 */ {VERYLOW, 2, -1}, + /* NOT = 0x19 */ {VERYLOW, 1, 0}, + /* BYTE = 0x1a */ {VERYLOW, 2, -1}, + /* SHL = 0x1b */ {VERYLOW, 2, -1}, + /* SHR = 0x1c */ {VERYLOW, 2, -1}, + /* SAR = 0x1d */ {VERYLOW, 2, -1}, + /* = 0x1e */ {UNDEFINED, 0, 0}, + /* = 0x1f */ {UNDEFINED, 0, 0}, + /* KECCAK256 = 0x20 */ {30, 2, -1}, + /* = 0x21 */ {UNDEFINED, 0, 0}, + /* = 0x22 */ {UNDEFINED, 0, 0}, + /* = 0x23 */ {UNDEFINED, 0, 0}, + /* = 0x24 */ {UNDEFINED, 0, 0}, + /* = 0x25 */ {UNDEFINED, 0, 0}, + /* = 0x26 */ {UNDEFINED, 0, 0}, + /* = 0x27 */ {UNDEFINED, 0, 0}, + /* = 0x28 */ {UNDEFINED, 0, 0}, + /* = 0x29 */ {UNDEFINED, 0, 0}, + /* = 0x2a */ {UNDEFINED, 0, 0}, + /* = 0x2b */ {UNDEFINED, 0, 0}, + /* = 0x2c */ {UNDEFINED, 0, 0}, + /* = 0x2d */ {UNDEFINED, 0, 0}, + /* = 0x2e */ {UNDEFINED, 0, 0}, + /* = 0x2f */ {UNDEFINED, 0, 0}, + /* ADDRESS = 0x30 */ {BASE, 0, 1}, + /* BALANCE = 0x31 */ {WARM_STORAGE_READ_COST, 1, 0}, + /* ORIGIN = 0x32 */ {BASE, 0, 1}, + /* CALLER = 0x33 */ {BASE, 0, 1}, + /* CALLVALUE = 0x34 */ {BASE, 0, 1}, + /* CALLDATALOAD = 0x35 */ {VERYLOW, 1, 0}, + /* CALLDATASIZE = 0x36 */ {BASE, 0, 1}, + /* CALLDATACOPY = 0x37 */ {VERYLOW, 3, -3}, + /* CODESIZE = 0x38 */ {BASE, 0, 1}, + /* CODECOPY = 0x39 */ {VERYLOW, 3, -3}, + /* GASPRICE = 0x3a */ {BASE, 0, 1}, + /* EXTCODESIZE = 0x3b */ {WARM_STORAGE_READ_COST, 1, 0}, + /* EXTCODECOPY = 0x3c */ {WARM_STORAGE_READ_COST, 4, -4}, + /* RETURNDATASIZE = 0x3d */ {BASE, 0, 1}, + /* RETURNDATACOPY = 0x3e */ {VERYLOW, 3, -3}, + /* EXTCODEHASH = 0x3f */ {WARM_STORAGE_READ_COST, 1, 0}, + /* BLOCKHASH = 0x40 */ {20, 1, 0}, + /* COINBASE = 0x41 */ {BASE, 0, 1}, + /* TIMESTAMP = 0x42 */ {BASE, 0, 1}, + /* NUMBER = 0x43 */ {BASE, 0, 1}, + /* PREVRANDAO = 0x44 */ {BASE, 0, 1}, + /* GASLIMIT = 0x45 */ {BASE, 0, 1}, + /* CHAINID = 0x46 */ {BASE, 0, 1}, + /* SELFBALANCE = 0x47 */ {LOW, 0, 1}, + /* BASEFEE = 0x48 */ {BASE, 0, 1}, + /* = 0x49 */ {UNDEFINED, 0, 0}, + /* = 0x4a */ {UNDEFINED, 0, 0}, + /* = 0x4b */ {UNDEFINED, 0, 0}, + /* = 0x4c */ {UNDEFINED, 0, 0}, + /* = 0x4d */ {UNDEFINED, 0, 0}, + /* = 0x4e */ {UNDEFINED, 0, 0}, + /* = 0x4f */ {UNDEFINED, 0, 0}, + /* POP = 0x50 */ {BASE, 1, -1}, + /* MLOAD = 0x51 */ {VERYLOW, 1, 0}, + /* MSTORE = 0x52 */ {VERYLOW, 2, -2}, + /* MSTORE8 = 0x53 */ {VERYLOW, 2, -2}, + /* SLOAD = 0x54 */ {WARM_STORAGE_READ_COST, 1, 0}, + /* SSTORE = 0x55 */ {0, 2, -2}, + /* JUMP = 0x56 */ {MID, 1, -1}, + /* JUMPI = 0x57 */ {HIGH, 2, -2}, + /* PC = 0x58 */ {BASE, 0, 1}, + /* MSIZE = 0x59 */ {BASE, 0, 1}, + /* GAS = 0x5a */ {BASE, 0, 1}, + /* JUMPDEST = 0x5b */ {1, 0, 0}, + /* = 0x5c */ {UNDEFINED, 0, 0}, + /* = 0x5d */ {UNDEFINED, 0, 0}, + /* = 0x5e */ {UNDEFINED, 0, 0}, + /* PUSH0 = 0x5f */ {BASE, 0, 1}, + /* PUSH1 = 0x60 */ {VERYLOW, 0, 1}, + /* PUSH2 = 0x61 */ {VERYLOW, 0, 1}, + /* PUSH3 = 0x62 */ {VERYLOW, 0, 1}, + /* PUSH4 = 0x63 */ {VERYLOW, 0, 1}, + /* PUSH5 = 0x64 */ {VERYLOW, 0, 1}, + /* PUSH6 = 0x65 */ {VERYLOW, 0, 1}, + /* PUSH7 = 0x66 */ {VERYLOW, 0, 1}, + /* PUSH8 = 0x67 */ {VERYLOW, 0, 1}, + /* PUSH9 = 0x68 */ {VERYLOW, 0, 1}, + /* PUSH10 = 0x69 */ {VERYLOW, 0, 1}, + /* PUSH11 = 0x6a */ {VERYLOW, 0, 1}, + /* PUSH12 = 0x6b */ {VERYLOW, 0, 1}, + /* PUSH13 = 0x6c */ {VERYLOW, 0, 1}, + /* PUSH14 = 0x6d */ {VERYLOW, 0, 1}, + /* PUSH15 = 0x6e */ {VERYLOW, 0, 1}, + /* PUSH16 = 0x6f */ {VERYLOW, 0, 1}, + /* PUSH17 = 0x70 */ {VERYLOW, 0, 1}, + /* PUSH18 = 0x71 */ {VERYLOW, 0, 1}, + /* PUSH19 = 0x72 */ {VERYLOW, 0, 1}, + /* PUSH20 = 0x73 */ {VERYLOW, 0, 1}, + /* PUSH21 = 0x74 */ {VERYLOW, 0, 1}, + /* PUSH22 = 0x75 */ {VERYLOW, 0, 1}, + /* PUSH23 = 0x76 */ {VERYLOW, 0, 1}, + /* PUSH24 = 0x77 */ {VERYLOW, 0, 1}, + /* PUSH25 = 0x78 */ {VERYLOW, 0, 1}, + /* PUSH26 = 0x79 */ {VERYLOW, 0, 1}, + /* PUSH27 = 0x7a */ {VERYLOW, 0, 1}, + /* PUSH28 = 0x7b */ {VERYLOW, 0, 1}, + /* PUSH29 = 0x7c */ {VERYLOW, 0, 1}, + /* PUSH30 = 0x7d */ {VERYLOW, 0, 1}, + /* PUSH31 = 0x7e */ {VERYLOW, 0, 1}, + /* PUSH32 = 0x7f */ {VERYLOW, 0, 1}, + /* DUP1 = 0x80 */ {VERYLOW, 1, 1}, + /* DUP2 = 0x81 */ {VERYLOW, 2, 1}, + /* DUP3 = 0x82 */ {VERYLOW, 3, 1}, + /* DUP4 = 0x83 */ {VERYLOW, 4, 1}, + /* DUP5 = 0x84 */ {VERYLOW, 5, 1}, + /* DUP6 = 0x85 */ {VERYLOW, 6, 1}, + /* DUP7 = 0x86 */ {VERYLOW, 7, 1}, + /* DUP8 = 0x87 */ {VERYLOW, 8, 1}, + /* DUP9 = 0x88 */ {VERYLOW, 9, 1}, + /* DUP10 = 0x89 */ {VERYLOW, 10, 1}, + /* DUP11 = 0x8a */ {VERYLOW, 11, 1}, + /* DUP12 = 0x8b */ {VERYLOW, 12, 1}, + /* DUP13 = 0x8c */ {VERYLOW, 13, 1}, + /* DUP14 = 0x8d */ {VERYLOW, 14, 1}, + /* DUP15 = 0x8e */ {VERYLOW, 15, 1}, + /* DUP16 = 0x8f */ {VERYLOW, 16, 1}, + /* SWAP1 = 0x90 */ {VERYLOW, 2, 0}, + /* SWAP2 = 0x91 */ {VERYLOW, 3, 0}, + /* SWAP3 = 0x92 */ {VERYLOW, 4, 0}, + /* SWAP4 = 0x93 */ {VERYLOW, 5, 0}, + /* SWAP5 = 0x94 */ {VERYLOW, 6, 0}, + /* SWAP6 = 0x95 */ {VERYLOW, 7, 0}, + /* SWAP7 = 0x96 */ {VERYLOW, 8, 0}, + /* SWAP8 = 0x97 */ {VERYLOW, 9, 0}, + /* SWAP9 = 0x98 */ {VERYLOW, 10, 0}, + /* SWAP10 = 0x99 */ {VERYLOW, 11, 0}, + /* SWAP11 = 0x9a */ {VERYLOW, 12, 0}, + /* SWAP12 = 0x9b */ {VERYLOW, 13, 0}, + /* SWAP13 = 0x9c */ {VERYLOW, 14, 0}, + /* SWAP14 = 0x9d */ {VERYLOW, 15, 0}, + /* SWAP15 = 0x9e */ {VERYLOW, 16, 0}, + /* SWAP16 = 0x9f */ {VERYLOW, 17, 0}, + /* LOG0 = 0xa0 */ {1 * 375, 2, -2}, + /* LOG1 = 0xa1 */ {2 * 375, 3, -3}, + /* LOG2 = 0xa2 */ {3 * 375, 4, -4}, + /* LOG3 = 0xa3 */ {4 * 375, 5, -5}, + /* LOG4 = 0xa4 */ {5 * 375, 6, -6}, + /* = 0xa5 */ {UNDEFINED, 0, 0}, + /* = 0xa6 */ {UNDEFINED, 0, 0}, + /* = 0xa7 */ {UNDEFINED, 0, 0}, + /* = 0xa8 */ {UNDEFINED, 0, 0}, + /* = 0xa9 */ {UNDEFINED, 0, 0}, + /* = 0xaa */ {UNDEFINED, 0, 0}, + /* = 0xab */ {UNDEFINED, 0, 0}, + /* = 0xac */ {UNDEFINED, 0, 0}, + /* = 0xad */ {UNDEFINED, 0, 0}, + /* = 0xae */ {UNDEFINED, 0, 0}, + /* = 0xaf */ {UNDEFINED, 0, 0}, + /* = 0xb0 */ {UNDEFINED, 0, 0}, + /* = 0xb1 */ {UNDEFINED, 0, 0}, + /* = 0xb2 */ {UNDEFINED, 0, 0}, + /* = 0xb3 */ {UNDEFINED, 0, 0}, + /* = 0xb4 */ {UNDEFINED, 0, 0}, + /* = 0xb5 */ {UNDEFINED, 0, 0}, + /* = 0xb6 */ {UNDEFINED, 0, 0}, + /* = 0xb7 */ {UNDEFINED, 0, 0}, + /* = 0xb8 */ {UNDEFINED, 0, 0}, + /* = 0xb9 */ {UNDEFINED, 0, 0}, + /* = 0xba */ {UNDEFINED, 0, 0}, + /* = 0xbb */ {UNDEFINED, 0, 0}, + /* = 0xbc */ {UNDEFINED, 0, 0}, + /* = 0xbd */ {UNDEFINED, 0, 0}, + /* = 0xbe */ {UNDEFINED, 0, 0}, + /* = 0xbf */ {UNDEFINED, 0, 0}, + /* = 0xc0 */ {UNDEFINED, 0, 0}, + /* = 0xc1 */ {UNDEFINED, 0, 0}, + /* = 0xc2 */ {UNDEFINED, 0, 0}, + /* = 0xc3 */ {UNDEFINED, 0, 0}, + /* = 0xc4 */ {UNDEFINED, 0, 0}, + /* = 0xc5 */ {UNDEFINED, 0, 0}, + /* = 0xc6 */ {UNDEFINED, 0, 0}, + /* = 0xc7 */ {UNDEFINED, 0, 0}, + /* = 0xc8 */ {UNDEFINED, 0, 0}, + /* = 0xc9 */ {UNDEFINED, 0, 0}, + /* = 0xca */ {UNDEFINED, 0, 0}, + /* = 0xcb */ {UNDEFINED, 0, 0}, + /* = 0xcc */ {UNDEFINED, 0, 0}, + /* = 0xcd */ {UNDEFINED, 0, 0}, + /* = 0xce */ {UNDEFINED, 0, 0}, + /* = 0xcf */ {UNDEFINED, 0, 0}, + /* = 0xd0 */ {UNDEFINED, 0, 0}, + /* = 0xd1 */ {UNDEFINED, 0, 0}, + /* = 0xd2 */ {UNDEFINED, 0, 0}, + /* = 0xd3 */ {UNDEFINED, 0, 0}, + /* = 0xd4 */ {UNDEFINED, 0, 0}, + /* = 0xd5 */ {UNDEFINED, 0, 0}, + /* = 0xd6 */ {UNDEFINED, 0, 0}, + /* = 0xd7 */ {UNDEFINED, 0, 0}, + /* = 0xd8 */ {UNDEFINED, 0, 0}, + /* = 0xd9 */ {UNDEFINED, 0, 0}, + /* = 0xda */ {UNDEFINED, 0, 0}, + /* = 0xdb */ {UNDEFINED, 0, 0}, + /* = 0xdc */ {UNDEFINED, 0, 0}, + /* = 0xdd */ {UNDEFINED, 0, 0}, + /* = 0xde */ {UNDEFINED, 0, 0}, + /* = 0xdf */ {UNDEFINED, 0, 0}, + /* = 0xe0 */ {UNDEFINED, 0, 0}, + /* = 0xe1 */ {UNDEFINED, 0, 0}, + /* = 0xe2 */ {UNDEFINED, 0, 0}, + /* = 0xe3 */ {UNDEFINED, 0, 0}, + /* = 0xe4 */ {UNDEFINED, 0, 0}, + /* = 0xe5 */ {UNDEFINED, 0, 0}, + /* = 0xe6 */ {UNDEFINED, 0, 0}, + /* = 0xe7 */ {UNDEFINED, 0, 0}, + /* = 0xe8 */ {UNDEFINED, 0, 0}, + /* = 0xe9 */ {UNDEFINED, 0, 0}, + /* = 0xea */ {UNDEFINED, 0, 0}, + /* = 0xeb */ {UNDEFINED, 0, 0}, + /* = 0xec */ {UNDEFINED, 0, 0}, + /* = 0xed */ {UNDEFINED, 0, 0}, + /* = 0xee */ {UNDEFINED, 0, 0}, + /* = 0xef */ {UNDEFINED, 0, 0}, + /* CREATE = 0xf0 */ {32000, 3, -2}, + /* CALL = 0xf1 */ {WARM_STORAGE_READ_COST, 7, -6}, + /* CALLCODE = 0xf2 */ {WARM_STORAGE_READ_COST, 7, -6}, + /* RETURN = 0xf3 */ {ZERO, 2, -2}, + /* DELEGATECALL = 0xf4 */ {WARM_STORAGE_READ_COST, 6, -5}, + /* CREATE2 = 0xf5 */ {32000, 4, -3}, + /* = 0xf6 */ {UNDEFINED, 0, 0}, + /* = 0xf7 */ {UNDEFINED, 0, 0}, + /* = 0xf8 */ {UNDEFINED, 0, 0}, + /* = 0xf9 */ {UNDEFINED, 0, 0}, + /* STATICCALL = 0xfa */ {WARM_STORAGE_READ_COST, 6, -5}, + /* = 0xfb */ {UNDEFINED, 0, 0}, + /* = 0xfc */ {UNDEFINED, 0, 0}, + /* REVERT = 0xfd */ {ZERO, 2, -2}, + /* INVALID = 0xfe */ {ZERO, 0, 0}, + /* SELFDESTRUCT = 0xff */ {5000, 1, -1}, +}; static struct evmc_instruction_metrics cancun_metrics[256] = { /* STOP = 0x00 */ {ZERO, 0, 0}, @@ -2629,6 +2887,8 @@ const struct evmc_instruction_metrics* evmc_get_instruction_metrics_table( { switch (revision) { + case EVMC_PRAGUE: + return prague_metrics; case EVMC_CANCUN: return cancun_metrics; case EVMC_SHANGHAI: diff --git a/lib/instructions/instruction_names.c b/lib/instructions/instruction_names.c index 64a21592d..3fa8175a3 100644 --- a/lib/instructions/instruction_names.c +++ b/lib/instructions/instruction_names.c @@ -4,6 +4,265 @@ #include +static const char* prague_names[256] = { + /* 0x00 */ "STOP", + /* 0x01 */ "ADD", + /* 0x02 */ "MUL", + /* 0x03 */ "SUB", + /* 0x04 */ "DIV", + /* 0x05 */ "SDIV", + /* 0x06 */ "MOD", + /* 0x07 */ "SMOD", + /* 0x08 */ "ADDMOD", + /* 0x09 */ "MULMOD", + /* 0x0a */ "EXP", + /* 0x0b */ "SIGNEXTEND", + /* 0x0c */ NULL, + /* 0x0d */ NULL, + /* 0x0e */ NULL, + /* 0x0f */ NULL, + /* 0x10 */ "LT", + /* 0x11 */ "GT", + /* 0x12 */ "SLT", + /* 0x13 */ "SGT", + /* 0x14 */ "EQ", + /* 0x15 */ "ISZERO", + /* 0x16 */ "AND", + /* 0x17 */ "OR", + /* 0x18 */ "XOR", + /* 0x19 */ "NOT", + /* 0x1a */ "BYTE", + /* 0x1b */ "SHL", + /* 0x1c */ "SHR", + /* 0x1d */ "SAR", + /* 0x1e */ NULL, + /* 0x1f */ NULL, + /* 0x20 */ "KECCAK256", + /* 0x21 */ NULL, + /* 0x22 */ NULL, + /* 0x23 */ NULL, + /* 0x24 */ NULL, + /* 0x25 */ NULL, + /* 0x26 */ NULL, + /* 0x27 */ NULL, + /* 0x28 */ NULL, + /* 0x29 */ NULL, + /* 0x2a */ NULL, + /* 0x2b */ NULL, + /* 0x2c */ NULL, + /* 0x2d */ NULL, + /* 0x2e */ NULL, + /* 0x2f */ NULL, + /* 0x30 */ "ADDRESS", + /* 0x31 */ "BALANCE", + /* 0x32 */ "ORIGIN", + /* 0x33 */ "CALLER", + /* 0x34 */ "CALLVALUE", + /* 0x35 */ "CALLDATALOAD", + /* 0x36 */ "CALLDATASIZE", + /* 0x37 */ "CALLDATACOPY", + /* 0x38 */ "CODESIZE", + /* 0x39 */ "CODECOPY", + /* 0x3a */ "GASPRICE", + /* 0x3b */ "EXTCODESIZE", + /* 0x3c */ "EXTCODECOPY", + /* 0x3d */ "RETURNDATASIZE", + /* 0x3e */ "RETURNDATACOPY", + /* 0x3f */ "EXTCODEHASH", + /* 0x40 */ "BLOCKHASH", + /* 0x41 */ "COINBASE", + /* 0x42 */ "TIMESTAMP", + /* 0x43 */ "NUMBER", + /* 0x44 */ "PREVRANDAO", + /* 0x45 */ "GASLIMIT", + /* 0x46 */ "CHAINID", + /* 0x47 */ "SELFBALANCE", + /* 0x48 */ "BASEFEE", + /* 0x49 */ NULL, + /* 0x4a */ NULL, + /* 0x4b */ NULL, + /* 0x4c */ NULL, + /* 0x4d */ NULL, + /* 0x4e */ NULL, + /* 0x4f */ NULL, + /* 0x50 */ "POP", + /* 0x51 */ "MLOAD", + /* 0x52 */ "MSTORE", + /* 0x53 */ "MSTORE8", + /* 0x54 */ "SLOAD", + /* 0x55 */ "SSTORE", + /* 0x56 */ "JUMP", + /* 0x57 */ "JUMPI", + /* 0x58 */ "PC", + /* 0x59 */ "MSIZE", + /* 0x5a */ "GAS", + /* 0x5b */ "JUMPDEST", + /* 0x5c */ NULL, + /* 0x5d */ NULL, + /* 0x5e */ NULL, + /* 0x5f */ "PUSH0", + /* 0x60 */ "PUSH1", + /* 0x61 */ "PUSH2", + /* 0x62 */ "PUSH3", + /* 0x63 */ "PUSH4", + /* 0x64 */ "PUSH5", + /* 0x65 */ "PUSH6", + /* 0x66 */ "PUSH7", + /* 0x67 */ "PUSH8", + /* 0x68 */ "PUSH9", + /* 0x69 */ "PUSH10", + /* 0x6a */ "PUSH11", + /* 0x6b */ "PUSH12", + /* 0x6c */ "PUSH13", + /* 0x6d */ "PUSH14", + /* 0x6e */ "PUSH15", + /* 0x6f */ "PUSH16", + /* 0x70 */ "PUSH17", + /* 0x71 */ "PUSH18", + /* 0x72 */ "PUSH19", + /* 0x73 */ "PUSH20", + /* 0x74 */ "PUSH21", + /* 0x75 */ "PUSH22", + /* 0x76 */ "PUSH23", + /* 0x77 */ "PUSH24", + /* 0x78 */ "PUSH25", + /* 0x79 */ "PUSH26", + /* 0x7a */ "PUSH27", + /* 0x7b */ "PUSH28", + /* 0x7c */ "PUSH29", + /* 0x7d */ "PUSH30", + /* 0x7e */ "PUSH31", + /* 0x7f */ "PUSH32", + /* 0x80 */ "DUP1", + /* 0x81 */ "DUP2", + /* 0x82 */ "DUP3", + /* 0x83 */ "DUP4", + /* 0x84 */ "DUP5", + /* 0x85 */ "DUP6", + /* 0x86 */ "DUP7", + /* 0x87 */ "DUP8", + /* 0x88 */ "DUP9", + /* 0x89 */ "DUP10", + /* 0x8a */ "DUP11", + /* 0x8b */ "DUP12", + /* 0x8c */ "DUP13", + /* 0x8d */ "DUP14", + /* 0x8e */ "DUP15", + /* 0x8f */ "DUP16", + /* 0x90 */ "SWAP1", + /* 0x91 */ "SWAP2", + /* 0x92 */ "SWAP3", + /* 0x93 */ "SWAP4", + /* 0x94 */ "SWAP5", + /* 0x95 */ "SWAP6", + /* 0x96 */ "SWAP7", + /* 0x97 */ "SWAP8", + /* 0x98 */ "SWAP9", + /* 0x99 */ "SWAP10", + /* 0x9a */ "SWAP11", + /* 0x9b */ "SWAP12", + /* 0x9c */ "SWAP13", + /* 0x9d */ "SWAP14", + /* 0x9e */ "SWAP15", + /* 0x9f */ "SWAP16", + /* 0xa0 */ "LOG0", + /* 0xa1 */ "LOG1", + /* 0xa2 */ "LOG2", + /* 0xa3 */ "LOG3", + /* 0xa4 */ "LOG4", + /* 0xa5 */ NULL, + /* 0xa6 */ NULL, + /* 0xa7 */ NULL, + /* 0xa8 */ NULL, + /* 0xa9 */ NULL, + /* 0xaa */ NULL, + /* 0xab */ NULL, + /* 0xac */ NULL, + /* 0xad */ NULL, + /* 0xae */ NULL, + /* 0xaf */ NULL, + /* 0xb0 */ NULL, + /* 0xb1 */ NULL, + /* 0xb2 */ NULL, + /* 0xb3 */ NULL, + /* 0xb4 */ NULL, + /* 0xb5 */ NULL, + /* 0xb6 */ NULL, + /* 0xb7 */ NULL, + /* 0xb8 */ NULL, + /* 0xb9 */ NULL, + /* 0xba */ NULL, + /* 0xbb */ NULL, + /* 0xbc */ NULL, + /* 0xbd */ NULL, + /* 0xbe */ NULL, + /* 0xbf */ NULL, + /* 0xc0 */ NULL, + /* 0xc1 */ NULL, + /* 0xc2 */ NULL, + /* 0xc3 */ NULL, + /* 0xc4 */ NULL, + /* 0xc5 */ NULL, + /* 0xc6 */ NULL, + /* 0xc7 */ NULL, + /* 0xc8 */ NULL, + /* 0xc9 */ NULL, + /* 0xca */ NULL, + /* 0xcb */ NULL, + /* 0xcc */ NULL, + /* 0xcd */ NULL, + /* 0xce */ NULL, + /* 0xcf */ NULL, + /* 0xd0 */ NULL, + /* 0xd1 */ NULL, + /* 0xd2 */ NULL, + /* 0xd3 */ NULL, + /* 0xd4 */ NULL, + /* 0xd5 */ NULL, + /* 0xd6 */ NULL, + /* 0xd7 */ NULL, + /* 0xd8 */ NULL, + /* 0xd9 */ NULL, + /* 0xda */ NULL, + /* 0xdb */ NULL, + /* 0xdc */ NULL, + /* 0xdd */ NULL, + /* 0xde */ NULL, + /* 0xdf */ NULL, + /* 0xe0 */ NULL, + /* 0xe1 */ NULL, + /* 0xe2 */ NULL, + /* 0xe3 */ NULL, + /* 0xe4 */ NULL, + /* 0xe5 */ NULL, + /* 0xe6 */ NULL, + /* 0xe7 */ NULL, + /* 0xe8 */ NULL, + /* 0xe9 */ NULL, + /* 0xea */ NULL, + /* 0xeb */ NULL, + /* 0xec */ NULL, + /* 0xed */ NULL, + /* 0xee */ NULL, + /* 0xef */ NULL, + /* 0xf0 */ "CREATE", + /* 0xf1 */ "CALL", + /* 0xf2 */ "CALLCODE", + /* 0xf3 */ "RETURN", + /* 0xf4 */ "DELEGATECALL", + /* 0xf5 */ "CREATE2", + /* 0xf6 */ NULL, + /* 0xf7 */ NULL, + /* 0xf8 */ NULL, + /* 0xf9 */ NULL, + /* 0xfa */ "STATICCALL", + /* 0xfb */ NULL, + /* 0xfc */ NULL, + /* 0xfd */ "REVERT", + /* 0xfe */ "INVALID", + /* 0xff */ "SELFDESTRUCT", +}; + static const char* cancun_names[256] = { /* 0x00 */ "STOP", /* 0x01 */ "ADD", @@ -2339,6 +2598,8 @@ const char* const* evmc_get_instruction_names_table(enum evmc_revision revision) { switch (revision) { + case EVMC_PRAGUE: + return prague_names; case EVMC_CANCUN: return cancun_names; case EVMC_SHANGHAI: diff --git a/test/unittests/cpp_test.cpp b/test/unittests/cpp_test.cpp index 3c5f5f574..435613f88 100644 --- a/test/unittests/cpp_test.cpp +++ b/test/unittests/cpp_test.cpp @@ -901,6 +901,7 @@ TEST(cpp, revision_to_string) TEST_CASE(EVMC_PARIS), TEST_CASE(EVMC_SHANGHAI), TEST_CASE(EVMC_CANCUN), + TEST_CASE(EVMC_PRAGUE), }; #undef TEST_CASE