-
Notifications
You must be signed in to change notification settings - Fork 106
CURRENT_MAX_PRECOMPILE_ADDRESS
does not include keccak256
precompile
#6
Comments
Hey @pcaversaccio, thanks for looking into the code! We want to distinguish all the EVM precompiles (ecrecover/sha256/RIPEMD-160/...) and zkSync-specific ones (only keccak256 at the moment). The idea behind this is that EVM precompiles are guaranteed to have zero code size and the zkSync specific does not really need to hold this invariant. |
Reference of place where constant is used: |
Are you sure this is enforced in the clients? Check for instance So if I understand it correctly, in theory, there is the possibility to deploy a contract to |
The contract deployer is a contract that is responsible for all create/create2 calls. Here is the place which prevents users from deploying on the system contracts zone (still a very unlikely event). |
Oh I see, that makes sense. But the remaining question is whether this behavior is enforced by the clients on Ethereum. See above my links to the Geth implementations. |
The deploying to the address(0x01) is basically a hash collision. If it will be the case, we will have a bigger problem. From what I see on the Geth, there is no check on not deploying to the precompile address. But it is fine.
|
Fully agree, I just wanted to challenge your statement: "The idea behind this is that EVM precompiles are guaranteed to have zero code size" For the sake of documentation (for anyone reading this issue), the second bullet point refers to this: A non-existent account in EIP-1052 refers to an address that does not adhere to EIP-55 correct? |
Agree, it is a probabilistic statement. However, I would still stick to the current invariant enforcement. |
Yes, fully agreed. So even the black swan event couldn't happen :)
Actually, I was confused - I wanted to refer to EIP-161. So is my understanding of the following correct on zkSync:
But what's your understanding of a non-existent account on zkSync? As stated in EIP-158 "Whenever the EVM checks if an account exists, emptiness is treated as equivalent to nonexistence"; so I don't see any difference anymore. Or in other words, using the following condition: extcodehash(precompile_address) == 0 || extcodehash(precompile_address) == keccak256("") When is the first condition true? |
@vladbochok a quick reminder about my question above |
Evm |
AGREE |
I'm referring to the
Constants
:I might be confused, but shouldn't this be 3 contracts? The
keccak256
precompile is deployed at the address0x0000000000000000000000000000000000008010
if am not wrong.The text was updated successfully, but these errors were encountered: