From 2a808e4f328ebebc05ab40f5430344e329db650a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sun, 15 Dec 2019 13:26:43 +0000 Subject: [PATCH] Add trace for unreachable in Yul Ewasm translation tests --- test/libyul/ewasmTranslationTests/balance.yul | 1 + test/libyul/ewasmTranslationTests/blockhash.yul | 1 + test/libyul/ewasmTranslationTests/chainid.yul | 1 + test/libyul/ewasmTranslationTests/coinbase.yul | 1 + test/libyul/ewasmTranslationTests/extcodecopy.yul | 1 + test/libyul/ewasmTranslationTests/extcodehash.yul | 1 + test/libyul/ewasmTranslationTests/extcodesize.yul | 1 + test/libyul/ewasmTranslationTests/invalid.yul | 1 + test/libyul/ewasmTranslationTests/keccak256.yul | 1 + test/libyul/ewasmTranslationTests/log0.yul | 1 + test/libyul/ewasmTranslationTests/log1.yul | 1 + test/libyul/ewasmTranslationTests/log2.yul | 1 + test/libyul/ewasmTranslationTests/log3.yul | 1 + test/libyul/ewasmTranslationTests/log4.yul | 1 + test/libyul/ewasmTranslationTests/msize.yul | 1 + test/libyul/ewasmTranslationTests/mstore8.yul | 1 + test/libyul/ewasmTranslationTests/pc.yul | 1 + test/libyul/ewasmTranslationTests/selfbalance.yul | 1 + test/libyul/ewasmTranslationTests/smoke_call.yul | 1 + test/libyul/ewasmTranslationTests/smoke_callcode.yul | 1 + test/libyul/ewasmTranslationTests/smoke_create.yul | 1 + test/libyul/ewasmTranslationTests/smoke_create2.yul | 1 + test/libyul/ewasmTranslationTests/smoke_delegatecall.yul | 1 + test/libyul/ewasmTranslationTests/smoke_staticcall.yul | 1 + test/tools/yulInterpreter/EWasmBuiltinInterpreter.cpp | 3 +++ 25 files changed, 27 insertions(+) diff --git a/test/libyul/ewasmTranslationTests/balance.yul b/test/libyul/ewasmTranslationTests/balance.yul index d9b4a8f54..ed4aad891 100644 --- a/test/libyul/ewasmTranslationTests/balance.yul +++ b/test/libyul/ewasmTranslationTests/balance.yul @@ -4,6 +4,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/blockhash.yul b/test/libyul/ewasmTranslationTests/blockhash.yul index 4eb9b2954..35d431c60 100644 --- a/test/libyul/ewasmTranslationTests/blockhash.yul +++ b/test/libyul/ewasmTranslationTests/blockhash.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/chainid.yul b/test/libyul/ewasmTranslationTests/chainid.yul index 8f1388e80..73a82f442 100644 --- a/test/libyul/ewasmTranslationTests/chainid.yul +++ b/test/libyul/ewasmTranslationTests/chainid.yul @@ -5,5 +5,6 @@ // EVMVersion: >=istanbul // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/coinbase.yul b/test/libyul/ewasmTranslationTests/coinbase.yul index b63bd7bef..023ee3140 100644 --- a/test/libyul/ewasmTranslationTests/coinbase.yul +++ b/test/libyul/ewasmTranslationTests/coinbase.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/extcodecopy.yul b/test/libyul/ewasmTranslationTests/extcodecopy.yul index dde32334c..1c78b5e55 100644 --- a/test/libyul/ewasmTranslationTests/extcodecopy.yul +++ b/test/libyul/ewasmTranslationTests/extcodecopy.yul @@ -4,6 +4,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/extcodehash.yul b/test/libyul/ewasmTranslationTests/extcodehash.yul index cfc2a2a74..1ee4b0e39 100644 --- a/test/libyul/ewasmTranslationTests/extcodehash.yul +++ b/test/libyul/ewasmTranslationTests/extcodehash.yul @@ -5,6 +5,7 @@ // EVMVersion: >=constantinople // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/extcodesize.yul b/test/libyul/ewasmTranslationTests/extcodesize.yul index 9c94d5990..7fa810d06 100644 --- a/test/libyul/ewasmTranslationTests/extcodesize.yul +++ b/test/libyul/ewasmTranslationTests/extcodesize.yul @@ -3,6 +3,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/invalid.yul b/test/libyul/ewasmTranslationTests/invalid.yul index 229a609cd..c9844978a 100644 --- a/test/libyul/ewasmTranslationTests/invalid.yul +++ b/test/libyul/ewasmTranslationTests/invalid.yul @@ -7,6 +7,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 20: 0000000000000000000000000000000000000000000000000000000000001234 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/keccak256.yul b/test/libyul/ewasmTranslationTests/keccak256.yul index 916b1bfa1..81a650345 100644 --- a/test/libyul/ewasmTranslationTests/keccak256.yul +++ b/test/libyul/ewasmTranslationTests/keccak256.yul @@ -4,5 +4,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log0.yul b/test/libyul/ewasmTranslationTests/log0.yul index e940e899e..cd10eb28b 100644 --- a/test/libyul/ewasmTranslationTests/log0.yul +++ b/test/libyul/ewasmTranslationTests/log0.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log1.yul b/test/libyul/ewasmTranslationTests/log1.yul index 4f3c3a9d4..a985a3f05 100644 --- a/test/libyul/ewasmTranslationTests/log1.yul +++ b/test/libyul/ewasmTranslationTests/log1.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log2.yul b/test/libyul/ewasmTranslationTests/log2.yul index f596bb97a..90c645542 100644 --- a/test/libyul/ewasmTranslationTests/log2.yul +++ b/test/libyul/ewasmTranslationTests/log2.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log3.yul b/test/libyul/ewasmTranslationTests/log3.yul index 54d8dc28d..efff47f08 100644 --- a/test/libyul/ewasmTranslationTests/log3.yul +++ b/test/libyul/ewasmTranslationTests/log3.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log4.yul b/test/libyul/ewasmTranslationTests/log4.yul index 4a696e611..81069baa2 100644 --- a/test/libyul/ewasmTranslationTests/log4.yul +++ b/test/libyul/ewasmTranslationTests/log4.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/msize.yul b/test/libyul/ewasmTranslationTests/msize.yul index 2fd0983f6..b45b2aae0 100644 --- a/test/libyul/ewasmTranslationTests/msize.yul +++ b/test/libyul/ewasmTranslationTests/msize.yul @@ -7,5 +7,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/mstore8.yul b/test/libyul/ewasmTranslationTests/mstore8.yul index 566638c68..12b6a0c0c 100644 --- a/test/libyul/ewasmTranslationTests/mstore8.yul +++ b/test/libyul/ewasmTranslationTests/mstore8.yul @@ -8,6 +8,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 60: 00000000000000000000000000000000ffffffffffffffffffffffffffffffff // 80: ffffffffffffffffffffffffffffffff00000000000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/pc.yul b/test/libyul/ewasmTranslationTests/pc.yul index 4d88bc974..16d98dec8 100644 --- a/test/libyul/ewasmTranslationTests/pc.yul +++ b/test/libyul/ewasmTranslationTests/pc.yul @@ -3,5 +3,6 @@ } // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/selfbalance.yul b/test/libyul/ewasmTranslationTests/selfbalance.yul index ff7e74a89..32037fb5a 100644 --- a/test/libyul/ewasmTranslationTests/selfbalance.yul +++ b/test/libyul/ewasmTranslationTests/selfbalance.yul @@ -5,5 +5,6 @@ // EVMVersion: >=istanbul // ---- // Trace: +// INVALID() // Memory dump: // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_call.yul b/test/libyul/ewasmTranslationTests/smoke_call.yul index 2e33f8615..0efe7b38a 100644 --- a/test/libyul/ewasmTranslationTests/smoke_call.yul +++ b/test/libyul/ewasmTranslationTests/smoke_call.yul @@ -3,6 +3,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_callcode.yul b/test/libyul/ewasmTranslationTests/smoke_callcode.yul index f8b51d8df..c82f1d376 100644 --- a/test/libyul/ewasmTranslationTests/smoke_callcode.yul +++ b/test/libyul/ewasmTranslationTests/smoke_callcode.yul @@ -3,6 +3,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_create.yul b/test/libyul/ewasmTranslationTests/smoke_create.yul index bfc29b2c0..6f038cdc8 100644 --- a/test/libyul/ewasmTranslationTests/smoke_create.yul +++ b/test/libyul/ewasmTranslationTests/smoke_create.yul @@ -5,6 +5,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000000000000000000000000000000000014 // 40: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/smoke_create2.yul b/test/libyul/ewasmTranslationTests/smoke_create2.yul index e305d7885..347574d6b 100644 --- a/test/libyul/ewasmTranslationTests/smoke_create2.yul +++ b/test/libyul/ewasmTranslationTests/smoke_create2.yul @@ -7,6 +7,7 @@ // EVMVersion: >=constantinople // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000000000000000000000000000000000014 // 80: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul b/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul index b79232f7f..c8e5ccb4d 100644 --- a/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul +++ b/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul @@ -3,6 +3,7 @@ } // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_staticcall.yul b/test/libyul/ewasmTranslationTests/smoke_staticcall.yul index 207ef3eeb..50669b9fc 100644 --- a/test/libyul/ewasmTranslationTests/smoke_staticcall.yul +++ b/test/libyul/ewasmTranslationTests/smoke_staticcall.yul @@ -5,6 +5,7 @@ // EVMVersion: >=byzantium // ---- // Trace: +// INVALID() // Memory dump: // 0: 0000000000000000000000000000000011111111000000000000000000000000 // Storage dump: diff --git a/test/tools/yulInterpreter/EWasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EWasmBuiltinInterpreter.cpp index c52ee7e10..fe8d28f70 100644 --- a/test/tools/yulInterpreter/EWasmBuiltinInterpreter.cpp +++ b/test/tools/yulInterpreter/EWasmBuiltinInterpreter.cpp @@ -79,7 +79,10 @@ u256 EWasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector const& _a else if (_fun == "drop"_yulstring) return {}; else if (_fun == "unreachable"_yulstring) + { + logTrace(eth::Instruction::INVALID, {}); throw ExplicitlyTerminated(); + } else if (_fun == "i64.add"_yulstring) return arg[0] + arg[1]; else if (_fun == "i64.sub"_yulstring)