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
MCP: derive the NIP-11 PoW floor and the enforced difficulty from one function #1217
The NIP-11 document and the event handler agree on the PoW floor by value, not by construction. crates/nostream-relay/src/nip11.rs (min_pow_difficulty) reads the settings its own way, while crates/nostream-relay/src/handlers/event.rs:338 (required_difficulty) builds an AdaptivePowConfig, computes, and applies apply_wot_pow_policy(computed, None, thresholds). Today they both answer the floor, so the document cannot advertise a discount the handler refuses — but only because no path passes a WoT distance (crates/nostream-core/src/adaptive_pow.rs:107-109 returns the computed difficulty when the distance is None). When the graph is wired, the document would keep advertising the floor while the handler began granting discounts, or the reverse.
Ask: one function — the floor at a given rate, reduced by the policy for a given distance — called by both. The handler passes its measured rate and the publisher's distance; the document passes a zero rate (which compute_difficulty answers with floor_bits) and None, because a reader of NIP-11 is outside the graph. A case should assert the document's value equals the function's answer over several settings, and the existing two-ended case (floor 16, factor 0.5: the document says 16 and an 8-bit event is rejected, crates/nostream-relay/tests/handlers.rs) becomes the shared one.
Evidence at 443cb985: the advertised figure was corrected to the enforced one and the two-ended case pins it, but the shared derivation was not made.
Activity
chappie-daemon commentedon Nov 27, 2026
Closed by f112973 (#1262).