diff --git a/src/data_structures/eth_mpt.cairo b/src/data_structures/eth_mpt.cairo index 68ccecb..7e70018 100644 --- a/src/data_structures/eth_mpt.cairo +++ b/src/data_structures/eth_mpt.cairo @@ -73,7 +73,9 @@ impl MPTImpl of MPTTrait { let decoded = if proof_index != proof_len - 1 && node.len() > 9 { let current_nibble = (key / key_pow2) & 0xf; // Unwrap impossible to fail, as we are masking with 0xf, meaning the result is always a nibble - match MPTTrait::lazy_rlp_decode_branch_node(node, current_nibble.try_into().unwrap()) { + match MPTTrait::lazy_rlp_decode_branch_node( + node, current_nibble.try_into().unwrap() + ) { Result::Ok(decoded) => decoded, Result::Err(e) => { break Result::Err(e); @@ -272,7 +274,7 @@ impl MPTImpl of MPTTrait { } } - + fn lazy_rlp_decode_branch_node(rlp: Words64, current_nibble: u8) -> Result { let hash_words = rlp_decode_list_lazy(rlp, array![current_nibble.into()].span())?; match (*hash_words.at(0)).try_into() { diff --git a/src/encoding/rlp.cairo b/src/encoding/rlp.cairo index 0b9940f..178c38c 100644 --- a/src/encoding/rlp.cairo +++ b/src/encoding/rlp.cairo @@ -149,9 +149,15 @@ fn rlp_decode_list_lazy(input: Words64, lazy: Span) -> Result { return Result::Err('Not a list'); }, - RLPType::StringShort(()) => { return Result::Err('Not a list'); }, - RLPType::StringLong(()) => { return Result::Err('Not a list'); }, + RLPType::String(()) => { + return Result::Err('Not a list'); + }, + RLPType::StringShort(()) => { + return Result::Err('Not a list'); + }, + RLPType::StringLong(()) => { + return Result::Err('Not a list'); + }, RLPType::ListShort(()) => (1, list_prefix - 0xc0), RLPType::ListLong(()) => { let len_len = list_prefix - 0xf7; @@ -171,7 +177,7 @@ fn rlp_decode_list_lazy(input: Words64, lazy: Span) -> Result= len { break Result::Err('Too many items to decode'); } @@ -197,12 +203,15 @@ fn rlp_decode_list_lazy(input: Words64, lazy: Span) -> Result) -> Result