Add CREATE, CLONE and BYTECODE_HASH opcodes. Add bytecode typerep and datatype #211
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "factories"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: radrow
cc @gorbak25 @hanssv
There are 2 main points of this PR:
New opcodes
I am adding 4 new opcodes to the FATE assembly language:
CREATE
,CLONE
,CLONE_G
andBYTECODE_HASH
. The gas prices are to be discussed.CREATE
This dude is supposed to deploy a new contract from given serialized code of the new
fate_code
datatype. It also takes initial call value and type representation ofinit
arguments. The args forinit
will be placed on stack. The return type iscontract
. The result is put on thestack
as this instruction ends with a jump.One of the key things is to make it expensive compared to other instructions in order to prevent "create spam". I was even thinking of increasing the price geometrically of this opcode for a single execution.
CLONE
Similar to
CREATE
but uses code of an existing contract by its address. Should be significantly cheaper though as it would make bytecode reuse easier. Can be protected similarly to a remote call. The result is put on thestack
as this instruction ends with a jump.CLONE_G
Essentially
CLONE
but takes additional parameter that limits gas forinit
execution.BYTECODE_HASH
Will be used in validation. Takes a contract and returns hash of its bytecode. Wraps the result in
Some
or returnsNone
on fail. The result is put on the first argument to the opcode.New data
This PR adds new boxed datatype
contract_bytearray
along with its typerep. It wraps up a binary representing serialized FATE code. It is already used in create TX, just making it a valid value in FATE.Misc
I have changed
BLOCKHASH
to returnvariant
as this is actually true.I have added our version of
rebar3
because the previously used one was doing some strange shit with the opcode generatorCreated by: cytadela8
Review: Approved
approved this merge request
Merged by: radrow at 2021-03-31 07:45:57 UTC