Skip to content

Commit

Permalink
test: zero value leaf
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk committed Sep 17, 2024
1 parent 1a0675b commit 3770ca9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/nodes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ mod tests {
use crate::TrieMask;
use alloy_primitives::hex;

#[test]
fn rlp_zero_value_leaf_roundtrip() {
let leaf = TrieNode::Leaf(LeafNode::new(
Nibbles::from_nibbles_unchecked(hex!("0604060f")),
alloy_rlp::encode(alloy_primitives::U256::ZERO),
));
let rlp = leaf.rlp(&mut vec![]);
assert_eq!(rlp, hex!("c68320646f8180"));
assert_eq!(TrieNode::decode(&mut &rlp[..]).unwrap(), leaf);
}

#[test]
fn rlp_trie_node_roundtrip() {
// leaf
Expand Down

0 comments on commit 3770ca9

Please sign in to comment.