aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-01-30 21:18:16 +0800
committerGitHub <noreply@github.com>2017-01-30 21:18:16 +0800
commitedd3696dc1efa87bd0f62e02637874e1a0f43dad (patch)
tree5ce364bcff797079e9d27a265066ce11e3978f65
parentb2c35fb41a65dc996189b890f292103d9318b53e (diff)
parenteb530aa217387092a84057b550c7665a4acf72b6 (diff)
downloaddexon-solidity-edd3696dc1efa87bd0f62e02637874e1a0f43dad.tar.gz
dexon-solidity-edd3696dc1efa87bd0f62e02637874e1a0f43dad.tar.zst
dexon-solidity-edd3696dc1efa87bd0f62e02637874e1a0f43dad.zip
Merge pull request #1619 from ethereum/changelog
Mention in changelog that invalid as an opcode is valid inline assembly
-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()
}