Whenever I deploy a contract on Sepolia, there is an additional gas cost I haven't quite figured out. The flow as I understand is:

  1. 21,000 gas (base)
  2. 32,000 gas (contract creation)
  3. 4*(zero-value bytes calldata) gas
  4. 16*(non-zero value bytes calldata) gas
  5. x
  6. Code execution (provided in calldata)
  7. Return (deployed) code
  8. 200*(length in bytes of deployed contract code) gas

However before the code provided in calldata is run (confirmed by VM trace), there is an additional cost 5., that is:

length (in words) of calldata * 2 gas

This cost only applies in transactions where the recipient is address(0), and is agnostic to the value of the bytes. This cost isn't related to memory expansion (as that would be in multiples of 3*word_size up to 724 bytes), nor is it a hashing operation.

I can't find in any docs incl. yellow/beige what this cost is. Apart from CREATE, is there any other opcode run before code (originally provided by calldata) is executed?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.