SELFDESTRUCT
- Dev Update #3This is the third update for my CDAP Project, which is about analyzing the existing uses of the SELFDESTRUCT
opcode in Ethereum.
Based on my analysis of the usage of SELFDESTRUCT
, which revealed that neutering SELFDESTRUCT
could damage certain DeFi users, I am leaning towards trying to preserve the functionality of SELFDESTRUCT
when switching the Ethereum State to Verkle Tries. To that end, I have modified the current Verkle tree proposal to support SELFDESTRUCT
. My version is hosted here.
My version attempts to be the simplest possible modification that supports SELFDESTRUCT
. The gas usage by contracts that are only deployed once should be almost unchanged, except that an additional slot incarnation_number
in the contract header needs to be accessed. Gas usage by contracts that have reincarnated at least once is a bit higher, since each contract call needs to access at least two branches.
In addition to implementing support for SELFDESTRUCT
, I also simplified the original specification somewhat by performing the splitting of the least significant byte of each sub-tree index with the rest as part of the function get_tree_key
. This allowed for removing multiple instances of // 256
and % 256
in the spec, and also shortened the syntax of the access events from the form (address, sub_key, leaf_key)
to the form (address, sub_key)
.
I'm a bit unsure where to go next from here on this project. It seems that the other details about Verkle Tries needs to be finalized and implemented before adding support for SELFDESTRUCT
will be considered. In the mean time, I will try to learn more about what remains to be done about Verkle tries, and see if I can find something to work on in that area.