This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ERC20 error due to newly deployed SELFDESTRUCT contracts (#805)
Time spent on this PR: 0.2 ## Pull request type 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? When a newly deployed contract calls SELFDESTRUCT, it's never deployed on Starknet and consequently Kakarot is not allowed to `transferFrom` its contract. The Cairo VM hence raises in `state.commit`. ## What is the new behavior? In `State.commit`, when executing transfer to a newly deployed selfdestructed contract, uses the Kakarot contract instead as temporary ETH holders. Note: I have eventually realized that separating the balance from the rest of the Account "to save on loading bytecode just to send ETH" is indeed a nonsense because there is only two ways to send ETH without requiring the bytecode: - the initial `value` of a tx, hence the sender is an EOA and loading its bytecode is just loading empty code so cheap - the recipient of SELFDESTRUCT Consequently, I think that the balance would be better re-integrated into the Account, but I don't know if the refacto is worth it per se. Maybe if we remove completely the ERC20, then we can do it in the meantime.
- Loading branch information