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
node: newtype hashes and source node ids instead of raw [u8; 32] #1851
WarmingAllowance and the warming-credit seam pass both content hashes and source node identities as bare [u8; 32], so the compiler cannot tell them apart.
Concrete places this bites:
debit_speculative(source: [u8; 32], hash: [u8; 32], units: u64) — two adjacent same-typed parameters a caller can transpose silently.
source_for(hash: [u8; 32]) -> Option<[u8; 32]> takes a hash and returns a source of the same type.
The credit channel payload is mpsc::Sender<([u8; 32], u64)> carrying a source, while WarmingCreditSink::credit directly above it carries a hash. Identical tuple shape, nothing marks where the meaning flips.
The node crate has a real Hash type and deliberately degrades at this boundary (handlers/client/mod.rs does *hash.as_bytes()), so this is a conscious style choice rather than an oversight — filing it so the choice is revisitable rather than implicit.
Suggestion: a SourceId newtype and decdn_cache::Hash at this boundary. Pre-existing, surfaced by the #1803 review.
Activity