diff options
author | chriseth <chris@ethereum.org> | 2018-04-06 22:11:52 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-04-12 19:09:38 +0800 |
commit | b25598126e57fca73058edd722eef7c681460557 (patch) | |
tree | b0ef53c8a27ee69d0ca564642e3bb44ac65eaac6 | |
parent | 4faa839813ce76fc87f99b002aad6cadd2b784e1 (diff) | |
download | dexon-solidity-b25598126e57fca73058edd722eef7c681460557.tar.gz dexon-solidity-b25598126e57fca73058edd722eef7c681460557.tar.zst dexon-solidity-b25598126e57fca73058edd722eef7c681460557.zip |
Update documentation and minor changes.
-rw-r--r-- | docs/control-structures.rst | 18 | ||||
-rw-r--r-- | test/libsolidity/Assembly.cpp | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/docs/control-structures.rst b/docs/control-structures.rst index 7e3027a0..7024a684 100644 --- a/docs/control-structures.rst +++ b/docs/control-structures.rst @@ -473,7 +473,7 @@ Catching exceptions is not yet possible. In the following example, you can see how ``require`` can be used to easily check conditions on inputs and how ``assert`` can be used for internal error checking. Note that you can optionally provide -a message string for require, but not for assert. +a message string for ``require``, but not for ``assert``. :: @@ -539,9 +539,13 @@ The following example shows how an error string can be used together with revert } } -The provided string will be abi-encoded together with a uint value that will always be zero. -This means that if a string ``x`` is provided, ``(0, x)`` will be encoded as if a function with arguments -``(uint256, string)`` was called. This zero is used as a version identifier. Future extensions -of this feature might provide actual exception payload of dynamic type and this number could be used -to encode the type or also as a simple numeric error code. Until this is specified, a zero will -be used in all cases.
\ No newline at end of file +The provided string will be :ref:`abi-encoded <ABI>` as if it were a call to a function ``Error(string)``. +In the above example, ``revert("Not enough Ether provided.");`` will cause the following hexadecimal data be +set as error return data: + +.. code:: + + 0x08c379a0 // Function selector for Error(string) + 0x0000000000000000000000000000000000000000000000000000000000000020 // Data offset + 0x000000000000000000000000000000000000000000000000000000000000001a // String length + 0x4e6f7420656e6f7567682045746865722070726f76696465642e000000000000 // String data diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index 59993f66..bdb7a107 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -158,7 +158,6 @@ BOOST_AUTO_TEST_CASE(location_test) } )"; shared_ptr<string const> n = make_shared<string>(""); - shared_ptr<string const> codegen = make_shared<string>("--CODEGEN--:8-17"); AssemblyItems items = compileContract(sourceCode); vector<SourceLocation> locations = vector<SourceLocation>(24, SourceLocation(2, 75, make_shared<string>(""))) + |