Skip to content

Commit

Permalink
Expand and correct comment explaining why account must already exist (#…
Browse files Browse the repository at this point in the history
…80)

Co-authored-by: Mason Liang <[email protected]>
  • Loading branch information
z2trillion and Mason Liang authored Nov 14, 2023
1 parent ef0656a commit ee6e4a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ impl From<(&MPTProofType, &SMTTrace)> for ClaimKind {
match update {
[None, None] => (),
[Some(old), Some(new)] => {
// The account must exist, because only contracts with bytecode can modify their own storage slots.
// Accesses to the MPT happen in the order defined in the state (aka rw) circuit, which is not the
// same as the order they occur in the EVM. In the state circuit, nonce and balance modifications
// will precede storage modifications for a given address, which means that the MPT circuit only
// needs to handle storage modifications for existing accounts, even though this is not true in the
// EVM, where the storage of an account can be modified during its construction.
if !(account_old == account_new
|| (account_old.is_none() && account_new == &Some(Default::default())))
{
Expand Down

0 comments on commit ee6e4a3

Please sign in to comment.