diff options
-rw-r--r-- | docs/control-structures.rst | 18 | ||||
-rw-r--r-- | docs/miscellaneous.rst | 5 | ||||
-rw-r--r-- | liblll/CompilerState.cpp | 10 |
3 files changed, 16 insertions, 17 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index db24d5c3..6cbbcdf8 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -322,14 +322,16 @@ In the following example, we show how ``throw`` can be used to easily revert an } } -Currently, there are six situations, where exceptions happen automatically in Solidity: - -1. If you access an array beyond its length (i.e. ``x[i]`` where ``i >= x.length``). -2. If a function called via a message call does not finish properly (i.e. it runs out of gas or throws an exception itself). -3. If a non-existent function on a library is called or Ether is sent to a library. -4. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``). -5. If you perform an external function call targeting a contract that contains no code. -6. If a contract-creation call using the ``new`` keyword fails. +Currently, there are situations, where exceptions happen automatically in Solidity: + +1. If you access an array at a too large or negative index (i.e. ``x[i]`` where ``i >= x.length`` or ``i < 0``). +2. If you access a fixed-length ``bytesN`` at a too large or negative index. +3. If you call a function via a message call but it does not finish properly (i.e. it runs out of gas, has no matching function, or throws an exception itself), except when a low level operation ``call``, ``send``, ``delegatecall`` or ``callcode`` is used. The low level operations never throw exceptions but indicate failures by returning ``false``. +4. If you create a contract using the ``new`` keyword but the contract creation does not finish properly (see above for the definition of "not finish properly"). +5. If you divide or modulo by zero (e.g. ``5 / 0`` or ``23 % 0``). +6. If you perform an external function call targeting a contract that contains no code. +7. If your contract receives Ether via a public function without ``payable`` modifier (including the constructor and the fallback function). +8. If your contract receives Ether via a public accessor function. Internally, Solidity performs an "invalid jump" when an exception is thrown and thus 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/docs/miscellaneous.rst b/docs/miscellaneous.rst index c4a954ad..d32186ca 100644 --- a/docs/miscellaneous.rst +++ b/docs/miscellaneous.rst @@ -347,3 +347,8 @@ These keywords are reserved in Solidity. They might become part of the syntax in ``abstract``, ``after``, ``case``, ``catch``, ``final``, ``in``, ``inline``, ``interface``, ``let``, ``match``, ``of``, ``pure``, ``relocatable``, ``static``, ``switch``, ``try``, ``type``, ``typeof``, ``view``. + +Language Grammar +================ + +The entire language grammar is `available here <https://github.com/ethereum/solidity/blob/release/libsolidity/grammar.txt>`_. diff --git a/liblll/CompilerState.cpp b/liblll/CompilerState.cpp index 63351bc4..1d83192c 100644 --- a/liblll/CompilerState.cpp +++ b/liblll/CompilerState.cpp @@ -45,8 +45,6 @@ CodeFragment const& CompilerState::getDef(std::string const& _s) void CompilerState::populateStandard() { static const string s = "{" - "(def 'gav 0x51ba59315b3a95761d0863b05ccc7a7f54703d99)" - "(def 'config 0x661005d2720d855f1d9976f88bb10c1a3398c77f)" "(def 'allgas (- (gas) 21))" "(def 'send (to value) (call allgas to value 0 0 0 0))" "(def 'send (gaslimit to value) (call gaslimit to value 0 0 0 0))" @@ -60,18 +58,12 @@ void CompilerState::populateStandard() "(def 'sha3 (val) { [0]:val (sha3 0 32) })" "(def 'sha3pair (a b) { [0]:a [32]:b (sha3 0 64) })" "(def 'sha3trip (a b c) { [0]:a [32]:b [64]:c (sha3 0 96) })" + "(def 'keccak256 (loc len) (sha3 loc len))" "(def 'return (val) { [0]:val (return 0 32) })" "(def 'returnlll (code) (return 0 (lll code 0)) )" "(def 'makeperm (name pos) { (def name (sload pos)) (def name (v) (sstore pos v)) } )" "(def 'permcount 0)" "(def 'perm (name) { (makeperm name permcount) (def 'permcount (+ permcount 1)) } )" - "(def 'namereg (msg config 0))" - "(def 'coinreg (msg config 1))" - "(def 'gavcoin (msg config 2))" - "(def 'sendgavcoin (to value) { [32]'send [64]:to [96]:value (call allgas gavcoin 0 32 96 0 0) })" - "(def 'regname (name) { [32]'register [64]name (call allgas namereg 0 32 64 0 0) })" - "(def 'regcoin (name) { [32]name (call allgas coinreg 0 32 32 0 0) })" - "(def 'regcoin (name denom) { [32]name [64]denom (call allgas coinreg 0 32 64 0 0) })" "(def 'ecrecover (r s v hash) { [0] r [32] s [64] v [96] hash (msg allgas 1 0 0 128) })" "(def 'sha256 (data datasize) (msg allgas 2 0 data datasize))" "(def 'ripemd160 (data datasize) (msg allgas 3 0 data datasize))" |