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

Type2 accounts' codehash should be computed with Poseidon #779

Closed
Nashtare opened this issue Nov 6, 2024 · 3 comments · Fixed by #782
Closed

Type2 accounts' codehash should be computed with Poseidon #779

Nashtare opened this issue Nov 6, 2024 · 3 comments · Fixed by #782
Assignees
Labels
crate: trace_decoder Anything related to the trace_decoder crate.

Comments

@Nashtare
Copy link
Collaborator

Nashtare commented Nov 6, 2024

Accounts stored in Type2 state SMT should have their codehash computed via Poseidon hash instead of Keccak (ref impl).
The method currently available for this is fn hash_bytecode_u256(code: Vec<u8>) -> U256 (though its signature is a bit odd, would be better to change to H256).

@0xaatif would you mind handling this on the decoder side while the cryptos continue fixing the few bits in evm_arithmetization that need work?

@Nashtare
Copy link
Collaborator Author

Nashtare commented Nov 6, 2024

Note that we should not add a new codehash leaf to the SMT when the associated account's code is empty (unlike what is currently done in evm_arithmetization related branch). Will open an associated ticket for fixing there as it involves rust + asm changes.

@Nashtare Nashtare added the crate: trace_decoder Anything related to the trace_decoder crate. label Nov 6, 2024
@0xaatif
Copy link
Contributor

0xaatif commented Nov 6, 2024

Does this mean changes to Hash2Code?

@Nashtare
Copy link
Collaborator Author

Nashtare commented Nov 6, 2024

No actual type change, though the keys would not be computed from Keccak in the case of type2 but poseidon. This refers to changing how code hashes are computed in implementations of the World trait, along with some hashing callsites in core.rs.

I can try tackling tomorrow if you'd prefer.

@Nashtare Nashtare self-assigned this Nov 6, 2024
@Nashtare Nashtare linked a pull request Nov 6, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from Backlog to Done in Zero EVM Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: trace_decoder Anything related to the trace_decoder crate.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants