Motivation

This specification aims at enforcing the following properties:

  • For all future feature upgrades, the behavior of code and corresponding storage will never change.
  • Code is executed in an environment with fixed input.
  • Other contract’s account state or precompiles can change.

Specification

Input

The code environment knows about:

  • Basic transaction information, excluding the gas provided. This includes the calling address, origin, caller, value, data, current code and gas price.
  • Basic block information. This includes coinbase, timestamp, number, difficulty and gas limit.

This means that all operations that requires fetching other information should not use opcodes other than CALL. We disable BALANCE, EXTCODESIZE, EXTCODECOPY and BLOCKHASH opcodes.

Balance Precompile

Create a precompile for fetching other account’s balance information. The precompile takes 160-bit of input, and returns 256-bit value of the balance of the account. If the input is invalid, return empty array.

Code Precompile

Create a precompile for fetching other account’s code information. The precompile takes 288-bit of input, where the first 160-bit is interpreted as address, the next 64-bit is the start location, and the final 64-bit is the length. It returns the code specified in the range, or empty if the input is invalid.

Block Hashes Precompile

Adopt EIP-210 for fetching block hashes precompile.