Skip to content

feat(blockchain): add --disable-duty-sync-gate to ungate duties#452

Draft
MegaRedHand wants to merge 3 commits into
mainfrom
feat/disable-duty-sync-gate
Draft

feat(blockchain): add --disable-duty-sync-gate to ungate duties#452
MegaRedHand wants to merge 3 commits into
mainfrom
feat/disable-duty-sync-gate

Conversation

@MegaRedHand

Copy link
Copy Markdown
Collaborator

What

Adds a --disable-duty-sync-gate CLI flag (default false, so current behavior is preserved). When set, the sync-gate becomes observe-only: it still tracks the syncing state and exports lean_node_sync_status, but no longer suppresses any validator duty.

Why

The sync-gate suppresses three things while a node judges itself to be syncing (local head lagging wall clock while the network still progresses):

Site lib.rs Duty
Block proposal :264 propose
Attestation production :289 attest
Aggregate re-derivation :738 reaggregate-from-block

On the devnets this gate has repeatedly driven a head-finalized sawtooth / non-finality feedback loop: dead or slow proposers create empty slots, head lag crosses SYNC_LAG_THRESHOLD, nodes flap into Syncing and stop attesting, which only widens the gap. This flag lets us A/B that hypothesis on a live devnet without a rebuild, keeping the metric intact for observability.

How

  • SyncStatusTracker gains a gate_duties field (default true).
  • update() (the metric path) is unchanged.
  • duties_allowed() returns true unconditionally when gating is disabled.
  • All three gate sites read duties_allowed(), so the flag covers proposal, attestation, and reaggregation uniformly.

Behavior matrix

--disable-duty-sync-gate lean_node_sync_status duties while syncing
absent (default) tracked suppressed (unchanged)
present tracked run

Testing

  • cargo test -p ethlambda-blockchain sync_status — 8/8 pass, incl. two new tests covering gate-on (default) and gate-disabled.
  • cargo build, cargo fmt, cargo clippy clean.

Draft: intended for devnet experimentation, not immediate merge.

The sync-gate suppresses block proposal, attestation production, and
aggregate re-derivation whenever a node judges itself to be syncing
(local head lagging wall clock while the network still progresses).
In practice this feedback loop has driven finality stalls on the
devnets: dead/slow proposers create empty slots, head lag crosses the
threshold, nodes flap into Syncing and stop attesting, which widens the
head-finalized gap further.

Add a `--disable-duty-sync-gate` flag (default off, so gating stays on)
that makes the gate observe-only: `SyncStatusTracker::update` still
tracks the syncing state and drives `lean_node_sync_status`, but
`duties_allowed()` always returns true. This lets us A/B the hypothesis
on a devnet without a rebuild while keeping the metric for observability.
When --disable-duty-sync-gate is set, the node may believe it is
syncing yet run duties anyway. Surface that counterfactual: at each of
the three gate sites (propose, attest, reaggregate) emit a warn when the
gate would have suppressed the duty had it been enabled. Makes the
override visible and greppable during devnet experiments.

Also drops the two unit tests added in the previous commit.
Replace the per-duty counterfactual logs with a single transition log in
SyncStatusTracker::update: emit a debug line only when the syncing state
actually flips, carrying the slot/lag context that drove the decision.
Quieter than per-duty logging and applies whether or not the duty gate
is enabled.
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