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
We are setting invalid values to the proof array but no error is thrown
It is thrown is the root is the invalid value (expected)
By always receiving null as a response, we have no way to tell if it is because (1) the proof is valid and there is no such value or because (2) the proof is invalid and the value doesn't match anyway.
Steps to reproduce:
Adding the following test case to trie/test/index.spec.ts
tape('shall throw an error when a proof is invalid',async(t)=>{consttrie=newBaseTrie()awaittrie.put(Buffer.from('a'),Buffer.from('value1'))awaittrie.put(Buffer.from('aa'),Buffer.from('value2'))awaittrie.put(Buffer.from('aaa'),Buffer.from('value3'))constproof=awaitBaseTrie.createProof(trie,Buffer.from("a"))// Normal verificationawaitBaseTrie.verifyProof(trie.root,Buffer.from('a'),proof)// Corrupting the proofproof[0].reverse()try{// @throws — If proof is found to be invalid.awaitBaseTrie.verifyProof(trie.root,Buffer.from('a'),proof)t.fail('should have thrown an error, but didn\'t')}catch(err){}t.end()})
Some testing for invalid roots should also be added.
Thank you!
We are using the
BaseTrie
class to check the validity of Ethereum storage proofs and proof of non-existence.According to the Readme,
verifyProof
should be throwing an error ifproof
is found to be invalid.However:
proof
array but no error is thrownBy always receiving
null
as a response, we have no way to tell if it is because (1) the proof is valid and there is no such value or because (2) the proof is invalid and the value doesn't match anyway.Steps to reproduce:
trie/test/index.spec.ts
Some testing for invalid roots should also be added.
Thank you!
(thanks @ed255 for the discovery)
The text was updated successfully, but these errors were encountered: