The role of SELFDESTRUCT
in addressing the aforementioned questions is extremely important, and we must also mention the ongoing discussion about SELFDESTRUCT
in the Ethereum community. For the EVM, SELFDESTRUCT
is a "very special" operation because it is initiated from the contract's code by the opcode in the EVM. The subsequent operations are executed outside the EVM context in the state database because, after SELFDESTRUCT
, the node must destroy the code and the account state and erase its storage and all related fields. So, in addition to the issues related to creation/destruction, there are also concerns about the overall performance of the blockchain.
primary purpose, which is to clean up space in the state database, is not practical in real-world scenarios. Protocols do not include SELFDESTRUCT
in their code because users are unwilling to put their money in a contract that can be destroyed. Furthermore, SELFDESTRUCT
renders any contract analyzing scripts inconsistent because when you download the contract bytecode from an address at a particular block in the past, you cannot be certain that this code will remain at the same address later.
Vitalik has provided
a compelling case for removing the SELFDESTRUCT
instruction from EVM. We agree that this action will greatly improve smart-contract security and not significantly affect blockchain behavior. The problems solved by SELFDESTRUCT
can be mitigated with other mechanics, such as purging and compactifying inactive accounts, separation of data/consensus layers, and other mechanics. So, we're waiting for SELFDESTRUCT
to self-destruct :)