// contractCode represents a contract code with associated metadata.
typecontractCodestruct{
hashcommon.Hash// hash is the cryptographic hash of the contract code.
blob[]byte// blob is the binary representation of the contract code.
}
// accountDelete represents an operation for deleting an Ethereum account.
typeaccountDeletestruct{
addresscommon.Address// address is the unique account identifier
origin[]byte// origin is the original value of account data in slim-RLP encoding.
storagesOriginmap[common.Hash][]byte// storagesOrigin stores the original values of mutated slots in prefix-zero-trimmed RLP format.
}
// accountUpdate represents an operation for updating an Ethereum account.
typeaccountUpdatestruct{
addresscommon.Address// address is the unique account identifier
data[]byte// data is the slim-RLP encoded account data.
origin[]byte// origin is the original value of account data in slim-RLP encoding.
code*contractCode// code represents mutated contract code; nil means it's not modified.
storagesmap[common.Hash][]byte// storages stores mutated slots in prefix-zero-trimmed RLP format.
storagesOriginmap[common.Hash][]byte// storagesOrigin stores the original values of mutated slots in prefix-zero-trimmed RLP format.
}
// stateUpdate represents the difference between two states resulting from state
// execution. It contains information about mutated contract codes, accounts,
// and storage slots, along with their original values.
typestateUpdatestruct{
originRootcommon.Hash// hash of the state before applying mutation
rootcommon.Hash// hash of the state after applying mutation
destructsmap[common.Hash]struct{}// destructs contains the list of destructed accounts
accountsmap[common.Hash][]byte// accounts stores mutated accounts in 'slim RLP' encoding
accountsOriginmap[common.Address][]byte// accountsOrigin stores the original values of mutated accounts in 'slim RLP' encoding
storagesmap[common.Hash]map[common.Hash][]byte// storages stores mutated slots in 'prefix-zero-trimmed' RLP format
storagesOriginmap[common.Address]map[common.Hash][]byte// storagesOrigin stores the original values of mutated slots in 'prefix-zero-trimmed' RLP format
codesmap[common.Address]contractCode// codes contains the set of dirty codes
nodes*trienode.MergedNodeSet// Aggregated dirty nodes caused by state changes
}
// empty returns a flag indicating the state transition is empty or not.
func(sc*stateUpdate)empty()bool{
returnsc.originRoot==sc.root
}
// newStateUpdate constructs a state update object, representing the differences
// between two states by performing state execution. It aggregates the given
// account deletions and account updates to form a comprehensive state update.