You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Motivation**
The `CREATE` transaction logic did not handle the case where the address
where we the contract will be deploy already exists.
**Description**
- Add a check in `VM::new()` where the transaction is `CREATE`. If
`new_contract_address` exists in the db and it has nonce or bytecode, we
don't create the new account and we don't add it in the cache. We know
this is an error and the revert will be handled in `transact()`
- Something similar in `transact()`, we check if the transaction is
`CREATE` and if `new_address_acc` has code or nonce. In that case we
return a `TransactionReport` with `TxResult::Revert`.
- Support the creation of a contract even if the account has balance.
Related #1517
---------
Co-authored-by: Tomas Fabrizio Orsi <tomas.orsi@lambdaclass.com>
Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
Co-authored-by: JereSalo <jeresalo17@gmail.com>
When sending a transaction of type TxKind::CREATE, the code is not checking if the address exists.
Steps to Reproduce
TransactionCollisionToEmptyButCode.json
testCreateCollision
errorPossible fix
ethrex/crates/vm/levm/src/vm.rs
Lines 203 to 208 in 8ac2835
The text was updated successfully, but these errors were encountered: