From d8adf63c91718ff76fd0d23e48949a88e2214017 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 19 Nov 2024 09:14:27 +0100 Subject: [PATCH 1/4] Add repro --- .../trie/proof_decode/issue_2035_ter_proof | Bin 0 -> 15773 bytes lib/src/trie/proof_decode/tests.rs | 41 ++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lib/src/trie/proof_decode/issue_2035_ter_proof diff --git a/lib/src/trie/proof_decode/issue_2035_ter_proof b/lib/src/trie/proof_decode/issue_2035_ter_proof new file mode 100644 index 0000000000000000000000000000000000000000..02640b51a4b3c4e7740ac1f199066ee95267954a GIT binary patch literal 15773 zcmch-1yogEw?2Fh=g^Iaq#)ghbVy34q=M32(jAKuL`oWwlu4E{colvri2yWY!?WWwuOk%LvE0xDygKjh&|lUuS~5`bi74i z3`IF3NP^sgBH%#b5GVwK3~7gIA)sCRw+w|r=qRf?zdjLG)U)H*6$))&6DryZnb~BzQ9- z911~rmE#hd*4N@}xL&bilHexh<{~rltV#>vj@E550JHx8=Z?!OzrP0&0GWhiD0>(} zkD)O9-}(8kK|nB}2yh4t3VGn`GDvju8K!?3R-EeKm|@pzztNI`Kte<7NsUL8+3YYV z@;sDO?nKeKy80%>OC>TS6Ovz{6MzU|94$do|3|B!HQ>(cx6 zyLDKW@ckd3R+U44R#m?YT+=CPQw&=e& zyobmL{aw)S^8bdz3m*EySWbBJ!#UcIqxoA;s-@8peJGGJ6c$hP*&iBWV&n8%--TP9)3NN=a|_e zb}I41KdsFR>`CAF?d5m*Z)?hz1SEEA0aL@Bv*+#~1HErK6>pStRJ5&0A88J@2?$Ow z9sgxbikV^ax3%x`-`3{0N5HVC$QZ2xj3<^nFA^&)qjjdjrd_`Dh%QL})X)os;?0f! z&4;t<%G&oN5<(^klOVYNdgu|Z9`K)TewY4svN_RHiHYBT6M4rm*L2X7ktX9cMh9_y zv~^#i!l6g5EF3!<-h$Bl8PYw)_2E9&#q_-Tb{!~ziqS| zN$k=YT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C0-uHsrITdK^+lltX=$I|cktE$cCfLYOjx zTD*u7^C&d0NP?y{99K_cRN+YbUZMV3JLIq)dbYm1wW^ZHh z!&WOp-Hf+|9_cA!zKxby@bYhBKicD%=Q5K0Iz|LpN-JWTy@ZRXZ13%t(bV{pNJq2Af#57BVR^ugHGJacOS2SY ziO(a0u1dUZ z?u}B?XT2FX>4^>jx!Znm8JaYd85(zly6NBMvRyN{c-Us+L8KhmAI~6~2tKu>zUNv& zYkG~A5UEh6$(Z0S8`x)cdR8ccO_kzz#sOT+M=pjP2by)Q=Gspk8xZ@@X{2Kz91FA~i$L;bZ%Jf>o6`Jaqq-EfsZ)>emrB|lX~R#xOg>Qa0S zMu?@EeP-)Hv)CLK76BdH8mA;#YKV;Rz<#g2~qnq_uWg1DDD6=?S815*1E zcU(H$xh?4qpyyy)j-mFIZ2FXQ5+6=qlkgDsykYuLyJ1eJ-RyZqEQmyP7rAliyVKbF pgqjIJoM_Tx?x~`>() ); } + +#[test] +fn issue_2035_ter() { + // Repro for the third issue in . + let proof = include_bytes!("./issue_2035_ter_proof"); + let state_root_hash: [u8; 32] = [ + 41, 58, 166, 224, 119, 219, 231, 9, 12, 167, 17, 84, 219, 167, 26, 243, 212, 63, 97, 115, + 107, 26, 110, 144, 12, 215, 113, 172, 8, 193, 142, 60, + ]; + let key: [u8; 44] = [ + 0x63, 0xf7, 0x8c, 0x98, 0x72, 0x3d, 0xdc, 0x90, 0x73, 0x52, 0x3e, 0xf3, 0xbe, 0xef, 0xda, + 0x0c, 0xa9, 0x5d, 0xac, 0x46, 0xc0, 0x7a, 0x40, 0xd9, 0x15, 0x06, 0xe7, 0x63, 0x7e, 0xc4, + 0xba, 0x57, 0x0f, 0x47, 0x4e, 0xe8, 0x5a, 0x3c, 0xd6, 0x22, 0xf8, 0x07, 0x00, 0x00 + ]; + + let decoded = super::decode_and_verify_proof(super::Config { proof }).unwrap(); + + let next_key = decoded.next_key( + &state_root_hash, + trie::bytes_to_nibbles(key.iter().copied()), + false, + iter::empty(), + false, + ); + + assert_eq!( + next_key.unwrap().unwrap().collect::>(), + trie::bytes_to_nibbles( + // TODO: update the expected + [ + 0x63, 0xf7, 0x8c, 0x98, 0x72, 0x3d, 0xdc, 0x90, 0x73, 0x52, 0x3e, 0xf3, 0xbe, 0xef, + 0xda, 0x0c, 0xa9, 0x5d, 0xac, 0x46, 0xc0, 0x7a, 0x40, 0xd9, 0x15, 0x06, 0xe7, 0x63, + 0x7e, 0xc4, 0xba, 0x57, 0x0f, 0x47, 0x4e, 0xe8, 0x5a, 0x3c, 0xd6, 0x22, 0xf8, 0x07, + 0x00, 0x00 + ] + .iter() + .copied() + ) + .collect::>() + ); +} From f7b52bd9cf531d2c3d1ca2e0a3fccc88664c6fdc Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 19 Nov 2024 09:24:19 +0100 Subject: [PATCH 2/4] Fix first issue --- lib/src/trie/proof_decode.rs | 1 + lib/src/trie/proof_decode/tests.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/trie/proof_decode.rs b/lib/src/trie/proof_decode.rs index 7204cab45d..4f450d8e36 100644 --- a/lib/src/trie/proof_decode.rs +++ b/lib/src/trie/proof_decode.rs @@ -1108,6 +1108,7 @@ impl> DecodedTrieProof { iter_entry += 1; iter_entry += self.entries[iter_entry].child_entries_follow_up; iterating_up = false; + continue; // Continue in order to refresh `iter_entry_decoded`. } let mut iter_entry_partial_key_iter = iter_entry_decoded.partial_key; diff --git a/lib/src/trie/proof_decode/tests.rs b/lib/src/trie/proof_decode/tests.rs index 03a5289921..5240599da8 100644 --- a/lib/src/trie/proof_decode/tests.rs +++ b/lib/src/trie/proof_decode/tests.rs @@ -2443,7 +2443,7 @@ fn issue_2035_ter() { let key: [u8; 44] = [ 0x63, 0xf7, 0x8c, 0x98, 0x72, 0x3d, 0xdc, 0x90, 0x73, 0x52, 0x3e, 0xf3, 0xbe, 0xef, 0xda, 0x0c, 0xa9, 0x5d, 0xac, 0x46, 0xc0, 0x7a, 0x40, 0xd9, 0x15, 0x06, 0xe7, 0x63, 0x7e, 0xc4, - 0xba, 0x57, 0x0f, 0x47, 0x4e, 0xe8, 0x5a, 0x3c, 0xd6, 0x22, 0xf8, 0x07, 0x00, 0x00 + 0xba, 0x57, 0x0f, 0x47, 0x4e, 0xe8, 0x5a, 0x3c, 0xd6, 0x22, 0xf8, 0x07, 0x00, 0x00, ]; let decoded = super::decode_and_verify_proof(super::Config { proof }).unwrap(); @@ -2459,11 +2459,10 @@ fn issue_2035_ter() { assert_eq!( next_key.unwrap().unwrap().collect::>(), trie::bytes_to_nibbles( - // TODO: update the expected [ 0x63, 0xf7, 0x8c, 0x98, 0x72, 0x3d, 0xdc, 0x90, 0x73, 0x52, 0x3e, 0xf3, 0xbe, 0xef, 0xda, 0x0c, 0xa9, 0x5d, 0xac, 0x46, 0xc0, 0x7a, 0x40, 0xd9, 0x15, 0x06, 0xe7, 0x63, - 0x7e, 0xc4, 0xba, 0x57, 0x0f, 0x47, 0x4e, 0xe8, 0x5a, 0x3c, 0xd6, 0x22, 0xf8, 0x07, + 0x7e, 0xc4, 0xba, 0x57, 0x16, 0x03, 0x94, 0x31, 0x5f, 0xe9, 0x5b, 0x98, 0xf3, 0x07, 0x00, 0x00 ] .iter() From 960f7253e36c0abe61a773fd6a28a3c9cfcbecbe Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 19 Nov 2024 09:29:49 +0100 Subject: [PATCH 3/4] Fix second issue --- lib/src/trie/proof_decode.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/trie/proof_decode.rs b/lib/src/trie/proof_decode.rs index 4f450d8e36..c09c982e02 100644 --- a/lib/src/trie/proof_decode.rs +++ b/lib/src/trie/proof_decode.rs @@ -1105,8 +1105,8 @@ impl> DecodedTrieProof { // `iter_entry` is still pointing to the child at index `parent_to_child_nibble`. // Since we're jumping to its next sibling, all we have to do is skip over it // and its descedants. - iter_entry += 1; iter_entry += self.entries[iter_entry].child_entries_follow_up; + iter_entry += 1; iterating_up = false; continue; // Continue in order to refresh `iter_entry_decoded`. } From e5dd52dac00cc928ed9494a388aee1466fa7395b Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 19 Nov 2024 09:30:38 +0100 Subject: [PATCH 4/4] CHANGELOG --- wasm-node/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index cb5634fe70..898fcf4c1f 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixed -- Fix another bug concerning incomplete Merkle proofs, similar to the one fixed in v2.0.32. ([#2039](https://github.com/smol-dot/smoldot/pull/2039)) +- Fix another bug concerning incomplete Merkle proofs, similar to the one fixed in v2.0.32. ([#2039](https://github.com/smol-dot/smoldot/pull/2039), [#2041](https://github.com/smol-dot/smoldot/pull/2041)) ## 2.0.32 - 2024-11-08