There are two type of leaf nodes (leaf and empty) at the last row of a mpt circuit, which is adjacent to the rows of a account gadget. When the type of lead node is empty the value (hash) in this row is just zero so we can make the account gadget valid by flushing zero inside it (hashing (0, 0) -> 0 is valid in hash table current) but this has bring some unsound condition and should be fixed later (#17). It is also contradict to the "write on empty accont" entry of the rw table (#14)
So we should add explicity constraints in account gadget to accounting for the empty node in its adjacent mpt row that:
- All variables in account except for code hashes (
nonce, balance, codesize, storage root) is 0
code hash is poseidon(nil) and keccak code hash is keccak256(nil)
And make current constraints only being enabled for leaf node
There are two type of leaf nodes (
leafandempty) at the last row of a mpt circuit, which is adjacent to the rows of a account gadget. When the type of lead node isemptythe value (hash) in this row is just zero so we can make the account gadget valid by flushing zero inside it (hashing(0, 0) -> 0is valid in hash table current) but this has bring some unsound condition and should be fixed later (#17). It is also contradict to the "write on empty accont" entry of the rw table (#14)So we should add explicity constraints in account gadget to accounting for the
emptynode in its adjacent mpt row that:nonce,balance,codesize,storage root) is 0code hashisposeidon(nil)andkeccak code hashiskeccak256(nil)And make current constraints only being enabled for
leafnode