Skip to content

chain: log duplicate-AttestationData STF rejects with full context#850

Merged
anshalshukla merged 4 commits into
mainfrom
feat/duplicate-attdata-diagnostic-log
May 12, 2026
Merged

chain: log duplicate-AttestationData STF rejects with full context#850
anshalshukla merged 4 commits into
mainfrom
feat/duplicate-attdata-diagnostic-log

Conversation

@zclawz
Copy link
Copy Markdown
Contributor

@zclawz zclawz commented May 7, 2026

Splits the chain.zig portion of #848 review #6 into its own PR so the wedge-fix for #837 stays focused on pkgs/node/src/node.zig + pkgs/metrics/src/lib.zig.

What this changes

When a block is rejected for containing duplicate AttestationData entries, log every distinguishing field of the duplicate so the reproduction has enough on-the-wire context to diagnose without pulling block bytes from a peer.

Two AttestationData values are equal iff every field (slot, head, target, source) matches, so the new log line includes:

  • blockroot, slot, proposer_index of the offending block
  • the two indices [i, j] inside the block whose data hashed to the same value
  • data.slot
  • data.head.blockroot @ slot
  • data.target.checkpoint_root @ slot
  • data.source.checkpoint_root @ slot

Pre-fix log:

block contains duplicate AttestationData entries for block root=0x…

Post-fix log:

duplicate AttestationData rejected: blockroot=0x… slot=N proposer=P duplicate_indices=[i,j] data.slot=S data.head.blockroot=0x…@H data.target.checkpoint_root=0x…@T data.source.checkpoint_root=0x…@U

Review nits applied (point #9 from #848)

  • Format string split across 5 logical chunks (block-level / data / head / target / source) so it stays diff-friendly and operators can grep individual fields.
  • root= normalised to blockroot= / checkpoint_root= to match neighbouring logs in chain.zig (e.g. line ~1867 gossip block log).
  • block.proposer_index is ValidatorIndex = u64, so {d} is correct.

Refs

When a block is rejected for containing duplicate AttestationData
entries, log every distinguishing field of the duplicate so the
reproduction has enough on-the-wire context to diagnose without
pulling block bytes from a peer.

Two `AttestationData` values are equal iff every field (slot, head,
target, source) matches, so the new log line includes:

  - blockroot, slot, proposer_index of the offending block
  - the two indices [i, j] inside the block whose data hashed to
    the same value
  - data.slot
  - data.head.blockroot @ slot
  - data.target.checkpoint_root @ slot
  - data.source.checkpoint_root @ slot

The format string is intentionally split across 5 logical chunks
(block-level / data / head / target / source) so it stays diff
friendly and operators can grep individual fields. Naming
(`blockroot=` / `checkpoint_root=`) mirrors neighbouring logs in
chain.zig (e.g. line ~1867's gossip-block log).

Splits the chain.zig portion of #848 review #6 into its own PR so
the wedge-fix for #837 stays focused on node.zig + metrics.

Refs #837, #848.

Signed-off-by: zclawz <zclawz@users.noreply.github.com>
Comment thread pkgs/node/src/chain.zig Outdated
Comment thread pkgs/node/src/chain.zig Outdated
@anshalshukla anshalshukla merged commit 3de8fec into main May 12, 2026
1 check passed
@anshalshukla anshalshukla deleted the feat/duplicate-attdata-diagnostic-log branch May 12, 2026 06:30
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.

3 participants