Skip to content

revert: remove GetVerifiedNonceForEpoch and scheduleNonceMatches (PR …#75

Merged
wcatz merged 1 commit intomasterfrom
revert/pr73-verified-nonce-regression
Feb 12, 2026
Merged

revert: remove GetVerifiedNonceForEpoch and scheduleNonceMatches (PR …#75
wcatz merged 1 commit intomasterfrom
revert/pr73-verified-nonce-regression

Conversation

@wcatz
Copy link
Copy Markdown
Owner

@wcatz wcatz commented Feb 12, 2026

#73 regression)

PR #73 replaced all GetNonceForEpoch calls with GetVerifiedNonceForEpoch, which recomputes nonces by streaming all ~2.1M blocks from Shelley genesis on every uncached lookup. This made the bot unable to calculate leader schedules — every nonce lookup either timed out or took minutes.

Changes:

  • Revert all GetVerifiedNonceForEpoch -> GetNonceForEpoch (trust DB cache)
  • Remove GetVerifiedNonceForEpoch function entirely
  • Remove scheduleNonceMatches (called GetVerifiedNonceForEpoch on hot paths)
  • Remove verifiedNonces in-memory cache (no longer needed)
  • Keep backfillSchedules epoch-1 fix from PR Fix/pr71 coderabbit issues #73 (correct bug fix)
  • Fix withQuery deadlock: move close(connClosed) to top-level defer so it always fires even if NewConnection fails

Summary by CodeRabbit

  • Refactor
    • Streamlined nonce retrieval mechanism across command handlers for consistency.
    • Updated leaderlog caching and processing logic with improved failure handling and cooldown tracking.
    • Simplified schedule validation and backfill logic by removing redundant consistency checks.
    • Refined connection cleanup and signal handling for better resource management.

 regression)

PR #73 replaced all GetNonceForEpoch calls with GetVerifiedNonceForEpoch,
which recomputes nonces by streaming all ~2.1M blocks from Shelley genesis
on every uncached lookup. This made the bot unable to calculate leader
schedules — every nonce lookup either timed out or took minutes.

Changes:
- Revert all GetVerifiedNonceForEpoch -> GetNonceForEpoch (trust DB cache)
- Remove GetVerifiedNonceForEpoch function entirely
- Remove scheduleNonceMatches (called GetVerifiedNonceForEpoch on hot paths)
- Remove verifiedNonces in-memory cache (no longer needed)
- Keep backfillSchedules epoch-1 fix from PR #73 (correct bug fix)
- Fix withQuery deadlock: move close(connClosed) to top-level defer so it
  always fires even if NewConnection fails

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wcatz wcatz merged commit 1315584 into master Feb 12, 2026
2 of 3 checks passed
@wcatz wcatz deleted the revert/pr73-verified-nonce-regression branch February 12, 2026 16:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR removes the verified nonce retrieval API and associated schedule-nonce consistency validation across handlers, replacing them with simpler nonce lookup. It eliminates in-memory verified nonce caching and updates goroutine cleanup patterns in query operations.

Changes

Cohort / File(s) Summary
Nonce API Replacement
commands.go, main.go
Replaces GetVerifiedNonceForEpoch() with GetNonceForEpoch() for nonce retrieval in command handlers and leaderlog trigger checks.
Schedule Validation Removal
commands.go, main.go
Removes scheduleNonceMatches() helper function and all validation calls that checked cached LeaderSchedule consistency against epoch nonce; conditions now only check for schedule existence.
Verified Nonce Cache Removal
nonce.go
Removes GetVerifiedNonceForEpoch() public method, eliminates verifiedNonces in-memory cache, and removes associated DB repair/update flow and recomputation logic.
Goroutine Cleanup Adjustment
localquery.go
Refactors deferred cleanup in withQuery goroutine: separates defer close(connClosed) to start of goroutine from combined close block, altering cleanup timing and synchronization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Away with the verified cache, so slow!
Fresh nonces now flow, with less to bestow,
No matching checks blocking the way,
Just simple lookups to seize the day,
The schedule runs cleaner, hooray!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert/pr73-verified-nonce-regression

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

wcatz added a commit that referenced this pull request Feb 18, 2026
 regression) (#75)

PR #73 replaced all GetNonceForEpoch calls with GetVerifiedNonceForEpoch,
which recomputes nonces by streaming all ~2.1M blocks from Shelley genesis
on every uncached lookup. This made the bot unable to calculate leader
schedules — every nonce lookup either timed out or took minutes.

Changes:
- Revert all GetVerifiedNonceForEpoch -> GetNonceForEpoch (trust DB cache)
- Remove GetVerifiedNonceForEpoch function entirely
- Remove scheduleNonceMatches (called GetVerifiedNonceForEpoch on hot paths)
- Remove verifiedNonces in-memory cache (no longer needed)
- Keep backfillSchedules epoch-1 fix from PR #73 (correct bug fix)
- Fix withQuery deadlock: move close(connClosed) to top-level defer so it
  always fires even if NewConnection fails

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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