-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: create2 opcode should use deterministically derived evm contr…
…act address (#443) <!--- Please provide a general summary of your changes in the title above --> <!-- Give an estimate of the time you spent on this PR in terms of work days. Did you spend 0.5 days on this PR or rather 2 days? --> Time spent on this PR: 1.75 days ## Pull request type <!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. --> Please check the type of change your PR introduces: - [X] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [ ] Refactoring (no functional changes, no api changes) - [ ] Build related changes - [ ] Documentation content changes - [ ] Other (please describe): ## What is the current behavior? The EVM address of a contract account is computed as follows: ``` // Generate EVM_contract address from the new cairo contract // TODO: Use RLP to compute proper EVM address, see https://www.evm.codes/#f0 let (_, low) = split_felt(starknet_contract_address); local evm_contract_address = 0xAbdE100700000000000000000000000000000000 + low; ``` <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> Resolves #427 also resolves #426 wrt create2 opcode ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> Create2's address is defined via ``` address = keccak256(0xff + sender_address + salt + keccak256(initialisation_code))[12:] ``` - - - ## Other information There is a current temporary split in deploy code, where create2 logic is handled separately from create. When both construct their address deterministically, the temporary refactor will be removed. <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Co-authored-by: Clément Walter <[email protected]> Co-authored-by: kakarot CI <[email protected]>
- Loading branch information
1 parent
90e0071
commit 5a07753
Showing
14 changed files
with
358 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.