rust-ethereum / evm

Pure Rust implementation of Ethereum Virtual Machine
Apache License 2.0
1.16k stars 355 forks source link

Cancun self destruct changes (EIP 6780) #281

Open ahmadkaouk opened 4 months ago

ahmadkaouk commented 4 months ago

This PR implements the new changes for the selfdestruct function as outlined in EIP-6780.

The new EIP allows for contract deletion only within the same transaction that created it. Otherwise, the selfdestruct function will simply transfer all Ether in the contract account to the target address.

Another change introduced by this EIP is that when selfdestruct is not called in the same transaction that created the contract, if the target address is the same as the contract address, there is no net change in balances. Unlike the previous specification, Ether will not be burned in this case.