Extract wire protocol to ant-protocol; bump to 0.11.0#73
Extract wire protocol to ant-protocol; bump to 0.11.0#73
Conversation
There was a problem hiding this comment.
Pull request overview
This PR decouples ant-client and ant-node release cycles by moving the shared wire-protocol surface into a new ant-protocol crate, and turning the existing in-crate protocol/payment types into thin re-export shims.
Changes:
- Add
ant-protocolas a dependency and bumpant-nodeto0.11.0. - Replace in-crate implementations of wire protocol + client protocol helpers + payment proof/single-node/verify helpers with re-exports from
ant-protocol. - Update internal imports/tests to use the new
ant_protocol::…locations.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/storage/handler.rs | Updates test import to use verification helper from ant-protocol. |
| src/payment/verifier.rs | Switches quote verification helper imports to ant-protocol. |
| src/payment/single_node.rs | Replaces implementation with re-exports from ant-protocol. |
| src/payment/quote.rs | Removes wire-side verification helpers from node crate; keeps node-side signing; tests import verifiers from ant-protocol. |
| src/payment/proof.rs | Replaces proof serialization implementation with re-exports from ant-protocol. |
| src/payment/mod.rs | Re-exports wire-side verification helpers from ant-protocol for compatibility. |
| src/devnet.rs | Moves devnet manifest types to ant-protocol and re-exports them. |
| src/client/mod.rs | Re-exports client protocol helpers/types from ant-protocol (and removes local modules). |
| src/client/data_types.rs | Deleted (moved to ant-protocol). |
| src/client/chunk_protocol.rs | Deleted (moved to ant-protocol). |
| src/ant_protocol/mod.rs | Replaces in-crate wire-protocol implementation with ant-protocol re-exports. |
| src/ant_protocol/chunk.rs | Deleted (moved to ant-protocol). |
| Cargo.toml | Bumps version and adds ant-protocol dependency. |
| Cargo.lock | Updates lockfile for 0.11.0 and adds ant-protocol 2.0.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pub use ant_protocol::chunk::{ | ||
| ChunkGetRequest, ChunkGetResponse, ChunkMessage, ChunkMessageBody, ChunkPutRequest, | ||
| ChunkPutResponse, ChunkQuoteRequest, ChunkQuoteResponse, MerkleCandidateQuoteRequest, | ||
| MerkleCandidateQuoteResponse, ProtocolError, XorName, CHUNK_PROTOCOL_ID, DATA_TYPE_CHUNK, | ||
| MAX_CHUNK_SIZE, MAX_WIRE_MESSAGE_SIZE, PROOF_TAG_MERKLE, PROOF_TAG_SINGLE_NODE, | ||
| PROTOCOL_VERSION, XORNAME_LEN, | ||
| MerkleCandidateQuoteResponse, ProtocolError, XorName, CHUNK_PROTOCOL_ID, CLOSE_GROUP_MAJORITY, | ||
| CLOSE_GROUP_SIZE, DATA_TYPE_CHUNK, MAX_CHUNK_SIZE, MAX_WIRE_MESSAGE_SIZE, PROOF_TAG_MERKLE, | ||
| PROOF_TAG_SINGLE_NODE, PROTOCOL_VERSION, XORNAME_LEN, | ||
| }; |
There was a problem hiding this comment.
crate::ant_protocol previously exposed a chunk submodule (crate::ant_protocol::chunk::…). This file now only re-exports items from ant_protocol::chunk, so any downstream code importing via ant_node::ant_protocol::chunk::ChunkMessage (or similar) will stop compiling. If backwards compatibility is intended, re-export the module itself (e.g., pub use ant_protocol::chunk;) or add a pub mod chunk { pub use ant_protocol::chunk::*; } shim in addition to the item re-exports.
| // in `ant_protocol::payment::verify`. Re-exported from | ||
| // `crate::payment` for backwards compatibility. |
There was a problem hiding this comment.
The wire-side verification helpers were removed from this module, so ant_node::payment::quote::verify_quote_content / verify_quote_signature / verify_merkle_candidate_signature no longer exist. Since quote is still a public module, this is a public API break for downstream callers that used the module-qualified paths. If compatibility is required, re-export these helpers from within payment::quote as well (or add thin wrapper fns), not only from crate::payment.
| // in `ant_protocol::payment::verify`. Re-exported from | |
| // `crate::payment` for backwards compatibility. | |
| // in `ant_protocol::payment::verify`. Re-export here as well as from | |
| // `crate::payment` so the historical `crate::payment::quote::*` paths | |
| // remain available for downstream callers. | |
| pub use ant_protocol::payment::verify::{ | |
| verify_merkle_candidate_signature, | |
| verify_quote_content, | |
| verify_quote_signature, | |
| }; |
203a98a to
216b25f
Compare
216b25f to
9c228be
Compare
Force-pushed fixes for adversarial reviewRe-authored commit ( BLOCKERs addressed:
MAJORs addressed:
MINORs not addressed (and why):
Verification:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # | ||
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The git ref is the tagged `main` commit at the time of this PR and | ||
| # stays byte-for-byte identical to what will be published. | ||
| ant-protocol = { path = "../ant-protocol", version = "2.0.0" } |
There was a problem hiding this comment.
ant-protocol is specified as a path dependency to ../ant-protocol, but this repository does not contain that sibling directory. In CI (where only this repo is checked out), cargo build/test will fail to resolve the dependency. Switch to a crates.io dependency (ant-protocol = "2.0.0") once published, or temporarily use a git dependency (with a pinned rev/tag) instead of a local path outside the repo.
| # | |
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | |
| # The git ref is the tagged `main` commit at the time of this PR and | |
| # stays byte-for-byte identical to what will be published. | |
| ant-protocol = { path = "../ant-protocol", version = "2.0.0" } | |
| ant-protocol = "2.0.0" |
| # The git ref is the tagged `main` commit at the time of this PR and | ||
| # stays byte-for-byte identical to what will be published. |
There was a problem hiding this comment.
The comment above the ant-protocol dependency mentions using a "git ref" / "tagged main commit", but the manifest currently uses a local path dependency. Please update the comment to match the actual dependency strategy (path vs git vs crates.io) to avoid confusion during release/publish steps.
| # The git ref is the tagged `main` commit at the time of this PR and | |
| # stays byte-for-byte identical to what will be published. | |
| # For now this uses a local path dependency during development/release | |
| # coordination; keep the version in sync with what will be published. |
9c228be to
2df0b37
Compare
2df0b37 to
0ee4ba9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # | ||
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The git ref is the tagged `main` commit at the time of this PR and | ||
| # stays byte-for-byte identical to what will be published. | ||
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The pinned commit matches the current `WithAutonomi/ant-protocol` main. | ||
| ant-protocol = { git = "https://github.com/WithAutonomi/ant-protocol", rev = "597dbdb1b680a43d80a082d77076ff2080444079" } |
There was a problem hiding this comment.
ant-protocol is currently pulled via a git dependency. If ant-node is intended to be published to crates.io as 0.11.0, cargo publish will fail because published crates cannot depend on git (or path) dependencies. Please switch this to a crates.io version requirement (e.g. 2.0.0) before merge/release, and if you still need the pinned revision for development, consider using a temporary [patch.crates-io] override in a non-published workspace context instead.
| # | |
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | |
| # The git ref is the tagged `main` commit at the time of this PR and | |
| # stays byte-for-byte identical to what will be published. | |
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | |
| # The pinned commit matches the current `WithAutonomi/ant-protocol` main. | |
| ant-protocol = { git = "https://github.com/WithAutonomi/ant-protocol", rev = "597dbdb1b680a43d80a082d77076ff2080444079" } | |
| ant-protocol = "2.0.0" |
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The pinned commit matches the current `WithAutonomi/ant-protocol` main. |
There was a problem hiding this comment.
The TODO: swap to ant-protocol = "2.0.0" once 2.0.0 is on crates.io. note appears twice in a row. Could you remove the duplicate to keep the dependency block concise and avoid confusion about whether there are two separate follow-ups?
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | |
| # The pinned commit matches the current `WithAutonomi/ant-protocol` main. |
Move the wire contract (chunk messages, data types, chunk_protocol
helper, payment proof + single-node payment + signature verification)
into the new ant-protocol crate so ant-client and ant-node can ship
on independent release cycles.
Kept as thin re-export shims at the same paths for backwards
compatibility:
- ant_node::ant_protocol::* -> ant_protocol::chunk::*
- ant_node::client::* -> ant_protocol::data_types / chunk_protocol
- ant_node::payment::proof -> ant_protocol::payment::proof
- ant_node::payment::single_node -> ant_protocol::payment::single_node
- ant_node::payment::{verify_quote_content, verify_quote_signature,
verify_merkle_candidate_signature} -> ant_protocol::payment::verify
Moved to ant-protocol (shared on-disk format, no node runtime needed
to read):
- DevnetManifest, DevnetEvmInfo -> ant_protocol::devnet_manifest
Node-only code stays:
- QuoteGenerator, wire_ml_dsa_signer (node signs quotes, client
verifies only)
- PaymentVerifier, CacheStats, pricing, EvmVerifierConfig (on-chain
verification state machine)
- LmdbStorage, AntProtocol handler (node-side storage)
- Devnet / NetworkSpawner (devnet lifecycle — client uses the
re-exported Devnet type via ant-node dev-dep)
Internal imports either kept as crate::ant_protocol::* (resolved
through the shim) or rewritten to import directly from ant_protocol
where that reads cleaner (verifier.rs, storage/handler.rs).
Verification:
- cargo fmt --all -- --check: clean
- cargo clippy --all-targets --all-features -- -D warnings: clean
- cargo test --lib: 445/445 passing
- cargo doc --all-features --no-deps: builds
0ee4ba9 to
dd07651
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Anything else — response messages are handled by client | ||
| // subscribers (e.g. send_and_await_chunk_response), not by the | ||
| // protocol handler. Returning None prevents the caller from | ||
| // sending a reply, which would create an infinite ping-pong | ||
| // loop. | ||
| // | ||
| // `ChunkMessageBody` is `#[non_exhaustive]` in ant-protocol, so | ||
| // a future wire variant added on a protocol minor bump also | ||
| // lands here and is dropped. The CHUNK_PROTOCOL_ID multistream- | ||
| // select handshake version-gates peers, so this arm should | ||
| // only be reached by a misconfigured peer. | ||
| _ => return Ok(None), |
There was a problem hiding this comment.
This _ => return Ok(None) arm now matches all response variants (PutResponse/GetResponse/…) as well as any future ChunkMessageBody variants. The current comment suggests it should only be reached by a misconfigured peer, but it will be hit for normal response traffic too, and it will also silently drop any future request variants (causing clients to hang until timeout). Consider binding the variant (e.g. other => …) and warn!-logging unexpected/unhandled variants (ideally distinguishing known responses vs truly unknown).
| // Anything else — response messages are handled by client | |
| // subscribers (e.g. send_and_await_chunk_response), not by the | |
| // protocol handler. Returning None prevents the caller from | |
| // sending a reply, which would create an infinite ping-pong | |
| // loop. | |
| // | |
| // `ChunkMessageBody` is `#[non_exhaustive]` in ant-protocol, so | |
| // a future wire variant added on a protocol minor bump also | |
| // lands here and is dropped. The CHUNK_PROTOCOL_ID multistream- | |
| // select handshake version-gates peers, so this arm should | |
| // only be reached by a misconfigured peer. | |
| _ => return Ok(None), | |
| // Response messages are handled by client-side subscribers | |
| // (e.g. send_and_await_chunk_response), not by the protocol | |
| // handler. Returning None prevents the caller from sending a | |
| // reply, which would create an infinite ping-pong loop. | |
| ChunkMessageBody::PutResponse(_) | |
| | ChunkMessageBody::GetResponse(_) | |
| | ChunkMessageBody::QuoteResponse(_) | |
| | ChunkMessageBody::MerkleCandidateQuoteResponse(_) => { | |
| debug!( | |
| "Ignoring chunk response message in protocol handler for request_id {}", | |
| request_id | |
| ); | |
| return Ok(None); | |
| } | |
| // `ChunkMessageBody` is `#[non_exhaustive]` in ant-protocol, so | |
| // future wire variants may exist. Log and ignore any unhandled | |
| // variant to avoid silently dropping unexpected traffic. | |
| other => { | |
| warn!( | |
| "Received unexpected/unhandled chunk message body variant in protocol handler for request_id {} (discriminant: {:?}); ignoring without reply", | |
| request_id, | |
| std::mem::discriminant(&other) | |
| ); | |
| return Ok(None); | |
| } |
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The git ref is the tagged `main` commit at the time of this PR and | ||
| # stays byte-for-byte identical to what will be published. | ||
| # TODO: swap to `ant-protocol = "2.0.0"` once 2.0.0 is on crates.io. | ||
| # The pinned commit matches the current `WithAutonomi/ant-protocol` main. | ||
| ant-protocol = { git = "https://github.com/WithAutonomi/ant-protocol", rev = "597dbdb1b680a43d80a082d77076ff2080444079" } |
There was a problem hiding this comment.
ant-node cannot be published to crates.io with a git dependency, and the PR description says the ant-protocol 2.0.0 publish should happen before merge. This should be switched to a crates.io version pin (e.g. ant-protocol = "2.0.0") before merging/releasing, and the duplicate TODO line should be removed.
The version bump to 0.11.0 and the new CHANGELOG entry were included as part of the ant-protocol extraction commit but shouldn't have landed on this branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Extract the wire-protocol surface shared with
ant-clientinto a newant-protocolcrate soant-clientandant-nodecan ship on independent release cycles. Before this,ant-clienthadant-nodeas a runtime dep — any client-only optimisation forced a coordinated node release. After this, the wire contract is its own crate andant-nodestops being a hard dep of the client.Paired with WithAutonomi/ant-client#extract-ant-protocol. Both PRs should land together with the
ant-protocol 2.0.0publish.What moves to ant-protocol
src/ant_protocol/*(chunk wire messages, constants,ProtocolError, proof tags,CLOSE_GROUP_SIZE)src/client/chunk_protocol.rs(send_and_await_chunk_response)src/client/data_types.rs(compute_address,xor_distance,DataChunk,XorName,peer_id_to_xor_name)src/payment/proof.rs(PaymentProof, proof serialization + type tags)src/payment/single_node.rs(SingleNodePayment— pay + verify co-located, per the evmlib policy)src/payment/quote.rs(verify_quote_content,verify_quote_signature,verify_merkle_candidate_signature)DevnetManifest+DevnetEvmInfo(pure-data POJOs — clients read the handoff file without needing the node runtime)What stays in ant-node
QuoteGenerator,wire_ml_dsa_signer(node signs quotes; client verifies only)PaymentVerifier,VerifiedCache, pricing,EvmVerifierConfig(on-chain verification state machine)LmdbStorage,AntProtocolhandler (node-side storage)Devnet/NetworkSpawner(devnet lifecycle — client pulls these via ant-node dev-dep when it wants aLocalDevnet)Backwards compatibility
All previous
ant_node::*paths still resolve via thin re-export shims:ant_node::ant_protocol::*→ant_protocol::chunk::*ant_node::client::*→ant_protocol::data_types/chunk_protocolant_node::payment::proof::*→ant_protocol::payment::proof::*ant_node::payment::single_node::*→ant_protocol::payment::single_node::*ant_node::payment::verify_*→ant_protocol::payment::verify::*ant_node::devnet::DevnetManifest→ant_protocol::devnet_manifest::DevnetManifestVerification
cargo fmt --all -- --checkcleancargo clippy --all-targets --all-features -- -D warningscleancargo test --lib: 445/445 passingcargo doc --all-features --no-depsbuildsTest plan
mainmergeant-clientPR merges atomically with this oneant-protocol 2.0.0published to crates.io before merge so theversion = "2.0.0"dep resolvesRelease
ant-node 0.11.0(minor bump — new dep, no public API break; all previous paths re-exported).🤖 Generated with Claude Code