fix todo by moving ShouldConsiderSelfKeyInConsensus to common package#7683
Merged
Conversation
AdoAdoAdo
approved these changes
Feb 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes the redundancy/self-key decision logic by moving ShouldConsiderSelfKeyInConsensus into a new shared common/consensus package, then updates all call sites (AOT selection + SPoS) to use the shared helper.
Changes:
- Introduced
common/consensus.ShouldConsiderSelfKeyInConsensusas the single shared implementation. - Updated SPoS (worker/subround/consensus state + BLS v1/v2 subrounds) and AOT selection to use the shared helper.
- Moved/reshaped tests by removing package-local tests and adding coverage in
common/consensus.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| process/aotSelection/aotSelector.go | Uses shared common/consensus helper instead of local method. |
| process/aotSelection/aotSelector_test.go | Removes AOTSelector-local tests that targeted the moved helper logic. |
| consensus/spos/worker.go | Switches self-message checks to shared helper. |
| consensus/spos/subround.go | Switches leader checks to shared helper. |
| consensus/spos/consensusState.go | Switches self-message filtering to shared helper. |
| consensus/spos/common.go | Removes the old SPoS-local helper implementation. |
| consensus/spos/common_test.go | Removes SPoS-local tests for the removed helper. |
| consensus/spos/bls/v2/subroundSignature.go | Updates to shared helper. |
| consensus/spos/bls/v2/subroundEndRound.go | Updates to shared helper. |
| consensus/spos/bls/v2/subroundBlock.go | Updates to shared helper. |
| consensus/spos/bls/v1/subroundStartRound.go | Updates to shared helper (import naming inconsistency noted). |
| consensus/spos/bls/v1/subroundSignature.go | Updates to shared helper. |
| consensus/spos/bls/v1/subroundEndRound.go | Updates to shared helper. |
| consensus/spos/bls/v1/subroundBlock.go | Updates to shared helper. |
| common/consensus/common.go | Adds the shared ShouldConsiderSelfKeyInConsensus implementation. |
| common/consensus/common_test.go | Adds unit tests for the shared helper behavior. |
Comments suppressed due to low confidence (1)
consensus/spos/bls/v1/subroundStartRound.go:18
- In this file the new import
github.com/multiversx/mx-chain-go/common/consensusis brought in asconsensus, while other updated call sites alias it ascommonConsensus. Using the default name here is easy to confuse with the existinggithub.com/multiversx/mx-chain-go/consensuspackage and makes it harder to import both in the future without a rename. Consider aliasing this import tocommonConsensushere as well and updating the two call sites accordingly for consistency with the rest of the PR (e.g.consensus/spos/worker.go,process/aotSelection/aotSelector.go).
"github.com/multiversx/mx-chain-go/common/consensus"
"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/consensus/spos"
"github.com/multiversx/mx-chain-go/outport"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ssd04
approved these changes
Feb 9, 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
Proposed changes
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?