You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NodeCandidate.region_hint should be Option<Region>, not String #1348
crates/client-pull/src/discovery.rs carries region_hint: String with a doc comment saying it is an ISO 3166-1 alpha-2 code (ADR 030), but nothing enforces that. The workspace already owns the validator — decdn_protocol::is_valid_region (crates/protocol/src/region.rs:23) — and decdn-protocol is already a client-pull dependency, so this costs no new edge.
Two consequences today:
select_candidates compensates at the call site with trim() + eq_ignore_ascii_case, because one side of the comparison (chain.region) is already normalized by normalize_region (crates/common/src/config/mod.rs:564) and the other is raw. That is an invariant enforced by every call site instead of by the type.
The PartialEq/Eq derives added in feat(client-pull): retry + peer-cache fallback for registry bootstrap #1341 compare region_hint structurally, so the same node registered as us vs US compares unequal. Only tests consume Eq today, so it is latent — but any future dedup/contains/retain over candidates would fail to dedupe.
Option<Region> rather than a required Region: CapacityBond.sol permits any string up to 16 bytes and ADR 030 § Cross-ADR Impact explicitly declines to tighten it, so rejecting a candidate for an unrecognized region would be stricter than the source of truth and would silently shrink the fetchable node set for a purely advisory field. An unrecognized code should parse to None and sort into the "rest" bucket — today's behavior — while Some is guaranteed normalized. That deletes the trim()/eq_ignore_ascii_case from select_candidates, makes the derived Eq correct for free, and restores the 16-byte bound on the peer-cache read path.
Note this changes the peers.json encoding, so it needs a PEER_CACHE_VERSION bump.
Out of scope for #1341 (the String predates it; that PR only added the derives).
Note the batch's review round revised the framing of this issue's premise where it was wrong — see the PR description and the ADR/NatSpec updates for the corrected account.
Activity
fix(protocol): stop `Region`'s deserializer echoing the rejected input (
fix: batch six review follow-ups (#1346, #1347, #1348, #1349, #1359, #…
thiras commentedon Jul 21, 2026
Fixed in #1362 (merged as e73fa04).
Note the batch's review round revised the framing of this issue's premise where it was wrong — see the PR description and the ADR/NatSpec updates for the corrected account.