mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 00:04:54 +00:00
Merge sole-store context change into the next-side
Bring the immutable-state single-store change onto the Noise XX line. The shared NodeContext is now the sole store; this merge applies the next-only adaptations the master-side change couldn't carry: - Remove node_profile from the Node struct (next-only field) so it lives solely in NodeContext; migrate its readers (tree/bloom/discovery/ handshake negotiation) onto the node_profile() accessor. The two FMP negotiation sites hoist node_profile() into a local to avoid borrowing &self while a connection is mutably borrowed. - leaf_only sets both is_leaf_only and node_profile via the context swap. - Preserve the XX handshake/rekey structure (no identity-in-msg1; XX/XK initiator/responder constructors) while applying the startup_epoch() accessor migration. - Tests: route profile selection through a make_test_node_with_profile helper (profile is immutable, set via Config flags) instead of poking the removed field. cargo test --lib 1369/0; clippy -D warnings and release build clean.
This commit is contained in:
@@ -233,6 +233,21 @@ run_build() {
|
||||
record "clippy" 1
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Guard: the effectively-immutable state lives solely in NodeContext. The
|
||||
# Node struct must not re-declare a bundled field (config/identity/
|
||||
# startup_epoch/started_at/is_leaf_only/node_profile/max_*) — a shadow field
|
||||
# would silently reopen dual-store divergence between the struct and the
|
||||
# context. Checks the struct *declaration*, so it is wrap-insensitive.
|
||||
info "node-context single-store guard"
|
||||
if awk '/^pub struct Node \{/,/^\}/' src/node/mod.rs \
|
||||
| grep -qE '^[[:space:]]+(config|identity|startup_epoch|started_at|is_leaf_only|node_profile|max_connections|max_peers|max_links):'; then
|
||||
fail "Node struct re-declares a bundled immutable field; it must live solely in NodeContext"
|
||||
record "node-context-guard" 1
|
||||
return 1
|
||||
else
|
||||
record "node-context-guard" 0
|
||||
fi
|
||||
}
|
||||
|
||||
# ── Stage 2: Unit Tests ───────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user