You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During code review, I found the following issues with proof verification for Ethereum Merkle Patricia Trie (in contracts/near/eth-prover/src/lib.rs):
In function verify_trie_proof: the code that is supposed to split the bytes of the key into nibbles will not split a byte if actual_key.len() + 1 == proof.len(). This is incorrect.
In function _verify_trie_proof: the case node.len() < 32 is superfluous. The size of a receipt is always greater than 32 bytes, and therefore so is the size of any node in the trie.
In function _verify_trie_proof: the case key_index == key.len() is superfluous. The value may be only stored directly in a branch node if there are two keys such that one is a prefix of the other. In the trie of receipts, the keys are RLP encodings, and an RLP encoding can never be a prefix of a different RLP encoding.
In function _verify_trie_proof: the calls to Self::concat_nibbles are incorrect, because both key and key_end (or shared_nibbles) contain nibbles.
In function _verify_trie_proof: the condition expected_value.len() == 0 is incorrect. If the execution reached this point, the function should return false (however, since expected_value is an RLP encoding of a receipt, it cannot be empty).
The text was updated successfully, but these errors were encountered:
During code review, I found the following issues with proof verification for Ethereum Merkle Patricia Trie (in contracts/near/eth-prover/src/lib.rs):
verify_trie_proof
: the code that is supposed to split the bytes of the key into nibbles will not split a byte ifactual_key.len() + 1 == proof.len()
. This is incorrect._verify_trie_proof
: the casenode.len() < 32
is superfluous. The size of a receipt is always greater than 32 bytes, and therefore so is the size of any node in the trie._verify_trie_proof
: the casekey_index == key.len()
is superfluous. The value may be only stored directly in a branch node if there are two keys such that one is a prefix of the other. In the trie of receipts, the keys are RLP encodings, and an RLP encoding can never be a prefix of a different RLP encoding._verify_trie_proof
: the calls toSelf::concat_nibbles
are incorrect, because bothkey
andkey_end
(orshared_nibbles
) contain nibbles._verify_trie_proof
: the conditionexpected_value.len() == 0
is incorrect. If the execution reached this point, the function should returnfalse
(however, sinceexpected_value
is an RLP encoding of a receipt, it cannot be empty).The text was updated successfully, but these errors were encountered: