Files
ngit-grasp/Cargo.toml
T
DanConwayDev ecb6c8b68c fix(sync): use bounded cooldown for transient negentropy failures
One transient negentropy diff error permanently disabled NIP-77 for the
relay connection. On gitnostr.com (2026-08-04, PR commit 256a9912) a
single client-side "channel lagged by 3" during the startup burst marked
the bootstrap relay non-NIP-77 within seconds of startup; 20 relays were
marked in the first minutes and reconciliation collapsed from 739 runs
to 24 after 14:30 UTC. 93% of observed failures (timeout, channel
lagged, blocked/rate-limit) carry no information about NIP-77 support,
and the affected relays advertise NIP-77 in their NIP-11 documents.

Classify diff failures: only explicit unsupported signals ("negentropy
not supported", "server does not support our negentropy protocol
version") permanently mark the connection; everything else applies an
escalating per-relay cooldown (60s/5m/30m/2h) that a successful diff
resets. Failures arriving while a cooldown is active come from diffs
already in flight when it started and do not escalate the backoff.
Per-batch REQ+EOSE fallback is unchanged, so sync progress never
depends on the classification. The concurrent-abort error no longer
fabricates a NOTICE-based detection.

Classification matches on relay-reported error strings, so a nostr-sdk
upgrade that rewords them would degrade to cooldown-only behaviour (the
safe direction: never permanently disabling NIP-77). The zero-progress
retry marking in sync::mod is deliberately unchanged.

Validated by new classifier and cooldown state-machine tests in
sync::relay_connection (tokio paused time, no fixed sleeps) written
red-first against the production failure strings, plus the full suite.
2026-08-04 18:26:32 +00:00

163 lines
4.1 KiB
TOML

[package]
name = "ngit-grasp"
version = "2.0.0"
edition = "2021"
authors = ["ngit-grasp contributors"]
license = "MIT"
description = "A GRASP (Git Relays Authorized via Signed-Nostr Proofs) implementation in Rust"
repository = "https://gitworkshop.dev/danconwaydev.com/ngit-grasp"
[dependencies]
# Async runtime
tokio = { version = "1.35", features = ["full"] }
# HTTP server (hyper for relay integration)
hyper = { version = "1.4", features = ["full"] }
hyper-util = { version = "0.1", features = ["tokio", "server", "http1", "http2"] }
http-body-util = "0.1"
# Nostr
#
# These are prerelease (alpha) requirements and are pinned exactly with `=`.
# Cargo treats `"0.45.0-alpha.8"` as `^0.45.0-alpha.8`, which accepts *any*
# later prerelease of 0.45.0 even though alphas carry no compatibility
# guarantee (alpha.4 deleted the `nostr-relay-builder` crate outright). Exact
# pins keep lockfile-less builds - `cargo install`, downstream consumers of the
# `ngit_grasp` library - on the version this tree is tested against.
# Relax to caret requirements once 0.45.0 is released.
nostr = "=0.45.0-alpha.8"
# `local-relay` carries the embedded relay implementation, previously the
# separate `nostr-relay-builder` crate.
nostr-sdk = { version = "=0.45.0-alpha.8", features = ["local-relay"] }
nostr-lmdb = "=0.45.0-alpha.8"
nostr-memory = "=0.45.0-alpha.8"
# Utilities
# SHA-1 for the `Sec-WebSocket-Accept` handshake. `nostr` uses this same crate
# internally but stopped re-exporting it as `nostr::hashes` in 0.45.0-alpha.8,
# so depend on it directly rather than pulling in a second hash implementation.
bitcoin_hashes = "0.14"
futures-util = "0.3"
base64 = "0.22"
flate2 = "1.0"
tar = "0.4"
fs2 = "0.4"
# Metrics
prometheus = "0.14"
dashmap = "6"
lazy_static = "1.4"
# Data structures
indexmap = "2"
# Random (for startup jitter)
rand = "0.10"
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# Configuration
dotenvy = "0.15"
clap = { version = "4.5", features = ["derive", "env"] }
# Error handling
anyhow = "1.0"
# Async traits
async-trait = "0.1"
# Temporary directories (used for GRASP-06 empty-repo synthesis)
tempfile = "3"
# Git (for future use)
# git-http-backend = "0.3"
[dev-dependencies]
# Testing
grasp-audit = { path = "grasp-audit", version = "0.2.0" }
tempfile = "3"
tokio = { version = "1.35", features = ["full", "test-util"] }
reqwest = { version = "0.13", default-features = false, features = ["native-tls"] }
tokio-tungstenite = "0.28.0"
[lib]
name = "ngit_grasp"
path = "src/lib.rs"
[[bin]]
name = "ngit-grasp"
path = "src/main.rs"
[[test]]
name = "nip09_announcement_cascade"
path = "tests/lifecycle/nip09_announcement_cascade.rs"
[[test]]
name = "nip09_blacklist_ops"
path = "tests/lifecycle/nip09_blacklist_ops.rs"
[[test]]
name = "nip09_cascade_event_types"
path = "tests/lifecycle/nip09_cascade_event_types.rs"
[[test]]
name = "nip09_disrespector"
path = "tests/lifecycle/nip09_disrespector.rs"
[[test]]
name = "nip09_git_archive_cleanup"
path = "tests/lifecycle/nip09_git_archive_cleanup.rs"
[[test]]
name = "nip09_holding_cleanup"
path = "tests/lifecycle/nip09_holding_cleanup.rs"
[[test]]
name = "nip09_holding_db"
path = "tests/lifecycle/nip09_holding_db.rs"
[[test]]
name = "nip09_multi_maintainer"
path = "tests/lifecycle/nip09_multi_maintainer.rs"
[[test]]
name = "nip09_recovery"
path = "tests/lifecycle/nip09_recovery.rs"
[[test]]
name = "nip09_state_cascade"
path = "tests/lifecycle/nip09_state_cascade.rs"
[[test]]
name = "nip09_state_multi_maintainer"
path = "tests/lifecycle/nip09_state_multi_maintainer.rs"
[[test]]
name = "nip09_validation"
path = "tests/lifecycle/nip09_validation.rs"
[[test]]
name = "deletion_request_retention"
path = "tests/lifecycle/deletion_request_retention.rs"
[[test]]
name = "nip62_lifecycle"
path = "tests/lifecycle/nip62_lifecycle.rs"
[[test]]
name = "nip62_validation"
path = "tests/lifecycle/nip62_validation.rs"
[[test]]
name = "replaceable_history"
path = "tests/lifecycle/replaceable_history.rs"
[workspace]
members = [".", "grasp-audit"]