Skip to content

fix todo by moving ShouldConsiderSelfKeyInConsensus to common package#7683

Merged
sstanculeanu merged 3 commits into
aot-selectionfrom
move-method-to-common
Feb 9, 2026
Merged

fix todo by moving ShouldConsiderSelfKeyInConsensus to common package#7683
sstanculeanu merged 3 commits into
aot-selectionfrom
move-method-to-common

Conversation

@sstanculeanu

Copy link
Copy Markdown
Collaborator

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:

  • 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?

@sstanculeanu sstanculeanu self-assigned this Feb 9, 2026
@sstanculeanu sstanculeanu added the ignore-for-release-notes Do not include item in release notes label Feb 9, 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 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.ShouldConsiderSelfKeyInConsensus as 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/consensus is brought in as consensus, while other updated call sites alias it as commonConsensus. Using the default name here is easy to confuse with the existing github.com/multiversx/mx-chain-go/consensus package and makes it harder to import both in the future without a rename. Consider aliasing this import to commonConsensus here 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.

…n-go into move-method-to-common

# Conflicts:
#	process/aotSelection/aotSelector_test.go
@sstanculeanu sstanculeanu merged commit a20eae8 into aot-selection Feb 9, 2026
7 checks passed
@sstanculeanu sstanculeanu deleted the move-method-to-common branch February 9, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes Do not include item in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants