Skip to content

Update context for replaced header optimization#7866

Merged
AdoAdoAdo merged 6 commits into
feat/testnet-fixesfrom
update-context-for-replaced-header
Jun 18, 2026
Merged

Update context for replaced header optimization#7866
AdoAdoAdo merged 6 commits into
feat/testnet-fixesfrom
update-context-for-replaced-header

Conversation

@ssd04

@ssd04 ssd04 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Reasoning behind the pull request

  • Do not set execution result context if it's already set

Testing procedure

  • System test with induced failures

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?

@ssd04 ssd04 self-assigned this Jun 2, 2026
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.55%. Comparing base (c1086aa) to head (56ab9b4).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           feat/testnet-fixes    #7866   +/-   ##
===================================================
  Coverage               77.55%   77.55%           
===================================================
  Files                     884      884           
  Lines                  125218   125220    +2     
===================================================
+ Hits                    97109    97112    +3     
+ Misses                  21654    21651    -3     
- Partials                 6455     6457    +2     

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

sstanculeanu
sstanculeanu previously approved these changes Jun 2, 2026
AdoAdoAdo
AdoAdoAdo previously approved these changes Jun 17, 2026

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 adjusts the replaced-header context update flow to avoid re-setting the blockchain execution-result context when it is already at the desired execution result (same header hash).

Changes:

  • Added an early-return in UpdateContextForReplacedHeader when the current execution result already matches the target execution result hash.
  • Updated unit tests to expect no context updates (and no cache cleanup) in the “already desired state” scenario.
  • Refactored several test cases around execution-result selection and pending-results removal.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
process/common.go Adds early return when current and target execution result hashes match; adjusts cache-cleanup call site.
process/common_test.go Updates expectations for the early-return path and modifies execution-result test fixtures.

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

Comment thread process/common.go
Comment on lines 1634 to 1643
currentExecResult := blockChain.GetLastExecutionResult()
if !check.IfNil(currentExecResult) && !bytes.Equal(currentExecResult.GetHeaderHash(), executionResultToSet.GetHeaderHash()) {
err = CleanCachesForExecutionResult(currentExecResult, postProcessTransactions, executedMiniBlocks)
if err != nil {
return err
}
if !check.IfNil(currentExecResult) && bytes.Equal(currentExecResult.GetHeaderHash(), executionResultToSet.GetHeaderHash()) {
// already at the desired state
return nil
}

err = CleanCachesForExecutionResult(currentExecResult, postProcessTransactions, executedMiniBlocks)
if err != nil {
return err
}
Comment thread process/common_test.go Outdated
Comment on lines +3779 to +3783
currentExecResult := &block.BaseExecutionResult{
HeaderHash: []byte("currentExecResultHash"),
HeaderNonce: 6,
HeaderRound: 6,
RootHash: []byte("currentExecResultRootHash"),
Comment thread process/common_test.go
Comment on lines +3953 to +3957
currentExecResult := &block.BaseExecutionResult{
HeaderHash: []byte("currentExecResultHash"),
HeaderNonce: 6,
HeaderRound: 6,
RootHash: []byte("currentExecResultRootHash"),
@ssd04 ssd04 dismissed stale reviews from sstanculeanu and AdoAdoAdo via 2b38534 June 18, 2026 08:42
@AdoAdoAdo AdoAdoAdo merged commit 961d33c into feat/testnet-fixes Jun 18, 2026
11 checks passed
@AdoAdoAdo AdoAdoAdo deleted the update-context-for-replaced-header branch June 18, 2026 13:55
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.

4 participants