Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merkle Proof verification failed for a valid proof. #652

Open
0xsarvesh opened this issue Feb 20, 2019 · 2 comments
Open

Merkle Proof verification failed for a valid proof. #652

0xsarvesh opened this issue Feb 20, 2019 · 2 comments

Comments

@0xsarvesh
Copy link
Contributor

https://github.com/OpenSTFoundation/mosaic-contracts/blob/c48747a91746061fba73fc7a9189019d7b62fbbe/contracts/lib/MerklePatriciaProof.sol#L20

On L63,_nibblesToTraverse function increases pathPtr with the size of the extension node key.

pathPtr += _nibblesToTraverse(RLP.toData(currentNodeList[0]), path, pathPtr);

Then on L73, updated pathPtr is passed. Here _nibblesToTraverse will return 0 because the key of the extension node will not match this time. Hence false is returned from the function and Merkle proof verification will fail.

Possible fix for the issue is to preserve pathPtr before updating on L63 and pass the preserved pathPtr on L73. Refer this commit.

Below are the parameters which were passed to the verify function.

value : 0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2

encodedPath : 0x40769c9cc6db1aff35e37923897950227d2a87c95ef0101b2a0233740f2ce00d

rlpParentNodes : 0xf9022cf9019180a0320ce86e317f7e61e7890a6671338aa79374e5ec3206fc38496b5b3719788fc4a07642cb37fbbc28c4c2e8367a93bb491013223d266543c0e42db6a580cc274beea0ad8732b76b5befaa3c523633abdafb8b410b8e1140526255c839a7225e2b2f3ea060b926526a0a95873151f96f0c4aa7746dd1cc51242b4893d43554acd2716cda80a03e819a317d72fa7445677a4104b74899547b424aec05ae303b605f7d78aa9dc4a0c9980a15de3258be2f1dcf5d0657c256f7e7aebe83b736aada89aa02dee3853ea0747f61b4309342612ee827a5930678c61bd54a2c85e207144c265912351d46f4a070256c377a27b7c7cdf605559f21f20f54d147abce914c3b1ac36815fd8f2b8080a0b7a25a664618fb58b0754dd3c9665402787704d11169240bccf8e7c34feb0167a0e78c6966deeb91437d0c2cbf66bde64fd4dbb76d22a9885679a3cf9e5fd84394a02a74dc63db6f6f5f79d6cadbb2b348771d3bcd1913f9319cfa0c5fea4353db47a0e53cc96cd3fe0910d63b48800ac824d7f0e094548d259d6342da2189ca3c0e238080e210a0094e521c10bbb9291d38d4aebd6c6722a4763451011f97f24709b28611831699f8518080808080a0460b29d4cbb31e3680769b8ece024e6e35e9c9c3d9c7c207873e93b8c43cff1980a0fe9627f9a9fb3323465824fc6fdfd87f907332a17f6ed39bfdcd94c76b548eee808080808080808080e19f369c9cc6db1aff35e37923897950227d2a87c95ef0101b2a0233740f2ce00d01

root : 0xa506e7e444fc636360bb593a808f41f126a8813ea71410d4515987eacc594380

@0xsarvesh
Copy link
Contributor Author

Opened issues for MPP bug in the 3 repos:
1. ConsenSysMesh/rb-relay#3
2. TrueBitFoundation/eth-patricia#1
3. mrsmkl/eth-patricia#1

@schemar
Copy link
Contributor

schemar commented Apr 8, 2019

Blocked by tests as this shouldn't be closed before it is tested.

@0xsarvesh 0xsarvesh removed their assignment Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants