python: add new pigeonhole API#43
Merged
Merged
Conversation
This reverts commit ab419d4.
…cancel tests - Add error codes 14-24 to Rust thin client (matching Go daemon) - Fix Python error strings for codes 19/20 to match Go - Add unit test for error code completeness (no daemon required) - Add integration tests for cancel_resending
- Add PigeonholeGeometry to ConfigFile and Config structs - Fix serde rename to use MaxPlaintextPayloadLength (matching Go) - Add ThinClient::pigeonhole_geometry() accessor method - Update testdata config to match generated mixnet config - Fix tombstone tests to use geometry from config instead of hardcoded values
The replica_epoch is already embedded in the EnvelopeDescriptor, making the parameter redundant. - Python: Remove replica_epoch from encrypt_read, encrypt_write, start_resending_encrypted_message, and tombstone_box - Rust: Remove replica_epoch from structs and function signatures - Tests: Update all call sites to use new API signatures - Fix cancel tests: Reduce sleep time to 0.1s to call cancel before mixnet ACK arrives
Expand the thinnest method docstrings on ThinClient (new_message_id, new_surb_id, new_query_id, pki_document, is_connected, get_service) to include # Arguments / # Errors sections where relevant, and document the distinction between "daemon connected" and "daemon connected to mixnet". Add doc comments to the previously-undocumented ThinClientError variants (IoError, CborError, ConnectError, MissingPkiDocument, ServiceNotFound, OfflineMode, Timeout, Other), so each variant's docs.rs entry explains when it is produced rather than being empty. No API or behaviour changes.
Expand the thinnest method docstrings on ThinClient (is_connected, pki_document, get_service, new_message_id, new_surb_id, new_query_id) to explain when each error is raised and document the distinction between "daemon connected" and "daemon connected to mixnet". No API or behaviour changes.
Introduces a new katzenpost_thinclient.transport package with UnixDialConfig / TcpDialConfig dataclasses and a DialConfig discriminator matching the Go reference. ConfigFile.load() now parses [Dial.Unix] / [Dial.Tcp] subtables rather than flat Network/Address fields; ThinClient resolves the dialer via DialConfig.resolve() rather than dispatching on a lowercased network string. No protocol changes — the thin-client wire format (4-byte BE length prefix + CBOR) is unchanged. Integration tests against the refactored Go kpclientd pass end-to-end.
Introduces src/transport/ with a Dialer trait and subtable-
discriminated DialConfig { unix, tcp }, mirroring the Go reference and
Python port. ConfigFile.load and Config::new parse [Dial.Unix] /
[Dial.Tcp] subtables rather than flat Network/Address fields;
ThinClient::new and its reconnect path resolve the dialer through
DialConfig::dial() rather than matching on a lowercased network
string.
No protocol changes — the thin-client wire format (4-byte BE length
prefix + CBOR) is unchanged. 13 lib unit tests cover DialConfig
validation and subtable parsing; 23 integration tests against the
refactored Go kpclientd pass end-to-end.
The recent transport modularisation changed the thinclient config format (flat Network/Address keys → [Dial.Unix]/[Dial.Tcp] subtables). Old configs were silently accepted, producing surprising failures later in mixnet operations rather than a clear error at load time. Rust: add serde(deny_unknown_fields) to ConfigFile, DialConfig, UnixDialConfig, TcpDialConfig, Geometry, and PigeonholeGeometry so any unknown or misspelled key fails the TOML parse with a pinpointed line/column diagnostic. Python: introduce ConfigError; rewrite ConfigFile.load with explicit checks for unknown / missing top-level keys, type-validate each subtable, and reject unknown keys within [Dial], [Dial.Unix], [Dial.Tcp], and [PigeonholeGeometry]. Also load PigeonholeGeometry (previously silently dropped) and expose it on Config. Replace the assert on SphinxGeometry shape (disabled under python -O) with an explicit raise.
The parallel-heavy thin_client CI (pytest -n 5 alongside cargo test --test-threads=5) pushes enough concurrent load at the 3-service-node docker mixnet that multi-chunk copy flows occasionally exceed 30s for their temp-stream boxes to propagate and become shard-readable. Raise the ten post-write / post-copy sleeps in test_new_pigeonhole_api.py from 30s to 45s. Shorter polling sleeps (1s/5s/10s) and the one pre-existing 60s sleep are untouched. Sends remain ARQ-backed; this bump is strictly propagation-wall- clock slack, not a workaround for a dropped send.
Mirror the daemon's GetMessageBoxIndexCounter request added in katzenpost commit 66891b7e. Callers that persist MessageBoxIndex blobs across sessions (katzenqt is the current example) can now read the BACAP Idx64 counter through the thin client instead of peeking at the first 8 bytes of the blob themselves — the layout (little-endian uint64) is an hpqc/bacap implementation detail the thin client should not rely on. pigeonhole.py grows `get_message_box_index_counter(mbi) -> int`, shaped symmetrically with `next_message_box_index`. __init__.py imports and attaches it to ThinClient alongside the other pigeonhole helpers. Smoke-verified by importing katzenpost_thinclient and asserting ThinClient.get_message_box_index_counter is bound.
Mirrors d71f4d2 on the python side.
genkey emits caps; send streams a CBOR FileMetaData header followed by file bytes; receive reverses it. Behind the cli feature.
Round-trips a 4 KiB file across three boxes.
aa8e89b to
2995a6f
Compare
2995a6f to
fe379bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.