Skip to content

fix(auth): bound SimplifiedFetchTransport reqwest client + disable idle pool - #5

Merged
Calgooon merged 3 commits into
mainfrom
fix/brc104-transport-timeout
May 26, 2026
Merged

Calgooon merged 3 commits into
mainfrom
fix/brc104-transport-timeout

Conversation

@Calgooon

Copy link
Copy Markdown
Contributor

SimplifiedFetchTransport::new built reqwest::Client::new() — no timeout, no connect-timeout, default keep-alive pool. On an egress-NAT'd host (e.g. a Cloudflare Container) the NAT silently drops the idle pooled socket; reqwest then reuses a half-dead connection and the next BRC-104 General POST (/sendMessage) hangs indefinitely (nothing breaks the hang).

This wedged the deployed bsv-mpc cosigner's reshare-over-relay round-1 ship. Fix: build the client with timeout(30s) + connect_timeout(10s) + pool_max_idle_per_host(0) so a dropped keep-alive forces a fresh connection instead of a hang.

Validated: cargo build/clippy --features auth,http clean; the downstream bsv-mpc #40 recovery gate passed on mainnet with this pinned (TXID f8b51458…).

Calgooon and others added 2 commits May 23, 2026 14:31
Additive, behavior-compatible counterpart to `encrypt`: same AES-256-GCM,
same 32-byte-IV convention, same `IV(32) || ciphertext || authTag(16)` layout
as @bsv/sdk (TS) and go-sdk — the ONLY difference is the caller supplies the
IV instead of it being random. Output is byte-identical to what `encrypt`
(or any conformant SDK) would produce for the same IV, and decrypts under
every SDK's `decrypt`. The canonical `encrypt`/`decrypt` are byte-for-byte
unchanged.

Enables deterministic cross-impl ciphertext byte-lock (MPC-Spec §06.16 /
bsv-mpc#23): the IV is otherwise the only nondeterminism. Documented test-only
(GCM IV reuse is catastrophic; production uses random-IV `encrypt`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…le pool

Egress-NAT'd hosts (Cloudflare Containers) silently drop idle keep-alive
sockets; reqwest's default pool reused a half-dead connection and the next
BRC-104 General POST (/sendMessage) hung indefinitely (Client::new sets no
timeout). Add request + connect timeouts and pool_max_idle_per_host(0) so a
dropped keep-alive forces a fresh connection instead of a hang.

Fixes the deployed bsv-mpc cosigner reshare-over-relay stall (#58).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-existing on main: cargo doc -Dwarnings failed on an unresolved `[encrypt]`
intra-doc link (now `[encrypt](Self::encrypt)`) and rustfmt flagged the file.
Unblocks CI on this branch; unrelated to the transport fix.
@Calgooon
Calgooon merged commit 915596b into main May 26, 2026
11 checks passed
@Calgooon Calgooon mentioned this pull request May 26, 2026
@Calgooon
Calgooon deleted the fix/brc104-transport-timeout branch May 26, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant