MCPcopy Create free account
hub / github.com/base/triedb / encode_account_leaf

Function encode_account_leaf

src/node.rs:640–658  ·  view source on GitHub ↗
(
    nonce_rlp: &ArrayVec<u8, 9>,
    balance_rlp: &ArrayVec<u8, 33>,
    code_hash: &B256,
    storage_root: &B256,
    out: &mut dyn BufMut,
)

Source from the content-addressed store, hash-verified

638
639#[inline]
640pub fn encode_account_leaf(
641 nonce_rlp: &ArrayVec<u8, 9>,
642 balance_rlp: &ArrayVec<u8, 33>,
643 code_hash: &B256,
644 storage_root: &B256,
645 out: &mut dyn BufMut,
646) -> usize {
647 let len = 2 + nonce_rlp.len() + balance_rlp.len() + 33 * 2;
648 out.put_u8(0xf8);
649 out.put_u8((len - 2) as u8);
650 out.put_slice(nonce_rlp);
651 out.put_slice(balance_rlp);
652 out.put_u8(0xa0);
653 out.put_slice(storage_root.as_slice());
654 out.put_u8(0xa0);
655 out.put_slice(code_hash.as_slice());
656
657 len
658}
659
660#[inline]
661pub fn encode_branch(children: &[Option<Pointer>], out: &mut dyn BufMut) -> usize {

Callers 2

encodeMethod · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected