Skip to content

Depend on ant-protocol; make ant-node optional; ant-core 0.2.0#45

Open
grumbach wants to merge 2 commits intomainfrom
anselme/extract-ant-protocol
Open

Depend on ant-protocol; make ant-node optional; ant-core 0.2.0#45
grumbach wants to merge 2 commits intomainfrom
anselme/extract-ant-protocol

Conversation

@grumbach
Copy link
Copy Markdown
Contributor

Summary

Replace the runtime ant-node = "0.10.0" dep with ant-protocol = "2". Make ant-node optional (behind the devnet feature, only for LocalDevnet) and a dev-dep (for the test harness that spins up real nodes). ant-node is no longer in the default runtime tree of ant-core.

This is the change Nic asked for: a client-only optimisation can now ship without a coordinated ant-node release.

Paired with WithAutonomi/ant-node#73 and the ant-protocol 2.0.0 publish.

Version pinning policy

ant-core now has no direct deps on evmlib, saorsa-core, or saorsa-pqc. Everything goes through ant_protocol::{evm, transport, pqc}. This guarantees Cargo sees one version constraint for each of those crates and cannot split into two incompatible copies between client and node.

Changes

  • ant-core/Cargo.toml: drop direct evmlib / ant-node / saorsa-pqc deps. Add ant-protocol = "2". Add ant-node = { version = "0.11", optional = true } and [features] devnet = ["dep:ant-node"]. ant-node remains a dev-dep for tests/support/mod.rs.
  • ant-core/src/**: every ant_node::* / evmlib::* / saorsa_*::* import rewritten to the ant_protocol::* equivalent.
  • ant-core/src/data/mod.rs: DevnetManifest now from ant_protocol (always available); LocalDevnet gated behind devnet.
  • ant-core/src/data/error.rs: drop impl From<ant_node::Error>; LocalDevnet maps node errors inline.
  • ant-core/src/node/mod.rs: pub mod devnet behind #[cfg(feature = "devnet")].

⚠️ [patch.crates-io] — REMOVE BEFORE MERGE

The workspace Cargo.toml currently has:

[patch.crates-io]
ant-protocol = { path = "../ant-protocol" }
ant-node = { path = "../ant-node" }

This is for local testing until ant-protocol 2.0.0 and ant-node 0.11.0 are published. Must be removed before merge — the version pins in ant-core/Cargo.toml (ant-protocol = "2", ant-node = "0.11") will then resolve from crates.io.

Verification

  • cargo fmt --all -- --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo test --lib --all: 135/135 passing
  • cargo test -p ant-core --test unit_self_encrypt --test merkle_unit: 16/16
  • cargo test -p ant-core --test daemon_integration --test node_add_integration: passing
  • cargo build --no-default-features: clean, ant-node absent from runtime tree (confirmed via cargo tree)
  • cargo tree -p ant-core --features devnet: ant-node appears as expected
  • cargo doc --all-features --no-deps builds

Test plan

  • CI green on main merge
  • ant-node 0.11.0 and ant-protocol 2.0.0 published before merge
  • [patch.crates-io] removed from workspace Cargo.toml before merge
  • Full E2E suite (including Anvil-backed merkle tests) green

Release

ant-core 0.2.0 (minor bump — ant-node runtime dep is gone, which is technically breaking for consumers that used LocalDevnet without opting in; DevnetManifest moved from ant-node re-export to ant-protocol re-export at the same public path).

🤖 Generated with Claude Code

@grumbach grumbach force-pushed the anselme/extract-ant-protocol branch 2 times, most recently from af686c5 to 27032b9 Compare April 17, 2026 08:32
@grumbach
Copy link
Copy Markdown
Contributor Author

Force-pushed fixes for adversarial review

Re-authored commit (grumbach <anselmega@gmail.com>) and folded the review fixes in.

BLOCKERs addressed:

  • Example didn't compile without --features devnet. Added required-features = ["devnet"] to the [[example]] block. cargo check -p ant-core --examples is now a no-op by default and only builds when --features devnet is passed.
  • CHANGELOG.md added at ant-core/CHANGELOG.md with the full set of breaking changes, including the removed From<ant_node::Error>, the feature-gated LocalDevnet, the Client::with_evm_network signature change, and the DevnetManifest origin crate switch.
  • Publish gating. The [patch.crates-io] in the workspace Cargo.toml stays (needed for local dev), and this PR's body now makes explicit: the patch must be removed before cargo-core-v0.2.0 is tagged, after ant-protocol 2.0.0 and ant-node 0.11.0 are on crates.io.

MAJORs addressed:

  • Dead test-utils reference in ant-core/Cargo.toml comment — fixed.
  • Doc-string drift in src/data/client/payment.rs, src/data/network.rs, src/node/devnet.rs — now all reference ant_protocol::{transport, evm} correctly instead of ant-node.

Discussed but not changed (with reasoning):

  • Dev-dep ant-node under cargo test --no-default-features — accepted. The test harness at tests/support/mod.rs spins up real nodes in-process to exercise the wire protocol end-to-end; that legitimately needs ant-node's LmdbStorage, PaymentVerifier, QuoteGenerator. Moving this behind an additional feature flag would fragment the test story without buying meaningful isolation. Default-feature runtime builds do not pull ant-node, which is what matters for downstream consumers.
  • Version pin on ant-protocol — kept at "2" (caret). Downstream ant-core doesn't need pinning to 2.0.x specifically; consumers who do want strict pinning still have Cargo.lock.
  • Optional runtime + dev-dep on ant-node unifying — confirmed Cargo resolves to one compiled copy (single ant-node v0.11.0 in cargo tree). This is the desired behaviour.

Verification:

  • cargo fmt --all -- --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo test --lib --all: 135/135 passing
  • Fast integration tests (unit_self_encrypt, merkle_unit, daemon_integration, node_add_integration): passing
  • Anvil-backed E2E suite (e2e_chunk, e2e_data, e2e_file, e2e_payment, e2e_security): run locally with 2 known-flake reruns (unrelated to this PR — network timing + Anvil transport NullResp).
  • Dep-graph verification:
    • cargo tree -p ant-core --edges=normalant-node not present (confirmed 0 matches).
    • cargo tree -p ant-core --edges=normal --features devnetant-node v0.11.0 appears at depth 1 as expected.
    • cargo tree -p ant-core --edges=devant-node v0.11.0 present for test builds.
    • cargo tree -p ant-node | grep ant-client → 0 matches. Node does not depend on client.

Dep-graph policy: ant-core has no direct deps on evmlib, saorsa-core, or saorsa-pqc (all via ant_protocol::{evm, transport, pqc}). ant-node still has direct saorsa-core for node-internal DHT types — Cargo unifies the version because both declarations must match ant-protocol's pin.

Blocks on:

  1. ant-protocol 2.0.0 published to crates.io.
  2. ant-node 0.11.0 published to crates.io.
  3. [patch.crates-io] removed from workspace Cargo.toml.

🤖 Generated with Claude Code

@grumbach grumbach force-pushed the anselme/extract-ant-protocol branch 2 times, most recently from e01d3d5 to e169816 Compare April 17, 2026 09:27
…o 0.2.0

Switch ant-core's runtime dependencies from ant-node (0.10.0) to
ant-protocol (2.0.0). ant-node becomes an optional dependency gated
behind the new `devnet` feature, used only by the LocalDevnet wrapper
that spins up an in-process network for development and testing.

This is the change that lets a client-only optimisation ship without
a corresponding ant-node release. Before: ant-core pulled ant-node at
runtime, so every client release forced a coordinated node release.
After: the wire types live in ant-protocol; ant-node only comes in
when you explicitly opt into LocalDevnet.

Changes:

- ant-core/Cargo.toml: drop direct evmlib / ant-node / saorsa-pqc
  runtime deps. Add ant-protocol = "2" as the single pin. ant-node
  moves to an optional dep behind `devnet` feature. ant-node remains
  a dev-dep for tests/support/mod.rs which spins up real nodes.
- Workspace root: [patch.crates-io] points ant-protocol and ant-node
  at local sibling checkouts during development. Remove once both
  crates are published.

- src/data/**: every use of ant_node::* rewritten to its ant_protocol
  equivalent. evmlib / saorsa-core / saorsa-pqc paths go through
  ant_protocol::{evm, transport, pqc} so ant-core has no direct deps
  on those crates (single-version-pin policy).
- src/data/mod.rs: DevnetManifest comes from ant_protocol (always
  available); LocalDevnet gated behind `devnet` feature.
- src/data/error.rs: drop `impl From<ant_node::Error> for Error`;
  LocalDevnet maps node errors inline via map_err.
- src/node/mod.rs: `pub mod devnet` gated behind `devnet` feature.
- src/node/devnet.rs: imports switched to ant_protocol::{evm, transport}.

- tests/: same rewrite. tests/support/mod.rs keeps a direct ant-node
  dep (dev-only) for PaymentVerifier / QuoteGenerator / LmdbStorage
  — the test harness needs to *be* a node.

Version pinning policy in ant-core:

- NO direct deps on evmlib, saorsa-core, or saorsa-pqc. Go through
  ant_protocol::{evm, transport, pqc}. This guarantees Cargo sees
  one version constraint and can't split into two copies between
  ant-client and ant-node.

Verification:

- cargo fmt --all -- --check: clean
- cargo clippy --all-targets --all-features -- -D warnings: clean
- cargo test --lib --all: 135/135 passing
- cargo test -p ant-core --test unit_self_encrypt --test merkle_unit: 16/16
- cargo test -p ant-core --test daemon_integration --test node_add_integration: passing
- cargo build --no-default-features: clean (ant-node NOT in runtime tree)
- cargo tree -p ant-core: ant-node absent; ant-protocol is the single wire dep
- cargo tree -p ant-core --features devnet: ant-node appears as expected
- cargo doc --all-features --no-deps: builds
@grumbach grumbach force-pushed the anselme/extract-ant-protocol branch from e169816 to fc98597 Compare April 17, 2026 09:39
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