jonnify·bcs /bcs/elixir-core/champ/the-forest-and-the-placement-law

B2.3 · dive 1 — the forest and the placement law

The brand routes; the integer hashes.

EchoData.BrandedChamp is a forest: a top-level map from the 3-byte namespace to a CHAMP trie, with the trie keyed by the snowflake integer — the id is split at the boundary, the base62 payload decoded once, and the integer enters the trie.

Source: content/bcs2.3.md; the gate is H1 in bcs_rung_2_3_check.out; the integrated modules are committed at runtimes/elixir/lib/echo_data/champ/{branded_champ,champ_node,champ_server}.ex.

The two-stage placement, drawn. A branded id splits into brand and integer; the brand picks the trie, the integer hashes into its nodes. Select a part to read its role.
ORD the brand — routes 274557032793636864 the integer — hashes %{brand => trie} the forest — one trie per namespace the CHAMP trie 5-bit fragments — 32-way branching datamap 32 bits — inline pairs nodemap 32 bits — children compact array popcount-indexed — no empty slots
readout · Select a part of the pipeline. The top row is the routing — brand to trie; the dashed row is one node's internals — two bitmaps over one compact array, the CHAMP design proper.
§1

The transcript

bcs_rung_2_3_check.out · verbatim · this dive reads H1
content/echo_data/runtimes/elixir/bcs_rung_2_3_check.out · the H1 line, verbatimfrozen
H1 canon ok -- placement delegated to the contract hash: compute_hash_int -> BrandedId.hash32; reference snowflake round-trips

The full record — all seven gates, the mid-record [debug] boot line included — is frozen on the module hub; it closes PASS 7/7.

§2

The amendment — one placement law

content/bcs2.3.md · What · How

The drop's compute_hash_int carried a single mixing round — the first fmix64 constant, once — under a comment claiming it matches the Go side. The canon's Go is the full fmix64 behind hash32 (the committed 234878118 vector, at 0.9586 ns), and Chapter 1.2's law admits exactly one placement function. The integration performs the alignment as a delegation — the amendment is three lines and a comment:

# Chapter 2.3 integration review: placement delegated to the contract hash.
defp compute_hash_int(key) when is_integer(key) and key >= 0 do
  EchoData.BrandedId.hash32(key)
end

H1 gates it from both sides: compute_hash_int -> BrandedId.hash32 asserted in the integrated source, and the reference snowflake round-tripping through the trie. The comment's intent is now true. The decision the manuscript records: any future structure that hashes identities delegates to the contract or does not merge.

§3

The two-bitmap node

content/bcs2.3.md · What · Steindorfer & Vinju

The nodes are the CHAMP design proper: two 32-bit bitmaps per node — datamap for inline pairs, nodemap for children — over a popcount-indexed compact array, 5-bit hash fragments for 32-way branching, and the canonical representation the paper introduced so that equal maps are equal structures. Around the core: an O(1) cached census per namespace (namespace_size/2), the Access, Enumerable, and Collectable protocols, and a by-snowflake operation family that skips string handling when the caller already holds the integer.

The placement path, computed. A pure function decomposes the contract's committed vector — hash32(274557032793636864) = 234878118 (content/contract.md) — into its 5-bit fragments, level by level. Select a level; the readout shows the fragment's bits, its value, and the slot it selects.
readout · Select a level. Each level consumes five bits of the 32-bit hash — a value from 0 to 31 selecting one of 32 ways down — so the path bottoms out within seven levels.

The walk in words: the trie shifts the hash right by five bits per level and masks the low five — (hash >>> (5 × level)) & 31. The bitmaps then answer for the fragment: a set datamap bit means the pair sits inline here; a set nodemap bit means the walk descends; neither means absence — no probing, no empty slots.

§4

References

sources · related

Sources

Related