Repository navigation
feat(validator): warn when the local clock disagrees with a beacon node's - #886
Conversation
…ot's duties The client asked whether its beacon node was syncing or optimistic once an epoch, at the top of refresh_epoch, and between refreshes left every duty to the node's 503. The Beacon API has none for a syncing node's head root or an optimistic node's payload attestation data, and with several nodes every request still started at the first one listed. beacon_node::health probes every node's /eth/v1/node/syncing once a slot, all at once, a sixth of a slot before the boundary (2 s on 12 s slots), on its own task. NodeHealth keeps each node's last probe (the full SyncStatus, head_slot and sync_distance included, or the error), shared through FallbackBeaconNode::health() with a cheap snapshot(). - The duty loop reads the probe at the boundary: a slot signs nothing when some node answered and every node that answered is syncing or optimistic. A node that did not answer does not count, so the 503 stays the backstop. Logged, and counted on ethlambda_validator_slots_skipped_syncing_total. Only the fee recipient re-send, which signs nothing, still runs in such a slot. - refresh_epoch drops its own check and runs only in a slot that passed, so the epoch refresh and the duties read one probe. - The fallback tries the nodes that passed first, then the rest, each in command-line order; Producer positions are unchanged. - The head root and the PTC data are never asked of a node whose last probe said syncing or optimistic, so no sync committee message is signed over a syncing node's head and no PTC vote over an optimistic one. - el_offline and each node's change of state are logged on change.
87613c4 to
82ff394
Compare
…s probe A synced node whose sync probe had not come back by the boundary counted as not answering, so one fast syncing answer withheld the slot while routing still ranked that node synced. A node still on the slot before's synced answer now holds the gate open. The probe task's end is logged: it loops for the client's life, so it ends only by panicking, and the duties then go on unchecked. The el_offline change logs compare against the last probe that answered, so a failed probe in between neither hides the execution client coming back nor reports it going offline twice.
82ff394 to
2987f41
Compare
|
/review |
…ered synced The head root and the payload attestation data have no 503 behind them, yet a node whose sync probe failed was still asked for them: a syncing node with a slow or broken /node/syncing could hand out its stale head, or an optimistic one its unvalidated payload data, for this client to sign. For those two calls a node must have answered its last probe synced, or have no probe to read (a fallback no probe task runs for). With no node left to ask the answer stays BeaconNodeSyncing, which the sync committee and PTC services read as "do not sign".
…sages Requests walk the beacon nodes by tier, best first: synced and validated; optimistic or with the execution client offline; syncing or more than 8 slots behind by sync_distance; not probed yet; failing. Command-line order breaks ties, so one healthy node, or several, are asked as listed. A request that times out or cannot connect ranks its node failing until a later probe answers, so a hung node costs one request timeout per probe rather than one per request. `nodes` stays in command-line order, so a Producer still names the node that built a blinded block. `--broadcast attestations,blocks,sync-committee` sends those signed messages to every node at once, succeeding when any accepts. Nodes ranked failing are sent a broadcast only when no other node took it. A block reports the best answer (200 over 202 over refused). An envelope goes to its block's producer first, then the rest, or to the producer alone when sent without its blobs. A blinded block stays on its producer. None is broadcast by default.
…less envelope to its producer In a stall every node is past the sync tolerance and ranks Behind, so a syncing node listed first was asked ahead of a synced one. Inside a tier, a node reporting syncing now goes last, and an optimistic or el_offline one after the rest. An envelope without its blobs goes to its producer alone with or without --broadcast blocks: only the producer cached them, and a producer ranked failing for a timed-out block publish was otherwise asked last. Also: --broadcast accepts Lighthouse's `none` as a no-op, the request failures are recorded with inspect_err, and the dto.rs table says el_offline and sync_distance rank a node.
AI security review: 2 finding(s) to checkReviewed by Opus, GPT, Kimi, GLM, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM1. Slot comparison warns on arbitrarily small clock offsets near a boundary (low, logic)
M2. Documented alert at |offset| >= 2 misses 'client behind' skews detected only by slots, since the gauge then reads below 2 s (low, docs)
Cost of this review: ~$3.47 of a $30 budget (estimated from token counts). |
…e envelope's failover A broadcast waited for every node not ranked failing. A node hanging on publish_block for the first time held it past the proposal's deadline, which cut the whole publish: the proposal read as failed, the self-built envelope was skipped, and the hung node's timeout was never recorded, so the next proposal waited on it again. Once a node accepts, a broadcast now waits at most half a second more; a node still sending is cut off and ranked failing. An envelope without its blobs went to its producer alone. A block with no blobs can be revealed through any node, so a producer that does not take it is now followed by the walk, with or without --broadcast. A request failure is cleared only by a probe sent after it, not by one already on its way when the request failed.
…ties
The validator client's /health always answered 200 with a constant
body, so a client whose beacon nodes were all down or syncing, or whose
slashing-protection writes kept failing, looked healthy to every probe.
client_health::ClientHealth holds what the endpoint reads, all of it
state the client already keeps, and makes no beacon node request of its
own. /health now answers 200 when the client can do its duties and 503
when it cannot, with status, service and four checks:
- beacon_nodes {usable, configured}: usable counts the nodes whose
latest sync probe (beacon_node::health) answered neither syncing nor
optimistic and is at most two slots old. One is enough.
- validators {loaded, resolved}: reported, never failing. loaded is
read from the key store with try_read, falling back to the last count.
- slashing_protection {last_write_ok}: SharedProtection::last_write_ok,
two atomics beside the record's mutex. commit() sets the write flag
from file::write's outcome; blocking() sets the wait flag on a
RECORD_WAIT timeout and clears it when it reaches the record. A failed
write fails the check until a later write succeeds.
- started: the duty loop marks the first successful refresh_epoch.
status is healthy (200), starting (503: not started, nothing else
failed; a node not probed yet does not count against a client that has
not started) or unhealthy (503).
beacon_node_available is now set on every /metrics scrape from the same
report, as is the new ethlambda_validator_healthy gauge and
validators_loaded, so a gauge and the endpoint read one answer. Its old
writers in the duty loop and the sync gate are gone.
docs/cli.md documents the endpoint and docs/metrics.md the metric
changes.
A node can answer its sync probe synced and still fail every duty refresh. /health then stayed 200 for good after the first refresh, with no duties left to do once the held schedule ran out, and the failure paths that used to drop beacon_node_available are gone. /health gains a schedule_current check: the last successful refresh is at most two epochs old, so the schedule it fetched (its own epoch and the next) still covers now. healthy now also requires it.
…y held schedule_current allowed two epochs from the refresh's completion. A refresh late in its epoch then read current for most of an epoch past the schedule's end, and one whose lookahead fetch failed (which refresh_around shrugs off) read current through an epoch it held no attester duties for. The duty loop now passes the last epoch the attester schedule holds after a successful refresh: the lookahead epoch when its fetch went through, else the refresh's own (DutiesService::holds_attesters). ClientHealth compares it with the clock's epoch, so attach takes the SlotClock.
3c3b63b to
015d62a
Compare
…rent across boundaries A refresh that resolved no validator (no keys, or keys waiting for activation) fetches no attester schedule, so the schedule check counted it through its own epoch only, and /health read unhealthy at every epoch boundary until that slot's refresh returned. Such a refresh now counts through the next epoch: there is no schedule to run out.
…de's
Every duty is timed off the client's own wall clock, and nothing checked
it. The per-slot sync probe now compares it with each beacon node's clock,
and the duty loop watches it for steps. Both only warn.
- crate::clock_check, new: the slot comparison (a head more than a slot
past the client's wall slot; head_slot + sync_distance against the
client's wall slots at send and receive, read only for a nonzero
distance from a node that is not syncing), the Date estimate (header at
the middle of its second less the round trip's midpoint, round trips
over a second dropped, median of three samples, warned at 2 s, held to
the slot comparison's bound when the two disagree), the IMF-fixdate
parser, the per-node warning rate limit (once an epoch),
and StepWatch (wall clock against the monotonic one per pass of the
duty loop, 0.5 s threshold, plus a stall warning).
- health::Probe gains `reply` (receive time and Date); the probe calls
the new BeaconNodeApi::sync_status_with_date, which HttpBeaconNode
answers from get_dated, and health::run reads each round.
- Metrics: ethlambda_validator_beacon_node_clock_offset_seconds{node}
and ethlambda_validator_clock_steps_total; ethlambda-metrics re-exports
GaugeVec and register_gauge_vec.
- Docs: docs/cli.md "Clock checks", docs/metrics.md.
… series A node's Date estimate was the median of its last three samples however old they were, so a node that stopped sending a usable Date kept an old skew warned about and on its gauge for good. A sample is now read for six slots. A node that does not answer a probe has its clock offset series removed, rather than keeping the last value an alert would keep firing on. A clock step that stays within the slot served or the next is logged as such, instead of as one that lost slots or holds duties back.
…ect the alert guidance A round trip that ends just short of this client's slot boundary, from a node a few milliseconds ahead that already crossed it, flagged clocks that agree: any slot disagreement warned, whatever it proved. A slot comparison now counts only when it proves half a second or more (MAXIMUM_GOSSIP_CLOCK_DISPARITY). The docs said an alert on an absolute offset of 2 matches the warnings. A warning from the slots alone shows only the offset they prove, about 1.9 s on 12 s slots when this client is behind, so the guidance now says where such an alert has to fire.
015d62a to
5325408
Compare
…ot-sync-check Conflicts with the chain check from main (#854), resolved to keep both: - FallbackBeaconNode holds the probe records and the chain check's per-node states side by side. The walk follows the probe ranking and skips a node whose usable flag is down; try_each_synced answers BeaconNodeSyncing only when some node is on this client's chain, and the no-usable-node failure otherwise. - The per-slot probe and is_optimistic_or_syncing ask only the nodes on this client's chain, so a synced node on another chain cannot open the slot's gate. - The duty loop reads the gate before the readmission count, so a node let back in during a withheld slot is still sent what it missed at the next slot that passes. Both the probe task and the chain check are stopped when run returns. - docs/cli.md: the --beacon-nodes row and the per-slot section name the chain check.
…-node-ranking Brings in main through the base branch: the chain check (#854) and the keymanager token file (#867). Conflicts in fallback.rs, resolved to keep both: the broadcast topics and flag sit beside the chain check's per-node states, and the module doc keeps both sections. Beyond the conflicts, a node whose usable flag is down is now left out of a broadcast (`broadcast_to_all`), and an envelope whose producer left the chain is not sent to it but to the walk or the broadcast, as no other call goes to such a node. A broadcast with no node to send to names the chain check's no-usable-node reason. docs/cli.md says so.
…ck-skew Brings in main through the base branches: the chain check (#854) and the keymanager token file (#867). Conflicts: - fallback.rs: the probe keeps this branch's dated request and reply (`sync_status_with_date`, `Reply`) over the base's usable nodes only, so a node on another chain feeds neither the gate nor the clock check; check_nodes stays as main has it. - lib.rs: the duty loop keeps the clock-step watch beside the readmission and schedule-generation counters.
With an empty ValidatorStore the sync committee and PTC services sign nothing whichever node answers, so both tests still passed with head_block_root routed back through the plain try_each walk. Loading one key makes a stale or optimistic node's root produce a submitted message, which the existing asserts catch.
…ot-sync-check Brings in #869, #870 and #879. One conflict, in the duty loop's refresh block (lib.rs): main's ahead_of_block/settle_refresh restructure is kept, with this branch's comment fix (refresh_epoch no longer runs a sync check) carried over. Semantic fix: #869's a_refresh_that_finds_the_node_syncing_stops_the_proposals drove the node_syncing gate through refresh_epoch's is_optimistic_or_syncing check, which this branch removes in favour of the per-slot probe. The gate is still reachable through a duties fetch every node refuses with a 503 (read as BeaconNodeSyncing), so the test now feeds settle_refresh that outcome. The proposal gate's comment now names the per-slot check as the primary guard.
…ck' into stack/885
…-endpoint Brings in #876's and #885's latest, and through them main's #869, #870 and #879, which restructured the duty loop's refresh (ahead_of_block, settle_refresh, a refresh deferred past the block). Conflicts in lib.rs, resolved onto main's structure with this branch's intent ported: - health.epoch_refreshed now runs wherever settle_refresh reports a refresh that got through, both ahead of the block and deferred past it, through a new report_refreshed helper that keeps the covered_through rule. - The set_beacon_node_available writes #869 and #870 added (settle_refresh's two failure arms, the proposer-only fetch, spawn_subscriptions) are dropped, as this branch dropped the older ones: the gauge is set from the /health report on every scrape. duties.rs: #869 and this branch each added an identical holds_attesters; one is kept.
…-endpoint Brings in the base branch's merge of main, which carries #876 as one squashed commit.
…ck-skew Brings in the base branches' merge of main, which carries #876 as one squashed commit.
…de's (#886) The validator client timed every duty off its own wall clock and never checked it against anything, so a skewed clock got proposals refused or sent duties late while every series looked healthy. Each sync probe now also reads the node's Date header and answer time, and the client warns when its clock is off from the nodes' by half a second or more (ethlambda_validator_beacon_node_clock_offset_seconds). A step of the wall clock against the monotonic one is logged and counted too. Applied as this PR's own change on top of #884, which it is stacked on. Resolved against #874 and #880: the module list and the metrics keep #874's and #880's entries next to this PR's clock series.
pablodeymo
left a comment
There was a problem hiding this comment.
LGTM. It only warns and updates metrics, I found no panic paths, and CI is green. Measuring the Date header at the round trip's midpoint, and checking the slots at both send and receive, keeps a slow answer from being read as skew.
One concern from my first pass is gone: now that #854 is merged in, probe asks only usable nodes, and ClockWatch::read takes only a probe from the current slot. A node the chain check marks as on another chain therefore gets no reading: its gauge is cleared and it can't raise a false clock warning.
One docs fix I'd like before merging, and one nit, inline.
| | `ethlambda_validator_slots_skipped_syncing_total` | Counter | Slots in which nothing was signed because every beacon node that answered the slot's sync probe (`/eth/v1/node/syncing`, a sixth of a slot before the boundary) reported syncing or optimistic. Should read zero once the nodes are synced; a steady climb is a node that stays syncing or on an optimistic head, usually because its execution client is behind. Nodes that did not answer are not counted against the slot, so this stays flat while every node is down. See [The per-slot sync check](./cli.md#the-per-slot-sync-check) | | ||
| | `ethlambda_validator_beacon_node_available` | Gauge | 1 when at least one configured beacon node answered its latest sync probe neither syncing nor optimistic, and that probe is at most two slots old. 0 before the first probe answers, and while every node is down, syncing or optimistic, which includes every slot the sync check withholds. Set on every scrape from the per-node probe records `/health` reads, so it follows the nodes rather than the last duty: a failed attestation no longer sets it to 0, and a node that comes back sets it to 1 within a slot, without waiting for the next epoch's refresh | | ||
| | `ethlambda_validator_healthy` | Gauge | 1 when `/health` answers `200`, 0 when it answers `503`: the client has run a duty refresh whose attester schedule reaches the current epoch, at least one beacon node is usable, and the last slashing-protection write went through. Set on every scrape from the same report `/health` answers with, so an alert on it and a probe of the endpoint cannot disagree. 0 while the client is starting. See [Metrics](./cli.md#metrics) for the checks | | ||
| | `ethlambda_validator_beacon_node_clock_offset_seconds` | Gauge | Each beacon node's clock minus this client's, labelled `node` by its position in `--beacon-nodes` (from 0), so positive means this client's clock is behind. Set from every answer to the sync probe: the median of the node's last three `Date` header samples once three are kept from the last six slots, good to about a second. When the node's `head_slot` and `sync_distance` put it in another slot than this client, the value is held to at least the offset that allows, so a `Date` written by something else (a reverse proxy) cannot hide it; that offset is also the value until three samples are kept, or for a node that sends no `Date`. Otherwise 0. Every node the client warns about reads at least 1.5 in absolute value on 12 s slots, so alert there: a `Date` warning needs 2, and a warning from the slots alone shows the least offset they prove, which for this client being behind is about the probe's lead before the boundary less the round trip (about 1.9 s; a sixth of a slot in general, so lower the threshold on shorter slots). A synced node's `Date` estimate stays within about a second. Unlike the other series, a node's is absent until its first answer, and again from a probe it does not answer until one it does. See [Clock checks](./cli.md#clock-checks) | |
There was a problem hiding this comment.
should-fix: "Every node the client warns about reads at least 1.5 in absolute value on 12 s slots" holds only for a short round trip. A warning from the slots alone counts once the proven offset reaches SLOT_SKEW_MIN_SECS (0.5), and the bound is about the probe's lead minus the round trip. The probe's budget runs nearly to the next probe, so a slow answer can give a bound well under 1.5. For example, a node 3 s ahead that sends no Date and answers in 1.2 s reads about 0.8: the client warns, but an alert at 1.5 never fires. Could this say "at least 0.5", or point alerting at a separate "skewed" signal (e.g. a 0/1 gauge set when the client warns) rather than a threshold on the offset?
| Report::Quiet | ||
| }; | ||
| } | ||
| let due = self |
There was a problem hiding this comment.
nit: warned_at isn't reset when the clocks agree again. Sequence: warn at slot k, agree at k+1 (logs "agrees again" and clears unresolved), skewed again at k+2. That third reading is held back until k+32, so for up to an epoch the last log line says the clocks agree while they don't. The gauge does show it. Clearing warned_at on Report::Agree, or allowing a warning right after an agree, would fix it; the epoch limit could still apply between warnings that have no agree in between.
… it off, and give the envelope's producer a head start - A node a broadcast stops waiting for 500 ms after the first acceptance is no longer ranked Failing. One that is only slower (to import a block, or to take a large envelope) was cut out of every broadcast until its next probe, slot after slot. A hung node still costs a broadcast at most the grace, and its probe ranks it failing. `NodeHealth::record_no_answer` is removed. - Under `--broadcast blocks` the envelope's producer gets a 500 ms head start (`PRODUCER_HEAD_START`) rather than an unbounded wait. A producer that holds the request open (one that answered the block 202 waits for a block it never imported) no longer keeps the envelope from every node until the proposal's deadline cuts the reveal; past the head start its answer is awaited with the others' (`Sent::Pending`). - An envelope without its blobs that the producer refused is not sent to it a second time by the walk (`Reach::EveryBut`). - `register_validators_in_batches` records failed batches against node health.
…anking # Conflicts: # bin/ethlambda/src/validator.rs
…anking # Conflicts: # bin/ethlambda/src/validator.rs # crates/validator/src/lib.rs
…de's (#886) The validator client timed every duty off its own wall clock and never checked it against anything, so a skewed clock got proposals refused or sent duties late while every series looked healthy. Each sync probe now also reads the node's Date header and answer time, and the client warns when its clock is off from the nodes' by half a second or more (ethlambda_validator_beacon_node_clock_offset_seconds). A step of the wall clock against the monotonic one is logged and counted too. Applied as this PR's own change on top of #884, which it is stacked on. Resolved against #874 and #880: the module list and the metrics keep #874's and #880's entries next to this PR's clock series.
Brings in main now that #885 and #884 have merged, with #868, #900, #901 and #911. #885 and #884 reached main as squash commits, so a plain merge saw both sides add the same files and conflicted throughout. The tree is main plus this branch's own diff against #884's merged head (42dcaa3), which applies to main without conflicts.
Brings in #868, #872, #880, #884, #885 and #886, among others. Each side added a flag next to --beacon-nodes, a ValidatorConfig field and a row in the README and docs/cli.md flag tables. --network and main's --broadcast both stay, --network first, and the --beacon-nodes rows take main's text, which describes #885's ranking. The config is built before run (#872), so network joins main's broadcast and event_stream fields there.
Closes #834.
Problem
The validator client times every duty off its own wall clock (
SlotClock) and never checked that clock against anything. Against an ethlambda node, a clock ahead by more than 500 ms gets proposals refused (refuse_future_slot), one ahead by a few seconds votes for the parent, and one behind sends every duty late while every series this client exports looks healthy. The log never pointed at the clock. A wall-clock step was absorbed silently too:next_slot_to_servejumps to the slot the clock reads after a forward step, and waits for it to come back after a backward one.What this does
A clock check on every sync probe (
crates/validator/src/clock_check.rs, new). #876's probe asks every node/eth/v1/node/syncinga sixth of a slot before each boundary. It now also records when each answer came back and itsDateheader (health::Probe::reply, a newhealth::Reply), andhealth::runhands each round to aClockWatch. Two comparisons are made per node:compare_slots). The client's wall slot is taken at send (Probe::at) and at receive (Reply::received), so a boundary crossed while the request was out lands between the two and counts as neither.head_slotmore than one slot past the client's wall slot at receive means the client's clock is behind (Lighthouse'sTimeDiscrepancy). One slot past is tolerated.sync_distancefrom a node that is not syncing,head_slot + sync_distanceis the node's wall slot. A wall slot before the client's at send means the client is ahead; one past the client's at receive means it is behind.Date(date_offset). The header, taken at the middle of the second it names, less the midpoint of send and receive. A sample from a round trip longer than a second is dropped. A node is flagged once the median of its last three kept samples is 2 s or more from zero. A sample is read for six slots, so a node that stops sending a usableDateloses its estimate rather than keeping an old skew warned about and on its gauge. A node that sends noDate, or one that is not an IMF-fixdate, gets the slot comparison alone.Steps (
clock_check::StepWatch, onecheckcall at the top of the duty loop inlib.rs). Each pass compares how far the wall clock moved with how farInstantmoved. A difference of half a second or more is a step: logged at warn with its size and direction, and counted. The message says slots were lost only for a forward step past the next slot, and that duties wait only for a backward step before the slot served; a step within those only moves the next boundary. If no step was found but the wall clock reads more than a slot past the slot served, a stall is logged, not counted.Surfacing.
--beacon-nodesand gives the signed offset, plus the node's and client's slots when the slot comparison fired. It is worded by direction: behind means late duties nothing refuses, ahead means refused block requests and votes for the parent. It recurs at most once an epoch per node while the disagreement lasts, and one info line follows when the clocks agree again (NodeClock::report).ethlambda_validator_beacon_node_clock_offset_seconds{node="<position>"}: node clock minus client clock, so positive means this client is behind.ethlambda_validator_clock_steps_total.ethlambda-metricsnow re-exportsGaugeVecandregister_gauge_vecfor the gauge.Plumbing.
BeaconNodeApi::sync_status_with_dateis a new trait method. Its default answers noDate, so the mock and the fallback need nothing.HttpBeaconNodeimplements it through a newget_dated, whichgetnow delegates to.FallbackBeaconNode::probekeeps its signature and calls the new method.Decisions
Dateis read on the probe's request only, not in everyget/post. One sample per node per slot is plenty, and the probe is the one request already timed per node and tied to a position.sync_distanceis read only when nonzero and the node is not syncing. That goes beyond the issue's sketch. The Beacon API defines the distance as how many slots the node must process to reach the head. Teku (GetSyncing.calculateSlotsBehind) reports 0 whenever it is in sync, and its peers' best slot less its head while it syncs. Read unconditionally, a Teku node would put the client ahead on every missed slot and during any chain stall. Lighthouse, Prysm, Nimbus and ethlambda compute the distance from their own clock, so the rule reads them whenever their head lags. The head rule needs no distance. The cost is real: a synced node's head is at its wall slot, so its distance is 0, and in the ordinary case the slot comparison cannot see a client that is ahead. OnlyDatesees that direction then, and it is the direction that costs proposals.Dateestimate when they disagree (ClockWatch::read). When the slot comparison fires, the reported offset is theDateestimate held to at least the offset the slots allow, and the warning takes its direction from the slots. A reverse proxy in front of the node writes its ownDate(nginx does by default), which is the proxy's clock, and would otherwise report a node 10 s behind as agreeing.refresh_epochis not bounded by its slot, so an epoch refresh against slow nodes can return more than a slot later (feat(validator): rank beacon nodes by health and broadcast signed messages #885 shortens the hung-node case to one request timeout, but does not bound the refresh). A slot-only rule would count that as a forward step, and an NTP slew that puts the wall clock a few milliseconds behind a boundary would count as a backward one. The monotonic comparison catches every step of 0.5 s or more, including ones that cross no boundary. It also catches a suspended host, sinceInstantstops while the host sleeps. A paused process or VM whose monotonic clock runs on shows up as a stall. 0.5 s isMAXIMUM_GOSSIP_CLOCK_DISPARITY, the smallest error that already costs a proposal against an ethlambda node.Dateestimate. That covers a node that sends noDate, and any node before three samples are kept. When the slot comparison fires, the gauge shows the offset nearest zero that the comparison allows, from the slot start and the send or receive time. Otherwise it shows 0. So every node that answers has a series. A warning from the slots alone shows only the offset they prove, about 1.9 s on 12 s slots when this client is behind (a sixth of a slot less the round trip), sodocs/metrics.mdputs an alert meant to match every warning at 1.5 on 12 s slots, lower on shorter ones. A slot comparison that proves less than half a second (SLOT_SKEW_MIN_SECS), a boundary crossed inside a long round trip by a node a few milliseconds ahead, does not count. A labelled gauge has no series before a node's first answer, whichdocs/metrics.mdsays. A node that does not answer a probe has its series removed until it answers again, so an alert does not keep firing on its last value.--beacon-nodesURL can carry credentials, and feat(validator): check each beacon node's sync status before every slot's duties #876's logs already name nodes by position.Date, nothing finer. No timesync endpoint, no NTP query.slot_signs, nor the ranking (NodeHealth::ranked,Tier), norStanding, nor what/healthreports.Docs.
docs/cli.md: a "Clock checks" section after "Ranking and broadcast", and the sync check's "no clock-based rule for signing" bullet now says the clock checks readsync_distanceandhead_slottoo.docs/metrics.md: both new series.health.rsmodule doc is updated to match.On #884 and #885.
Probehas a new field,reply, and this PR addsreply: Noneto the one literal #884 and #885 build by hand, #884'sclient_health::tests::probe. #885'sat_distanceandel_offlinebuild throughhealth.rs's testprobehelper, which this PR already changes. No existing public item was renamed or removed.Tests
clock_check.rs:Dateparsing. The RFC example, the epoch and a leap day parse to their instants. The two obsolete forms, a non-GMT zone, impossible dates (31 February, 29 February 2023), out-of-range fields, a leading+, a pre-1970 year, non-ASCII and the empty string are refused.Dateoffset.Datekeeps its estimate for six slots after its oldest sample, then loses it and is no longer flagged.Datereads 0 while the slots agree.Dateestimate, and sets the offset to its bound.Dateestimate near zero, as from a proxy, does not hide a node whose wall slot is behind the client's: the offset is held to the slots' bound of about -10 s.MockBeaconNodereporting a head three slots past the client's clock, the node is flagged; one slot past, it is not, whichever side of a boundary the probe lands on. A probe records the receive time for an answering node and no reply for a failing one. Only the probe taken for the slot, and only an answer, is read.beacon_node/http.rs:sync_status_with_datereads an IMF-fixdateDatefrom the answer and reads an RFC 850 one as none.The global gauge is not asserted on, since tests in one binary share it. The tests assert on the
Readingit is set from.Tests not run locally (CI runs them);
make fmtandmake lintclean.