Merge pull request #5114 from ethereum/assembly-docs

Improve the create2 description in assembly.rst (and include in yul.rst)
This commit is contained in:
chriseth 2018-10-01 13:08:10 +02:00 committed by GitHub
commit ba68966ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -277,8 +277,10 @@ In the grammar, opcodes are represented as pre-defined identifiers.
| | | | and return the new address |
+-------------------------+-----+---+-----------------------------------------------------------------+
| create2(v, n, p, s) | | C | create new contract with code mem[p...(p+s)) at address |
| | | | keccak256(0xff . <address> . n . keccak256(mem[p...(p+s))) |
| | | | and send v wei and return the new address |
| | | | keccak256(0xff . self . n . keccak256(mem[p...(p+s))) |
| | | | and send v wei and return the new address, where ``0xff`` is a |
| | | | 8 byte value, ``self`` is the current contract's address |
| | | | as a 20 byte value and ``n`` is a big-endian 256-bit value |
+-------------------------+-----+---+-----------------------------------------------------------------+
| call(g, a, v, in, | | F | call contract at address a with input mem[in...(in+insize)) |
| insize, out, outsize) | | | providing g gas and v wei and output area |

View File

@ -417,6 +417,12 @@ The following functions must be available:
| create(v:u256, p:u256, s:u256) | create new contract with code mem[p..(p+s)) and send v wei |
| | and return the new address |
+---------------------------------------------+-----------------------------------------------------------------+
| create2(v:u256, n:u256, p:u256, s:u256) | create new contract with code mem[p...(p+s)) at address |
| | keccak256(0xff . self . n . keccak256(mem[p...(p+s))) |
| | and send v wei and return the new address, where ``0xff`` is a |
| | 8 byte value, ``self`` is the current contract's address |
| | as a 20 byte value and ``n`` is a big-endian 256-bit value |
+---------------------------------------------+-----------------------------------------------------------------+
| call(g:u256, a:u256, v:u256, in:u256, | call contract at address a with input mem[in..(in+insize)) |
| insize:u256, out:u256, | providing g gas and v wei and output area |
| outsize:u256) | mem[out..(out+outsize)) returning 0 on error (eg. out of gas) |
@ -492,6 +498,8 @@ The following functions must be available:
+---------------------------------------------+-----------------------------------------------------------------+
| extcodecopy(a:u256, t:u256, f:u256, s:u256) | like codecopy(t, f, s) but take code at address a |
+---------------------------------------------+-----------------------------------------------------------------+
| extcodehash(a:u256) | code hash of address a |
+---------------------------------------------+-----------------------------------------------------------------+
| *Others* |
+---------------------------------------------+-----------------------------------------------------------------+
| discard(unused:bool) | discard value |