Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Deployable bytecode attempts to access calldata #1399
I'm trying to understand vyper constructor usage patterns. When compiling the example Vyper erc20 contract, the output (deployed) bytecode looks like this:
The second opcode
In Solidity, a comparable example would not include
Let me know if I'm misunderstanding!
Hi @jacqueswww - this is precisely why I'm asking. According to the yellow paper, contract creation transactions come with empty calldata:
In section "Contract Creation", the specific environment set-up is listed here (note that
The Solidity convention is to embed constructor arguments as part of the original bytecode that gets passed during contract creation (
Has Vyper adopted a different convention where the contract call assumes constructor arguments are passed during the contract creation phase?
@Pet3ris I don't think we use anything different, also you can check our tests also show we use standard web3 to deploy and test init.
given example program:
val: public(uint256) @public def __init__(a: uint256): self.val = a
Check the IR output (-if ir):
Seems to be in order ? ( I realise I answered incorrectly about calldata copying at first, sorry!).
@Pet3ris No problem! Great catch! So I just did a fix:
Looks much better :) (calldata load for the function), nothing for the init.