aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-27 17:18:53 +0800
committerchriseth <c@ethdev.com>2017-01-27 17:18:53 +0800
commitbff8fc23e6cc602511b52aaa665e63b948eba068 (patch)
tree79856f29934753d281d2e54bf983a6df66585266
parent7660736aa269c69a69ef728924f566d72661638a (diff)
downloaddexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar.gz
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar.bz2
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar.lz
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar.xz
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.tar.zst
dexon-solidity-bff8fc23e6cc602511b52aaa665e63b948eba068.zip
Changelog and review suggestions.
-rw-r--r--Changelog.md2
-rw-r--r--docs/control-structures.rst2
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp2
3 files changed, 4 insertions, 2 deletions
diff --git a/Changelog.md b/Changelog.md
index 71a1e096..c87d1647 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,6 +9,8 @@ Features:
* 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.
Bugfixes:
* Code generator: Allow recursive structs.
diff --git a/docs/control-structures.rst b/docs/control-structures.rst
index d7005717..ff9b245a 100644
--- a/docs/control-structures.rst
+++ b/docs/control-structures.rst
@@ -397,7 +397,7 @@ Currently, Solidity automatically generates a runtime exception in the following
#. If you call a zero-initialized variable of internal function type.
Internally, Solidity performs an "invalid jump" when a user-provided exception is thrown. In contrast, it performs an invalid operation
-(code ``0xfe``) if a runtime exception is encountered. In both cases, this causes
+(instruction ``0xfe``) if a runtime exception is encountered. In both cases, this causes
the EVM to revert all changes made to the state. The reason for this is that there is no safe way to continue execution, because an expected effect
did not occur. Because we want to retain the atomicity of transactions, the safest thing to do is to revert all changes and make the whole transaction
(or at least call) without effect.
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index 3ca2f375..4d33927d 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -919,7 +919,7 @@ eth::AssemblyPointer ContractCompiler::cloneRuntime()
//Propagate error condition (if DELEGATECALL pushes 0 on stack).
a << Instruction::ISZERO;
a << Instruction::ISZERO;
- eth::AssemblyItem afterTag = a.appendJumpI();
+ eth::AssemblyItem afterTag = a.appendJumpI().tag();
a << Instruction::INVALID << afterTag;
//@todo adjust for larger return values, make this dynamic.
a << u256(0x20) << u256(0) << Instruction::RETURN;