Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 0eb7f7b

Browse files
authored
Merge pull request #196 from lrettig/byzantium-opcodes
Adds support for Byzantium opcodes (WIP)
2 parents eb40b00 + f369469 commit 0eb7f7b

File tree

9 files changed

+89
-2
lines changed

9 files changed

+89
-2
lines changed

include/evm2wasm.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ enum class opcodeEnum
4747
GASPRICE,
4848
EXTCODESIZE,
4949
EXTCODECOPY,
50+
RETURNDATASIZE,
51+
RETURNDATACOPY,
5052
BLOCKHASH,
5153
COINBASE,
5254
TIMESTAMP,
@@ -75,8 +77,9 @@ enum class opcodeEnum
7577
RETURN,
7678
DELEGATECALL,
7779
STATICCALL,
78-
SELFDESTRUCT,
80+
REVERT,
7981
INVALID,
82+
SELFDESTRUCT,
8083
bswap_i32,
8184
bswap_i64,
8285
bswap_m128,
@@ -164,6 +167,8 @@ static std::map<int, std::tuple<opcodeEnum, int, int, int>> codes = {
164167
{0x3a, Opcode{opcodeEnum::GASPRICE, 0, 0, 1}},
165168
{0x3b, Opcode{opcodeEnum::EXTCODESIZE, 0, 1, 1}},
166169
{0x3c, Opcode{opcodeEnum::EXTCODECOPY, 0, 4, 0}},
170+
{0x3d, Opcode{opcodeEnum::RETURNDATASIZE, 0, 0, 1}},
171+
{0x3e, Opcode{opcodeEnum::RETURNDATACOPY, 0, 3, 0}},
167172

168173
// "0x40" range - block operations
169174
{0x40, Opcode{opcodeEnum::BLOCKHASH, 0, 1, 1}},
@@ -270,6 +275,8 @@ static std::map<int, std::tuple<opcodeEnum, int, int, int>> codes = {
270275
{0xfa, Opcode{opcodeEnum::STATICCALL, 0, 6, 1}},
271276

272277
// "0x70", range - other
278+
{0xfd, Opcode{opcodeEnum::REVERT, 0, 2, 0}},
279+
{0xfe, Opcode{opcodeEnum::INVALID, 0, 0, 0}},
273280
{0xff, Opcode{opcodeEnum::SELFDESTRUCT, 0, 1, 0}}};
274281

275282
static std::map<opcodeEnum, std::vector<opcodeEnum>> depMap = {
@@ -306,6 +313,7 @@ static std::map<opcodeEnum, std::vector<opcodeEnum>> depMap = {
306313
{opcodeEnum::EXTCODECOPY, {opcodeEnum::bswap_m256, opcodeEnum::callback, opcodeEnum::memusegas,
307314
opcodeEnum::check_overflow, opcodeEnum::memset}},
308315
{opcodeEnum::EXTCODESIZE, {opcodeEnum::callback_32, opcodeEnum::bswap_m256}},
316+
{opcodeEnum::RETURNDATACOPY, {opcodeEnum::memusegas, opcodeEnum::check_overflow, opcodeEnum::memset}},
309317
{opcodeEnum::LOG, {opcodeEnum::memusegas, opcodeEnum::check_overflow}},
310318
{opcodeEnum::BLOCKHASH, {opcodeEnum::check_overflow, opcodeEnum::callback_256}},
311319
{opcodeEnum::SHA3, {opcodeEnum::memusegas, opcodeEnum::bswap_m256, opcodeEnum::check_overflow,
@@ -326,6 +334,7 @@ static std::map<opcodeEnum, std::vector<opcodeEnum>> depMap = {
326334
{opcodeEnum::CREATE, {opcodeEnum::bswap_m256, opcodeEnum::bswap_m160, opcodeEnum::callback_160,
327335
opcodeEnum::memusegas, opcodeEnum::check_overflow}},
328336
{opcodeEnum::RETURN, {opcodeEnum::memusegas, opcodeEnum::check_overflow}},
337+
{opcodeEnum::REVERT, {opcodeEnum::memusegas, opcodeEnum::check_overflow}},
329338
{opcodeEnum::BALANCE, {opcodeEnum::bswap_m256, opcodeEnum::callback_128}},
330339
{opcodeEnum::SELFDESTRUCT, {opcodeEnum::bswap_m256}},
331340
{opcodeEnum::SSTORE, {opcodeEnum::bswap_m256, opcodeEnum::callback}},

include/wast-async.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ namespace evm2wasm
138138
.wast = ";; generated by ./wasm/generateInterface.js\n(func $STATICCALL (param $callback i32)(local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store\n (i32.add (get_global $sp) (i32.const -160))\n (i64.extend_u/i32\n (i32.eqz (call $callStatic(call $check_overflow_i64\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(i32.add (get_global $sp) (i32.const -32))(get_local $offset0)(get_local $length0)(get_local $callback)) ;; flip CALL result from EEI to EVM convention (0 -> 1, 1,2,.. -> 1)\n )))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -136)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -144)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -152)) (i64.const 0)))",
139139
.imports = "(import \"ethereum\" \"callStatic\" (func $callStatic (param i64 i32 i32 i32 i32) (result i32)))"
140140
}
141+
},{
142+
opcodeEnum::RETURNDATACOPY, {
143+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURNDATACOPY (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $returnDataCopy(get_local $offset0)(call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8))))(get_local $length0)))",
144+
.imports = "(import \"ethereum\" \"returnDataCopy\" (func $returnDataCopy (param i32 i32 i32) ))"
145+
}
146+
},{
147+
opcodeEnum::RETURNDATASIZE, {
148+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURNDATASIZE (i64.store\n (i32.add (get_global $sp) (i32.const 32))\n (i64.extend_u/i32\n (call $getReturnDataSize)))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const 56)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const 48)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const 40)) (i64.const 0)))",
149+
.imports = "(import \"ethereum\" \"getReturnDataSize\" (func $getReturnDataSize (result i32)))"
150+
}
141151
},{
142152
opcodeEnum::SSTORE, {
143153
.wast = ";; generated by ./wasm/generateInterface.js\n(func $SSTORE (param $callback i32) (call $storageStore(get_global $sp)(i32.add (get_global $sp) (i32.const -32))(get_local $callback)))",
@@ -158,6 +168,11 @@ namespace evm2wasm
158168
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURN (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $return(get_local $offset0)(get_local $length0)))",
159169
.imports = "(import \"ethereum\" \"return\" (func $return (param i32 i32) ))"
160170
}
171+
},{
172+
opcodeEnum::REVERT, {
173+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $REVERT (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $revert(get_local $offset0)(get_local $length0)))",
174+
.imports = "(import \"ethereum\" \"revert\" (func $revert (param i32 i32) ))"
175+
}
161176
},{
162177
opcodeEnum::ADD, {
163178
.wast = "(func $ADD\n (local $sp i32)\n\n (local $a i64)\n (local $c i64)\n (local $d i64)\n (local $carry i64)\n\n (set_local $sp (get_global $sp))\n \n ;; d c b a\n ;; pop the stack \n (set_local $a (i64.load (i32.add (get_local $sp) (i32.const 24))))\n (set_local $c (i64.load (i32.add (get_local $sp) (i32.const 8))))\n (set_local $d (i64.load (get_local $sp)))\n ;; decement the stack pointer\n (set_local $sp (i32.sub (get_local $sp) (i32.const 8)))\n\n ;; d \n (set_local $carry (i64.add (get_local $d) (i64.load (i32.sub (get_local $sp) (i32.const 24)))))\n ;; save d to mem\n (i64.store (i32.sub (get_local $sp) (i32.const 24)) (get_local $carry))\n ;; check for overflow\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $carry) (get_local $d))))\n\n ;; c use $d as reg\n (set_local $d (i64.add (i64.load (i32.sub (get_local $sp) (i32.const 16))) (get_local $carry)))\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $carry))))\n (set_local $d (i64.add (get_local $c) (get_local $d)))\n ;; store the result\n (i64.store (i32.sub (get_local $sp) (i32.const 16)) (get_local $d))\n ;; check overflow\n (set_local $carry (i64.or (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $c))) (get_local $carry)))\n\n ;; b\n ;; add carry\n (set_local $d (i64.add (i64.load (i32.sub (get_local $sp) (i32.const 8))) (get_local $carry)))\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $carry))))\n\n ;; use reg c\n (set_local $c (i64.load (i32.add (get_local $sp) (i32.const 24))))\n (set_local $d (i64.add (get_local $c) (get_local $d)))\n (i64.store (i32.sub (get_local $sp) (i32.const 8)) (get_local $d))\n ;; a\n (i64.store (get_local $sp) \n (i64.add ;; add a \n (get_local $a)\n (i64.add\n (i64.load (get_local $sp)) ;; load the operand\n (i64.or ;; carry \n (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $c))) \n (get_local $carry)))))\n)\n",

include/wast.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ namespace evm2wasm
138138
.wast = ";; generated by ./wasm/generateInterface.js\n(func $STATICCALL (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -96)))\n (i64.load (i32.add (get_global $sp) (i32.const -88)))\n (i64.load (i32.add (get_global $sp) (i32.const -80)))\n (i64.load (i32.add (get_global $sp) (i32.const -72)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (i64.store\n (i32.add (get_global $sp) (i32.const -160))\n (i64.extend_u/i32\n (i32.eqz (call $callStatic(call $check_overflow_i64\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24))))(i32.add (get_global $sp) (i32.const -32))(get_local $offset0)(get_local $length0)) ;; flip CALL result from EEI to EVM convention (0 -> 1, 1,2,.. -> 1)\n )))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const -136)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -144)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const -152)) (i64.const 0)))",
139139
.imports = "(import \"ethereum\" \"callStatic\" (func $callStatic (param i64 i32 i32 i32) (result i32)))"
140140
}
141+
},{
142+
opcodeEnum::RETURNDATACOPY, {
143+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURNDATACOPY (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -64)))\n (i64.load (i32.add (get_global $sp) (i32.const -56)))\n (i64.load (i32.add (get_global $sp) (i32.const -48)))\n (i64.load (i32.add (get_global $sp) (i32.const -40)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $returnDataCopy(get_local $offset0)(call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8))))(get_local $length0)))",
144+
.imports = "(import \"ethereum\" \"returnDataCopy\" (func $returnDataCopy (param i32 i32 i32) ))"
145+
}
146+
},{
147+
opcodeEnum::RETURNDATASIZE, {
148+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURNDATASIZE (i64.store\n (i32.add (get_global $sp) (i32.const 32))\n (i64.extend_u/i32\n (call $getReturnDataSize)))\n ;; zero out mem\n (i64.store (i32.add (get_global $sp) (i32.const 56)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const 48)) (i64.const 0))\n (i64.store (i32.add (get_global $sp) (i32.const 40)) (i64.const 0)))",
149+
.imports = "(import \"ethereum\" \"getReturnDataSize\" (func $getReturnDataSize (result i32)))"
150+
}
141151
},{
142152
opcodeEnum::SSTORE, {
143153
.wast = ";; generated by ./wasm/generateInterface.js\n(func $SSTORE (call $storageStore(get_global $sp)(i32.add (get_global $sp) (i32.const -32))))",
@@ -158,6 +168,11 @@ namespace evm2wasm
158168
.wast = ";; generated by ./wasm/generateInterface.js\n(func $RETURN (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $return(get_local $offset0)(get_local $length0)))",
159169
.imports = "(import \"ethereum\" \"return\" (func $return (param i32 i32) ))"
160170
}
171+
},{
172+
opcodeEnum::REVERT, {
173+
.wast = ";; generated by ./wasm/generateInterface.js\n(func $REVERT (local $offset0 i32)(local $length0 i32) (set_local $offset0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const 0)))\n (i64.load (i32.add (get_global $sp) (i32.const 8)))\n (i64.load (i32.add (get_global $sp) (i32.const 16)))\n (i64.load (i32.add (get_global $sp) (i32.const 24)))))(set_local $length0 (call $check_overflow\n (i64.load (i32.add (get_global $sp) (i32.const -32)))\n (i64.load (i32.add (get_global $sp) (i32.const -24)))\n (i64.load (i32.add (get_global $sp) (i32.const -16)))\n (i64.load (i32.add (get_global $sp) (i32.const -8)))))\n (call $memusegas (get_local $offset0) (get_local $length0))\n (set_local $offset0 (i32.add (get_global $memstart) (get_local $offset0))) (call $revert(get_local $offset0)(get_local $length0)))",
174+
.imports = "(import \"ethereum\" \"revert\" (func $revert (param i32 i32) ))"
175+
}
161176
},{
162177
opcodeEnum::ADD, {
163178
.wast = "(func $ADD\n (local $sp i32)\n\n (local $a i64)\n (local $c i64)\n (local $d i64)\n (local $carry i64)\n\n (set_local $sp (get_global $sp))\n \n ;; d c b a\n ;; pop the stack \n (set_local $a (i64.load (i32.add (get_local $sp) (i32.const 24))))\n (set_local $c (i64.load (i32.add (get_local $sp) (i32.const 8))))\n (set_local $d (i64.load (get_local $sp)))\n ;; decement the stack pointer\n (set_local $sp (i32.sub (get_local $sp) (i32.const 8)))\n\n ;; d \n (set_local $carry (i64.add (get_local $d) (i64.load (i32.sub (get_local $sp) (i32.const 24)))))\n ;; save d to mem\n (i64.store (i32.sub (get_local $sp) (i32.const 24)) (get_local $carry))\n ;; check for overflow\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $carry) (get_local $d))))\n\n ;; c use $d as reg\n (set_local $d (i64.add (i64.load (i32.sub (get_local $sp) (i32.const 16))) (get_local $carry)))\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $carry))))\n (set_local $d (i64.add (get_local $c) (get_local $d)))\n ;; store the result\n (i64.store (i32.sub (get_local $sp) (i32.const 16)) (get_local $d))\n ;; check overflow\n (set_local $carry (i64.or (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $c))) (get_local $carry)))\n\n ;; b\n ;; add carry\n (set_local $d (i64.add (i64.load (i32.sub (get_local $sp) (i32.const 8))) (get_local $carry)))\n (set_local $carry (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $carry))))\n\n ;; use reg c\n (set_local $c (i64.load (i32.add (get_local $sp) (i32.const 24))))\n (set_local $d (i64.add (get_local $c) (get_local $d)))\n (i64.store (i32.sub (get_local $sp) (i32.const 8)) (get_local $d))\n ;; a\n (i64.store (get_local $sp) \n (i64.add ;; add a \n (get_local $a)\n (i64.add\n (i64.load (get_local $sp)) ;; load the operand\n (i64.or ;; carry \n (i64.extend_u/i32 (i64.lt_u (get_local $d) (get_local $c))) \n (get_local $carry)))))\n)\n",

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const depMap = new Map([
3434
['CALLVALUE', ['bswap_m128']],
3535
['EXTCODECOPY', ['bswap_m256', 'callback', 'memusegas', 'check_overflow', 'memset']],
3636
['EXTCODESIZE', ['callback_32', 'bswap_m256']],
37+
['RETURNDATACOPY', ['memusegas', 'check_overflow', 'memset']],
3738
['LOG', ['memusegas', 'check_overflow']],
3839
['BLOCKHASH', ['check_overflow', 'callback_256']],
3940
['SHA3', ['memusegas', 'bswap_m256', 'check_overflow', 'keccak']],
@@ -43,6 +44,7 @@ const depMap = new Map([
4344
['CALLCODE', ['bswap_m256', 'callback', 'memusegas', 'check_overflow_i64', 'check_overflow', 'check_overflow_i64', 'memset', 'callback_32']],
4445
['CREATE', ['bswap_m256', 'bswap_m160', 'callback_160', 'memusegas', 'check_overflow']],
4546
['RETURN', ['memusegas', 'check_overflow']],
47+
['REVERT', ['memusegas', 'check_overflow']],
4648
['BALANCE', ['bswap_m256', 'callback_128']],
4749
['SELFDESTRUCT', ['bswap_m256']],
4850
['SSTORE', ['bswap_m256', 'callback']],
@@ -299,6 +301,7 @@ exports.evm2wast = function (evmCode, opts = {
299301
break
300302
case 'SELFDESTRUCT':
301303
case 'RETURN':
304+
case 'REVERT':
302305
segment += `(call $${op.name}) (br $done)\n`
303306
if (jumpFound) {
304307
pc = findNextJumpDest(evmCode, pc)

0 commit comments

Comments
 (0)