Submitted by anon, also found by quarkslab, rvierdiiev, 0xstochasticparrot, and erebus
The divergences in the emulation of the extcodehash EVM opcode within zkSync Era carry several potential impacts, specially on Developers relying on zkSync Eras assurance that it emulates the extcodehash opcode as per EIP-1052 might encounter unexpected behavior in their smart contracts.
The getCodeHash function within the zkSync Era is designed to emulate the functionality of the extcodehash Ethereum Virtual Machine (EVM) opcode, as laid out in the Ethereum Improvement Proposal 1052 (EIP-1052). 
https://github.com/code-423n4/2023-10-zksync/blob/main/code/system-contracts/contracts/AccountCodeStorage.sol#L89
However, its important to recognize that this function does not exhibit precisely identical behavior to the EVMs extcodehash opcode. There are specific discrepancies:
The issue is that, zkSync Era returns bytes32(0) regardless of the balance of the account. It only cares about the nonce and the code.
In contrast, the zkSync Era consistently returns keccak256("") for precompile contracts, regardless of their balances. The zkSync Eras behavior is based solely on whether the address is lower/equal to CURRENT_MAX_PRECOMPILE_ADDRESS.
These observed inconsistencies could potentially raise concerns for developers who rely on zkSync Eras assertion that it accurately simulates the extcodehash EVM opcode as dictated by the EIP-1051 specification.
The following code is recommended to simulate the extcodehash EVM opcode precisely based on EIP-1052.
https://github.com/code-423n4/2023-10-zksync/blob/main/code/system-contracts/contracts/AccountCodeStorage.sol#L89
Context
miladpiri (zkSync) confirmed, but disagreed with severity and commented:
Alex the Entreprenerd (judge) commented:
Alex the Entreprenerd (judge) commented:
