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_GandBYTECODE_HASH. The gas prices are to be discussed.CREATEThis dude is supposed to deploy a new contract from given serialized code of the new
fate_codedatatype. It also takes initial call value and type representation ofinitarguments. The args forinitwill be placed on stack. The return type iscontract. The result is put on thestackas 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.
CLONESimilar to
CREATEbut 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 thestackas this instruction ends with a jump.CLONE_GEssentially
CLONEbut takes additional parameter that limits gas forinitexecution.BYTECODE_HASHWill be used in validation. Takes a contract and returns hash of its bytecode. Wraps the result in
Someor returnsNoneon fail. The result is put on the first argument to the opcode.New data
This PR adds new boxed datatype
contract_bytearrayalong 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
BLOCKHASHto returnvariantas this is actually true.I have added our version of
rebar3because 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