Skip to content

Commit 412a26d

Browse files
committed
fix: clock skew tolerance 30s -> 5min (proven by Mac upload to NAT testnet)
MAX_FUTURE_SECS: 30 -> 300 (symmetric with MAX_MESSAGE_AGE_SECS). Without this: 0/3 uploads from Mac with 31s clock skew. With this: 3/3 uploads succeeded.
1 parent d48dbff commit 412a26d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

crates/saorsa-core/src/network.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,13 +1613,13 @@ impl P2PNode {
16131613
/// can pass it directly to `send_message()`. This eliminates a spoofing
16141614
/// vector where a peer could claim an arbitrary identity via the payload.
16151615
///
1616-
/// Maximum allowed clock skew for message timestamps (5 minutes).
1617-
/// This is intentionally lenient for initial deployment to accommodate nodes with
1618-
/// misconfigured clocks or high-latency network conditions. Can be tightened (e.g., to 60s)
1619-
/// once the network stabilizes and node clock synchronization improves.
1616+
/// Maximum allowed clock skew for message timestamps.
1617+
/// A decentralized network cannot assume participants have accurate clocks.
1618+
/// Consumer devices commonly drift by minutes (no NTP, suspended laptops, VMs).
1619+
/// Measured 31-42s skew between macOS client and NTP-synced VPS nodes.
16201620
const MAX_MESSAGE_AGE_SECS: u64 = 300;
1621-
/// Maximum allowed future timestamp (30 seconds to account for clock drift)
1622-
const MAX_FUTURE_SECS: u64 = 30;
1621+
/// Maximum allowed future timestamp — symmetric with the past window.
1622+
const MAX_FUTURE_SECS: u64 = 300;
16231623

16241624
/// Convenience constructor for `P2PError::Network(NetworkError::ProtocolError(...))`.
16251625
fn protocol_error(msg: impl std::fmt::Display) -> P2PError {

0 commit comments

Comments
 (0)