Skip to content

test(proto): keep test connections on their initial keys - #798

Open
n0-grookie wants to merge 1 commit into
n0-computer:mainfrom
n0-grookie:test/no-autonomous-key-updates
Open

test(proto): keep test connections on their initial keys#798
n0-grookie wants to merge 1 commit into
n0-computer:mainfrom
n0-grookie:test/no-autonomous-key-updates

Conversation

@n0-grookie

@n0-grookie n0-grookie commented Sep 4, 2026

Copy link
Copy Markdown

Description

Every connection starts with a short first key phase — 10..1000 packets, drawn at random in CryptoState::new — so that peers which mishandle key updates fail early. In a test that is not about key updates, that is an unscheduled event with consequences: it arms a KeyDiscard timer shortly afterwards, at a point the test cannot predict. That is what made tests::multipath::open_path_validation_fails_server_side fail intermittently in the daily CI runs, which #797 fixes for that one test.

flub suggested in that review that the harness should not be subject to key updates at all, and matheus23 agreed it should be its own PR. ConnPairBuilder now sets TransportConfig::initial_key_phase_size to a size no test reaches, so a built pair stays on its initial keys, with with_key_update() to opt back in. Pair::seeded() is left alone, so the proptests keep exercising the autonomous update.

API Changes

None, test changes only. The knob is a #[cfg(test)] field on TransportConfig, alongside deterministic_packet_numbers.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All API changes documented.
  • This PR was created by a human that thought critically about the
    proposed change and wrote an as clear and concise description as
    they could.
  • This PR isn't slop, and is carefully crafted to have the intended effect.
  • cargo make passes locally.

A fresh connection picks its first key phase at random (10..1000 packets) so that peers which
mishandle key updates fail early rather than late. For a test that is not about key updates that is
an unscheduled event: the update arms a KeyDiscard timer shortly after, at a point no test can
predict. It is what made open_path_validation_fails_server_side fail in the daily runs, where the
test was waiting for a PathIdle timer 8s out (PR n0-computer#797).

ConnPairBuilder now sets TransportConfig::initial_key_phase_size to a size no test reaches, so a
built pair keeps its initial keys, and with_key_update() opts back in. Pair::seeded() is left alone,
so the proptests and the random-interaction harness keep the autonomous update in the mix.
@n0bot n0bot Bot added this to iroh Sep 4, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant