aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md3
-rw-r--r--docs/control-structures.rst2
-rw-r--r--test/libsolidity/InlineAssembly.cpp5
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
4 files changed, 24 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index 8dd1b89c..7a9d4818 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,13 +4,14 @@ Features:
* Compiler interface: Contracts and libraries can be referenced with a ``file:`` prefix to make them unique.
* Compiler interface: Report source location for "stack too deep" errors.
* AST: Use deterministic node identifiers.
+ * Inline assembly: introduce ``invalid`` (EIP141) as an opcode.
* Type system: Introduce type identifier strings.
* Type checker: Warn about invalid checksum for addresses and deduce type from valid ones.
* Metadata: Do not include platform in the version number.
* Metadata: Add option to store sources as literal content.
* Code generator: Extract array utils into low-level functions.
* Code generator: Internal errors (array out of bounds, etc.) now cause a reversion by using an invalid
- instruction (0xfe) instead of an invalid jump. Invalid jump is still kept for explicit throws.
+ instruction (0xfe - EIP141) instead of an invalid jump. Invalid jump is still kept for explicit throws.
Bugfixes:
* Code generator: Allow recursive structs.
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index ff9b245a..c83d654e 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -632,6 +632,8 @@ The opcodes ``pushi`` and ``jumpdest`` cannot be used directly.
+-------------------------+------+-----------------------------------------------------------------+
| selfdestruct(a) | `-` | end execution, destroy current contract and send funds to a |
+-------------------------+------+-----------------------------------------------------------------+
+| invalid | `-` | end execution with invalid instruction |
++-------------------------+------+-----------------------------------------------------------------+
| log0(p, s) | `-` | log without topics and data mem[p..(p+s)) |
+-------------------------+------+-----------------------------------------------------------------+
| log1(p, s, t1) | `-` | log with topic t1 and data mem[p..(p+s)) |
diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp
index c051a982..cf0343a9 100644
--- a/test/libsolidity/InlineAssembly.cpp
+++ b/test/libsolidity/InlineAssembly.cpp
@@ -182,6 +182,11 @@ BOOST_AUTO_TEST_CASE(error_tag)
BOOST_CHECK(successAssemble("{ invalidJumpLabel }"));
}
+BOOST_AUTO_TEST_CASE(designated_invalid_instruction)
+{
+ BOOST_CHECK(successAssemble("{ invalid }"));
+}
+
BOOST_AUTO_TEST_CASE(inline_assembly_shadowed_instruction_declaration)
{
// Error message: "Cannot use instruction names for identifier names."
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 646017fb..4075a016 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -9043,6 +9043,21 @@ BOOST_AUTO_TEST_CASE(recursive_structs)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(1)));
}
+BOOST_AUTO_TEST_CASE(invalid_instruction)
+{
+ char const* sourceCode = R"(
+ contract C {
+ function f() {
+ assembly {
+ invalid
+ }
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs());
+}
+
BOOST_AUTO_TEST_SUITE_END()
}