Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
anvil --version
forge --version
- name: Run E2E tests (serial)
run: cargo test -p ant-core --features test-utils --test e2e_chunk --test e2e_data --test e2e_file --test e2e_payment --test e2e_security --test e2e_cost_estimate -- --test-threads=1
run: cargo test -p ant-core --features test-utils --test e2e_chunk --test e2e_data --test e2e_file --test e2e_payment --test e2e_security --test e2e_cost_estimate --test e2e_adr0004 -- --test-threads=1

test-merkle:
name: Merkle E2E (${{ matrix.os }})
Expand Down
25 changes: 11 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
[workspace]
members = ["ant-core", "ant-cli"]
resolver = "2"

# ─── TEMPORARY: STRIP BEFORE MERGE — ADR-0004/0005 coordinated cutover ───
# The ADR-0004 commitment-bound-quote types (signed `committed_key_count`/
# `commitment_pin`, the commitment sidecar) and the ADR-0005 audit-report wire
# types are not yet published to crates.io, so this workspace cannot build
# against the published `ant-protocol`/`evmlib`. These git patches point those
# deps at their PR branches so CI can build the coordinated change.
#
# AT RELEASE (once the ADR-0004/0005 versions are published, in order
# evmlib → ant-protocol):
# 1. delete this entire [patch.crates-io] block, AND
# 2. bump the `ant-protocol` pin in ant-core/Cargo.toml to the published
# version (evmlib is re-exported through ant-protocol, no direct pin):
# ant-protocol = "2.3.0" # <- published ant-protocol
# # (which in turn depends on the published evmlib = "0.9.0")
[patch.crates-io]
evmlib = { git = "https://github.com/WithAutonomi/evmlib", branch = "adr-0003-signed-quote-fields" }
# ADR-0005 audit-report wire types (github.com/WithAutonomi/ant-protocol/pull/19),
# based on the ADR-0004 protocol branch and pinning the published evmlib 0.9.0.
ant-protocol = { git = "https://github.com/grumbach/ant-protocol", branch = "adr-0005-earned-reward-eligibility" }
6 changes: 3 additions & 3 deletions ant-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tower-http = { version = "0.6.8", features = ["cors"] }
# under `ant_protocol::{evm, transport, pqc}`. This is the ONE pin for
# those three deps — do not add direct evmlib/saorsa-core/saorsa-pqc
# deps here or the version can skew between ant-client and ant-node.
ant-protocol = "2.2.2"
ant-protocol = "2.3.0"
xor_name = "5"
self_encryption = "0.36"
futures = "0.3"
Expand Down Expand Up @@ -65,7 +65,7 @@ sysinfo = { version = "0.32", default-features = false, features = ["system"] }
# `ant-protocol` pin above points at a git branch, this ant-node must point at
# the matching ant-node branch carrying the same saorsa-core / ant-protocol
# lineage rather than a released version.
ant-node = { version = "0.14.2", optional = true }
ant-node = { git = "https://github.com/grumbach/ant-node", branch = "adr-0005-earned-reward-eligibility", optional = true }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[target.'cfg(unix)'.dependencies]
Expand Down Expand Up @@ -96,7 +96,7 @@ test-utils = []
# always compile even without the `devnet` feature. Pinned to the same
# version as the runtime dep so there is a single ant-node /
# saorsa-core version across the whole graph.
ant-node = { version = "0.14.2", features = ["test-utils"] }
ant-node = { git = "https://github.com/grumbach/ant-node", branch = "adr-0005-earned-reward-eligibility", features = ["test-utils"] }
serial_test = "3"
anyhow = "1"
alloy = { version = "1.6", features = ["node-bindings"] }
Expand Down
4 changes: 3 additions & 1 deletion ant-core/examples/bench-quoting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ async fn bench_normal_once(client: &Client, rep: usize) -> Rep {
address,
data_size: 1024,
data_type: 0,
report_nonce: [0u8; 32],
}),
};
let bytes = match msg.encode() {
Expand Down Expand Up @@ -509,6 +510,7 @@ async fn bench_merkle_once(client: &Client, rep: usize, concurrency: usize) -> R
data_type: 0,
data_size: 1024,
merkle_payment_timestamp,
report_nonce: [0u8; 32],
}),
};
let bytes = match msg.encode() {
Expand All @@ -531,7 +533,7 @@ async fn bench_merkle_once(client: &Client, rep: usize, concurrency: usize) -> R
&addrs_clone,
|body| match body {
ChunkMessageBody::MerkleCandidateQuoteResponse(
MerkleCandidateQuoteResponse::Success { candidate_node },
MerkleCandidateQuoteResponse::Success { candidate_node, .. },
) => match rmp_serde::from_slice::<MerklePaymentCandidateNode>(
&candidate_node,
) {
Expand Down
19 changes: 18 additions & 1 deletion ant-core/src/data/client/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ pub struct PreparedChunk {
pub payment: SingleNodePayment,
/// Peer quotes for building `ProofOfPayment`.
pub peer_quotes: Vec<(EncodedPeerId, PaymentQuote)>,
/// ADR-0004: the signed commitments the bound quotes shipped, forwarded as
/// sidecars in the PUT bundle so storers cross-check synchronously. Empty
/// when every quote was baseline (no commitment to pin).
pub commitment_sidecars: Vec<Vec<u8>>,
}

/// Chunk paid but not yet stored. Produced by [`Client::batch_pay`].
Expand Down Expand Up @@ -210,6 +214,9 @@ fn build_paid_chunks(
peer_quotes: chunk.peer_quotes,
},
tx_hashes,
// ADR-0004: forward the bound quotes' commitments so storers
// cross-check synchronously; stripped before persistence node-side.
commitment_sidecars: chunk.commitment_sidecars,
};

let proof_bytes = serialize_single_node_proof(&proof)
Expand Down Expand Up @@ -272,11 +279,17 @@ impl Client {
// Use node-reported prices directly — no contract price fetch needed.
let mut peer_quotes = Vec::with_capacity(quotes_with_peers.len());
let mut quotes_for_payment = Vec::with_capacity(quotes_with_peers.len());
// ADR-0004: forward each bound quote's commitment sidecar (baseline
// quotes ship none); `get_store_quotes` already verified the binding.
let mut commitment_sidecars = Vec::new();

for (peer_id, _addrs, quote, price) in quotes_with_peers {
for (peer_id, _addrs, quote, price, commitment) in quotes_with_peers {
let encoded = peer_id_to_encoded(&peer_id)?;
peer_quotes.push((encoded, quote.clone()));
quotes_for_payment.push((quote, price));
if let Some(sidecar) = commitment {
commitment_sidecars.push(sidecar);
}
}

let payment = SingleNodePayment::from_quotes(quotes_for_payment)
Expand All @@ -288,6 +301,7 @@ impl Client {
quoted_peers,
payment,
peer_quotes,
commitment_sidecars,
}))
}

Expand Down Expand Up @@ -1095,6 +1109,7 @@ mod tests {
quoted_peers: Vec::new(),
payment: SingleNodePayment { quotes },
peer_quotes: Vec::new(),
commitment_sidecars: Vec::new(),
}
}

Expand Down Expand Up @@ -1206,6 +1221,8 @@ mod tests {
rewards_address: RewardsAddress::new([1u8; 20]),
pub_key: vec![],
signature: vec![],
committed_key_count: 0,
commitment_pin: None,
};
(EncodedPeerId::from([i as u8; 32]), quote)
})
Expand Down
Loading