Update context for replaced header optimization#7866
Merged
AdoAdoAdo merged 6 commits intoJun 18, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
sstanculeanu
previously approved these changes
Jun 2, 2026
AdoAdoAdo
previously approved these changes
Jun 17, 2026
Contributor
There was a problem hiding this comment.
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
UpdateContextForReplacedHeaderwhen 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 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 on lines
+3779
to
+3783
| currentExecResult := &block.BaseExecutionResult{ | ||
| HeaderHash: []byte("currentExecResultHash"), | ||
| HeaderNonce: 6, | ||
| HeaderRound: 6, | ||
| RootHash: []byte("currentExecResultRootHash"), |
Comment on lines
+3953
to
+3957
| currentExecResult := &block.BaseExecutionResult{ | ||
| HeaderHash: []byte("currentExecResultHash"), | ||
| HeaderNonce: 6, | ||
| HeaderRound: 6, | ||
| RootHash: []byte("currentExecResultRootHash"), |
sstanculeanu
approved these changes
Jun 18, 2026
AdoAdoAdo
approved these changes
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reasoning behind the pull request
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?