MCPcopy Create free account
hub / github.com/argumentcomputer/ix / read_anon_hints_section

Function read_anon_hints_section

crates/ixon/src/serialize.rs:84–98  ·  view source on GitHub ↗

Read the optional trailing `anon_hints` section written by `Env::put`. No-op when no bytes remain after the comms section — backward-compatible with `.ixe` that have no hints or predate the section. Inserts into `env.anon_hints` (overwriting any value harvested from a Named section, with the identical value, so the order of harvest vs. section is moot).

(
  buf: &mut &[u8],
  env: &mut Env,
)

Source from the content-addressed store, hash-verified

82 match opt {
83 None => buf.push(0x00),
84 Some(addr) => {
85 buf.push(0x01);
86 buf.extend_from_slice(addr.as_bytes());
87 },
88 }
89}
90
91fn get_opt_addr(buf: &mut &[u8]) -> Result<Option<Address>, String> {
92 match get_u8(buf)? {
93 0x00 => Ok(None),
94 0x01 => Ok(Some(get_address(buf)?)),
95 b => Err(format!("get_opt_addr: invalid tag 0x{:02X}", b)),
96 }
97}
98
99/// Read the `.ixe` header shared by every Env reader: `Tag4(0xE, 0)`,
100/// the 32-byte consts merkle root, the bundle `main` pointer, and the
101/// strictly ascending assumptions list. Centralized so the four readers

Callers 3

getMethod · 0.85
get_anonMethod · 0.85
get_anon_mmapMethod · 0.85

Calls 4

get_u64Function · 0.70
get_addressFunction · 0.70
is_emptyMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected