Skip to content

request epoch start block#7885

Open
miiu96 wants to merge 2 commits into
feat/testnet-fixesfrom
request-epoch-start-block-in-case-of-error
Open

request epoch start block#7885
miiu96 wants to merge 2 commits into
feat/testnet-fixesfrom
request-epoch-start-block-in-case-of-error

Conversation

@miiu96

@miiu96 miiu96 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Added active retry mechanism for epoch start info during block proposal processing.

Proposed changes

  • When processing a block proposal, if the epoch start meta header or proof is not yet available in the pool, the current code simply fails with an error. This PR introduces ensureEpochStartInfoAvailable, which replaces the old checkEpochStartInfoAvailableIfNeeded call in ProcessBlockProposal and actively requests the missing data, then retries within the available time budget.
    This resolves an existing TODO in shardblockProposal.go

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.62%. Comparing base (53da698) to head (694d701).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/testnet-fixes    #7885   +/-   ##
===================================================
  Coverage               77.62%   77.62%           
===================================================
  Files                     885      885           
  Lines                  125425   125444   +19     
===================================================
+ Hits                    97357    97378   +21     
+ Misses                  21585    21583    -2     
  Partials                 6483     6483           

☔ 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves shard block proposal processing by adding an active retry/request mechanism for missing epoch start data (epoch start metablock header and proof), instead of immediately failing when the data is not yet present in pools.

Changes:

  • Replaces the passive checkEpochStartInfoAvailableIfNeeded call in ProcessBlockProposal with a new retrying/requesting helper (ensureEpochStartInfoAvailable).
  • Adds ensureEpochStartInfoAvailable to request missing epoch start meta header / proof and re-check availability within the proposal time budget.
  • Adds unit tests covering the new retry behavior and exposes the helper via export_test.go for testing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
process/block/shardblockProposal.go Switches proposal processing to use the new retrying epoch start info mechanism.
process/block/shardblock.go Introduces ensureEpochStartInfoAvailable which requests missing epoch start header/proof and retries until the time budget is exhausted.
process/block/shardblock_test.go Adds tests for EnsureEpochStartInfoAvailable covering success and timeout paths, including proof-related cases.
process/block/export_test.go Exposes ensureEpochStartInfoAvailable to tests via EnsureEpochStartInfoAvailable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +315 to +329
requestCount := 0
for haveTime() > 0 {
requestCount++
if requestCount%5 == 1 {
go sp.requestHandler.RequestMetaHeader(header.GetEpochStartMetaHash())
sp.requestEpochStartProofIfNeeded(header.GetEpochStartMetaHash(), header.GetEpoch())
}

time.Sleep(timeBetweenCheckForEpochStart)

err = sp.checkEpochStartInfoAvailableIfNeeded(header)
if err == nil {
return nil
}
}
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