Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
Before Cancun, SELFDESTRUCT both removed the contract's code and forwarded its balance. After EIP-6780, the code-removal behavior only triggers if SELFDESTRUCT is called in the same transaction as the contract's creation — making it nearly useless for runtime cleanup but preserving the metamorphic-contract attack vector for security review. This is one of the most consequential semantics changes in recent EVM history.
Two scenarios — one where SELFDESTRUCT removes code, one where it doesn't.
eth_getCode still returns the bytecode.eth_getCode returns 0x.// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract SelfDestructible {
function destroy(address payable to) external {
selfdestruct(to);
}
}
// Scenario A: deployed in tx1, destroyed in tx2 — POST-CANCUN behavior:
// - Balance is still forwarded to `to