| 683 | |
| 684 | #[test] |
| 685 | fn test_encode_decode_extension_blinded_long() { |
| 686 | const EXTENSION_RLP: [u8; 38] = |
| 687 | hex!("e58300646fa0f3fe8b3c5b21d3e52860f1e4a5825a6100bb341069c1e88f4ebf6bd98de0c190"); |
| 688 | let mut rlp_buf = Vec::new(); |
| 689 | |
| 690 | let opened = |
| 691 | TrieNode::Leaf { prefix: Nibbles::from_nibbles([0x00]), value: [0xFF; 64].into() }; |
| 692 | opened.encode(&mut rlp_buf); |
| 693 | let blinded = TrieNode::new_blinded(keccak256(&rlp_buf)); |
| 694 | |
| 695 | rlp_buf.clear(); |
| 696 | let opened_extension = |
| 697 | TrieNode::Extension { prefix: Nibbles::unpack(bytes!("646f")), node: Box::new(opened) }; |
| 698 | opened_extension.encode(&mut rlp_buf); |
| 699 | |
| 700 | let expected = TrieNode::Extension { |
| 701 | prefix: Nibbles::unpack(bytes!("646f")), |
| 702 | node: Box::new(blinded), |
| 703 | }; |
| 704 | assert_eq!(expected, TrieNode::decode(&mut EXTENSION_RLP.as_slice()).unwrap()); |
| 705 | } |
| 706 | |
| 707 | #[test] |
| 708 | fn test_decode_leaf() { |