Skip to content

fix: build 48->49 epoch sync proof within the gc window#15978

Merged
Trisfald merged 1 commit into
near:masterfrom
Trisfald:fix/migration-48-49-gc-epoch-sync-proof-master
Jun 25, 2026
Merged

fix: build 48->49 epoch sync proof within the gc window#15978
Trisfald merged 1 commit into
near:masterfrom
Trisfald:fix/migration-48-49-gc-epoch-sync-proof-master

Conversation

@Trisfald

Copy link
Copy Markdown
Contributor

Same as #15975

Upgrading to 2.13 (DB 48->49) crashed at startup on nodes with gc_num_epochs_to_keep = 3 with DB Not Found Error: epoch block: <hash>.

Cause: the migration regenerated the epoch sync proof via find_target_epoch_to_produce_proof_for, which anchors at the final head and reads BlockInfo ~4 epochs back, which gc=3 has already collected.

Fix: build the proof anchored at the current epoch (target head-2), the same way continuous epoch sync does at a boundary. If the node restarted mid-epoch, where even head-2's inputs are collected, fall back to the freshest fully retained epoch (head-1).

@Trisfald Trisfald requested a review from a team as a code owner June 25, 2026 18:59
@Trisfald Trisfald enabled auto-merge June 25, 2026 19:08
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.61%. Comparing base (715e0f9) to head (dd7cb9d).

Files with missing lines Patch % Lines
nearcore/src/migrations.rs 75.00% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15978      +/-   ##
==========================================
+ Coverage   72.60%   72.61%   +0.01%     
==========================================
  Files         952      952              
  Lines      205109   205122      +13     
  Branches   205109   205122      +13     
==========================================
+ Hits       148914   148945      +31     
+ Misses      51218    51198      -20     
- Partials     4977     4979       +2     
Flag Coverage Δ
pytests-nightly 1.10% <0.00%> (-0.01%) ⬇️
unittests 69.55% <75.00%> (+<0.01%) ⬆️
unittests-nightly 69.55% <75.00%> (+0.01%) ⬆️
unittests-spice 66.98% <75.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Trisfald Trisfald added this pull request to the merge queue Jun 25, 2026
Merged via the queue into near:master with commit 2be8cb0 Jun 25, 2026
31 of 32 checks passed
@Trisfald Trisfald deleted the fix/migration-48-49-gc-epoch-sync-proof-master branch June 25, 2026 19:46
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.

2 participants