MCPcopy Create free account
hub / github.com/base/base / test_encode_decode_extension_open_short

Function test_encode_decode_extension_open_short

crates/proof/mpt/src/node.rs:668–682  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

666
667 #[test]
668 fn test_encode_decode_extension_open_short() {
669 const EXTENSION_RLP: [u8; 19] = hex!("d28300646fcd308b8a74657374207468726565");
670
671 let opened = TrieNode::Leaf {
672 prefix: Nibbles::from_nibbles([0x00]),
673 value: bytes!("8a74657374207468726565"),
674 };
675 let expected =
676 TrieNode::Extension { prefix: Nibbles::unpack(bytes!("646f")), node: Box::new(opened) };
677
678 let mut rlp_buf = Vec::with_capacity(expected.length());
679 expected.encode(&mut rlp_buf);
680
681 assert_eq!(expected, TrieNode::decode(&mut EXTENSION_RLP.as_slice()).unwrap());
682 }
683
684 #[test]
685 fn test_encode_decode_extension_blinded_long() {

Callers

nothing calls this directly

Calls 2

lengthMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected