Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add section about EXTCODEHASH in differences from L1 #283

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ Contract bytecode cannot be accessed on zkEVM architecture. Only its size is acc

`EXTCODECOPY` always produces a compile-time error with the zkEVM compiler.

## `EXTCODEHASH`

Retrieving the code hash of a smart contract in the zkEVM protocol differs slightly from EVM. In EVM hash of non-existing account
is always `0`, and hash of existing account without code is `keccak("")`. Nonexisting contracts have no code, and their nonce and
balance are both zero.

In zkEVM `EXTCODEHASH` operation has the following differences:

- It doesn't check the balance of account.
- All contracts in precompiles space (plus `0x00`) are treated as existing empty accounts.
- For zkEVM contracts with bytecode it returns a versioned code hash based on sha3, rather than the keccak256 of the bytecode specified in EIP-1052.

## `DATASIZE`, `DATAOFFSET`, `DATACOPY`

Contract deployment is handled by two parts of the zkEVM protocol: the compiler front end and the system contract called `ContractDeployer`.
Expand Down
Loading