Skip to content

fix(stake-table): quiet spammy stake table warnings#4599

Merged
sveitser merged 1 commit into
mainfrom
ma/fix-spammy-warnings
Jul 3, 2026
Merged

fix(stake-table): quiet spammy stake table warnings#4599
sveitser merged 1 commit into
mainfrom
ma/fix-spammy-warnings

Conversation

@sveitser

Copy link
Copy Markdown
Collaborator
  • Lower per-validator "no delegator"/"no stake" logs from info to debug
  • Make insert_stake_table idempotent via ON CONFLICT (epoch) DO NOTHING

The epoch insert had no conflict handling, so re-recording an already cached epoch hit the UNIQUE constraint and retried 5x under WRITE_BACKOFF, emitting repeated WARN spam for a permanent, benign condition.

- Lower per-validator "no delegator"/"no stake" logs from info to debug
- Make insert_stake_table idempotent via ON CONFLICT (epoch) DO NOTHING

The epoch insert had no conflict handling, so re-recording an already
cached epoch hit the UNIQUE constraint and retried 5x under WRITE_BACKOFF,
emitting repeated WARN spam for a permanent, benign condition.
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@github-actions

Copy link
Copy Markdown
Contributor

Nextest failures (1) in this run

Test Attempts Time (s) Main history
tests::integration::proof_of_stake::test_native_demo_drb_header_base 3 431.27 flaky 1/20

See the step summary for flaky tests and slowest tests.

@sveitser
sveitser marked this pull request as ready for review June 30, 2026 14:43
@claude

claude Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Claude finished @sveitser's task in 1m 23s —— View job


Code Review: fix(stake-table): quiet spammy stake table warnings

  • Read repo guidelines (CLAUDE.md)
  • Read existing review comments
  • Review changed files
  • Post review feedback

Clean, well-scoped fix. Both changes are correct and the test is appropriate.

stake_table.rs — log level demotion (infodebug): Good call. These are expected conditions during normal validator filtering — a validator without delegators or stake is not an anomaly worth surfacing at info. The surrounding code already uses debug for similar filter-outs (line 833: the AuthenticatedValidator::try_from error, and line 846: the eligibility check), so this makes the function internally consistent.

storage.rs — idempotent epoch insert: The ON CONFLICT (epoch) DO NOTHING + rows_affected() == 0 early-return pattern is the right approach. A few observations:

  1. Transaction on early return: When rows_affected() == 0, the return Ok(()) drops tx without commit(), which triggers an implicit rollback. This is correct — the only statement executed on the transaction was the no-op INSERT, so there's nothing to roll back. No data integrity concern here.

  2. Consistency with downstream tables: The BLS key, Schnorr key, x25519 key, and validator exit inserts all use ON CONFLICT ... DO UPDATE SET epoch = min(epoch, excluded.epoch) — meaning they're already designed for out-of-order or repeated inserts. Skipping them when the epoch row already exists is safe because they would have been populated by the original successful insert.

  3. Test: test_insert_stake_table_idempotent covers the critical path — a duplicate insert succeeds silently and the original data remains intact. This directly validates the bug-fix claim.

No issues found. LGTM.

@sveitser
sveitser enabled auto-merge (squash) July 3, 2026 08:14
@sveitser
sveitser disabled auto-merge July 3, 2026 08:14
@sveitser
sveitser merged commit 68f0a10 into main Jul 3, 2026
143 of 145 checks passed
@sveitser
sveitser deleted the ma/fix-spammy-warnings branch July 3, 2026 08:14
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-mainnet-1.2.0-rc:

sveitser added a commit that referenced this pull request Jul 6, 2026
…ake table warnings (#4620)

fix(stake-table): quiet spammy stake table warnings (#4599)

- Lower per-validator "no delegator"/"no stake" logs from info to debug
- Make insert_stake_table idempotent via ON CONFLICT (epoch) DO NOTHING

The epoch insert had no conflict handling, so re-recording an already
cached epoch hit the UNIQUE constraint and retried 5x under WRITE_BACKOFF,
emitting repeated WARN spam for a permanent, benign condition.

(cherry picked from commit 68f0a10)

Co-authored-by: Mathis <mathis@espressosys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants