pub fn apply_account(
state: &mut State<'_>,
address: Address,
info: Option<&AccountInfo>,
code: impl FnOnce() -> DbResult<Bytecode>,
wiped: bool,
reset: bool,
slots: impl IntoIterator<Item = (U256, U256)>,
persistent: Option<&mut Vec<PersistentWrite>>,
) -> DbResult<()>Expand description
Sets the account at address in state to info, or to no account, and writes slots to
its storage after wiping it if wiped, as journaled writes, also recorded in persistent if
given. Fields that already hold their value are left alone; code is only built when the code
hash changes.
If reset, such as for an account the nested transaction created or destroyed, the nonce is
recorded as an absolute write even when it already holds its value, so that a replay does not
bring back the value it replaced, and so is the emptied balance of a destroyed account. A
created account keeps the balance it had, which may come from transfers a revert undoes.
A journaled wipe is not undone by a revert of the enclosing call: evm2 does not journal the
wipe marker, and slots the running transaction never loaded cannot be cleared one by one.
merge_changes discards the storage of tracked creations through the journaled creation
instead.