Skip to content

Commit 0804cc7

Browse files
committed
fix(quote): count unversioned quote requests on arrival, and say so
The unversioned-quote counter is what ADR-0013 names as the input to the decision to retire the legacy quote path. It increments when the request arrives, before validation and before a quote is generated, so a request the node then refuses is counted too. The log line claimed the opposite, reporting a running total of quotes "served": a node turning away a thousand oversized unversioned requests would report having served a thousand quotes, and that number is meant to decide when the legacy path can be closed. Arrival is the right place to count. The question the number answers is how many clients still cannot declare a settlement version, and a client whose request failed for an unrelated reason is still one of them and would still break if the path were retired. So this renames the counter and rewords the log line to match where it fires, rather than moving the increment, and records the same in the ADR. No behavioural change.
1 parent 052ee3c commit 0804cc7

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

docs/adr/ADR-0013-settlement-version-and-pre-payment-compatibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ A refusal is a verdict about the client, not about one peer, so it cannot be tre
9696

9797
### Unversioned requests are still served
9898

99-
A storer cannot distinguish a client that settles correctly but predates the version field (ant-core 0.5.1 through 0.6.0) from one that does not. Refusing both would break clients that are behaving, so unversioned requests are served and counted. Nodes log a running total per path under `ant_node::quote::settlement`.
99+
A storer cannot distinguish a client that settles correctly but predates the version field (ant-core 0.5.1 through 0.6.0) from one that does not. Refusing both would break clients that are behaving, so unversioned requests are served and counted. Nodes log a running total per path under `ant_node::quote::settlement`. The count is taken on arrival rather than on a quote being returned: a request this node refuses for an unrelated reason still came from a client that cannot declare a version, and would still break if the unversioned path were retired.
100100

101101
Flipping that to a refusal is a **follow-up**, gated on that count decaying, and should use a dated self-retiring boundary in the style of `MERKLE_PARITY_ENFORCED_FROM_UNIX`.
102102

src/storage/handler.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,24 @@ impl Drop for GetRequestTelemetry {
211211
}
212212
}
213213

214-
/// How many unversioned quote requests to serve between adoption log lines.
214+
/// How many unversioned quote requests to receive between adoption log lines.
215215
///
216216
/// One line per request would drown the log at production quote rates, and one
217217
/// line total would say nothing about the trend. A running count emitted every
218218
/// `N` gives the shape of client adoption, which is the number that decides
219219
/// when unversioned requests can start being refused outright.
220220
const UNVERSIONED_QUOTE_LOG_INTERVAL: u64 = 1_000;
221221

222-
/// Unversioned quote requests served since start, by path.
222+
/// Unversioned quote requests received since start, by path.
223+
///
224+
/// Counted on arrival, before the quote is generated, because the question
225+
/// this answers is how many clients still cannot declare a version. A request
226+
/// this node then refuses for an unrelated reason still came from such a
227+
/// client, and would still break if the unversioned path were retired.
223228
///
224229
/// Indices are `[single_node, merkle]`. A plain counter rather than a metric
225230
/// because the only consumer is the rollout decision, and that reads logs.
226-
static UNVERSIONED_QUOTES_SERVED: [AtomicU64; 2] = [AtomicU64::new(0), AtomicU64::new(0)];
231+
static UNVERSIONED_QUOTE_REQUESTS: [AtomicU64; 2] = [AtomicU64::new(0), AtomicU64::new(0)];
227232

228233
/// Refuse a quote when the requesting client settles under rules this node no
229234
/// longer accepts. `None` means the request may proceed.
@@ -903,15 +908,16 @@ impl AntProtocol {
903908
/// the clients that were already going to lose their money.
904909
fn note_unversioned_quote(path: &str) {
905910
let slot = usize::from(path == "merkle");
906-
let Some(counter) = UNVERSIONED_QUOTES_SERVED.get(slot) else {
911+
let Some(counter) = UNVERSIONED_QUOTE_REQUESTS.get(slot) else {
907912
return;
908913
};
909-
let served = counter.fetch_add(1, Ordering::Relaxed).saturating_add(1);
910-
if served % UNVERSIONED_QUOTE_LOG_INTERVAL == 0 {
914+
let seen = counter.fetch_add(1, Ordering::Relaxed).saturating_add(1);
915+
if seen % UNVERSIONED_QUOTE_LOG_INTERVAL == 0 {
911916
info!(
912917
target: "ant_node::quote::settlement",
913-
"Served {served} {path} quotes to clients that declare no settlement version. \
914-
These clients cannot be told to upgrade before they pay.",
918+
"Received {seen} {path} quote requests from clients that declare no \
919+
settlement version. These clients cannot be told to upgrade before \
920+
they pay.",
915921
);
916922
}
917923
}

0 commit comments

Comments
 (0)