Try   HackMD

Han (weihan) - Update 11

Development Updates

I've completed most of the components related to the EVM layer which includes hard fork, revive gas cost and new transaction type. The next steps is to complete the state storage components and the integration of EVM, state storage and Verkle Tree.

Check out my development branch for Verkle Tree here.

Check out my development branch for Geth here.

Code Notes

State Expiry Hard Forks

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

There are 2 hard forks needed to enable the state expiry feature fully. Once the first hard fork is enabled, any CRUD operations on any key value pairs will modify the leaf node to contain an additional state epoch metadata. Once the second hard fork is enabled, any state that is deemed expired will not be able to be accessed.

New Transaction Type - ReviveTx

The following is the code for a new transaction used to revive expired state:

type ReviveStateTx struct {
	ChainID    *big.Int
	Nonce      uint64   
	GasTipCap  *big.Int
	GasFeeCap  *big.Int
	AccessList AccessList
	GasPrice   *big.Int        
	Gas        uint64          
	To         *common.Address  
	Value      *big.Int        
	Data       []byte          
	ReviveList ReviveList      

	V, R, S *big.Int
}

This new transaction is essentially the same as the DynamicFeeTx (aka EIP1559), with the addition of ReviveList. The ReviveList components are as follows:

type ReviveList []ReviveData

type ReviveData struct {
	Address common.Address
	KV      []ReviveKeyValues
}

type ReviveKeyValues struct {
	key    []byte
	values [][]byte
}

To put it in simpler words, one transaction can revive multiple key-value pairs of different addresses. The revive operation also comes with additional gas cost. For now, I just use some arbitrary number measured in bytes. Here's the code for the calculation:

func (r *ReviveData) Size() uint64 {
	size := uint64(0)
	for i := range r.KV {
		size += r.KV[i].Size()
	}
	return size + uint64(len(r.Address.Bytes()))
}

Preparing for Benchmarking

Aside from showcasing a PoC, I should be able to show how much state storage can be saved if we were to implement this on Ethereum mainnet. To do this, I need to perform the overlay transition to convert existing MPT to the Verkle Tree. At the same time, I need two information in order to perform the transition alongside the state expiry scheme:

  1. Last accessed block number for each key-value pair
  2. Preimage

For 1, I have been full syncing a node for weeks and now it's at ~12.5M blocks. It should take another 1 month to reach the latest block height.

For 2, I have contacted Ignacio and Guillaume to see if they have any existing preimage file. Will need to follow up with Guillaume next week.

Next week's Action Items

  • Complete the development of state storage
  • Complete the development of snapshot layer
  • Complete the setup of devnet