Skip to content

Conversation

@tnasu
Copy link
Contributor

@tnasu tnasu commented Jan 23, 2026

Proposed changes

Some validator-related functions are duplicated, and these do not need the interfaces in the consensus package. If those functions can be used directly via each kaiax module, they can be removed from the istanbul.Backed interface.

Changes:

  1. istanbul.Backed interface
  • 1-1. Remove validator-related functions
    • GetProposer, GetCommitteeState, GetValidatorSet, GetCommitteeStateByRound, GetProposerByRound
  1. backend.backend implementation
  • 2-1. GetProposer: Remove because there is no usage in production. Use existing testcase usage only: b273293
  • 2-2. GetCommitteeState: Convert to a private function because it is used for the backend.GetConsensusInfo(consensus/istanbul/backend) function only: d9c3d53
    • getRewardAddress is also the same reason
    • Add the missing function comment
  • 2-3. GetValidatorSet, GetCommitteeStateByRound, GetProposerByRound
    • These functions are used in too many places, which means these functions' features help the consensus package, so they cannot be removed/changed
    • Change to be able to access from the core package logics because core accesses them via the istanbul.Backend interface: a6de335
      • Whether have committeeStateProvider or not
    • Extract committeeStateProvider for use anywhere: 098c23b
    • Use committeeStateProvider from the core package logics: ba9eaea

Types of changes

  • 🐛 Bug fix
  • ✨ Non-hardfork changes (node upgrade not required)
  • 💥 Hardfork / consensus-breaking changes
  • 🧪 Test improvements
  • 🧰 CI / build tool
  • ♻️ Chore / Refactor / Non-functional changes

Checklist

  • 📖 I have read the CONTRIBUTING GUIDELINES doc
  • 📝 I have signed in the PR comment I have read the CLA Document and I hereby sign the CLA in first time contribute after having read CLA
  • 🟢 Lint and unit tests pass locally with my changes ($ make test)

Related issues

Further comments

@tnasu tnasu self-assigned this Jan 23, 2026
@tnasu tnasu force-pushed the dev-consensus-refactor branch from 7265256 to a955240 Compare January 23, 2026 06:23
@tnasu tnasu marked this pull request as ready for review January 23, 2026 07:41
@tnasu tnasu requested a review from ulbqb January 23, 2026 07:42
}

return sb.GetCommitteeStateByRound(num, uint64(header.Round()))
return sb.committeeStateProvider.GetValidatorSet(num)
Copy link
Contributor

Choose a reason for hiding this comment

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

How's about adding getQualifiedValidators at kaiax/valset module interface?

backlogsMu *sync.Mutex

currentCommittee *istanbul.RoundCommitteeState
current *roundState
Copy link
Contributor

Choose a reason for hiding this comment

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

I have an idea. How's about adding the qualified, committee, proposer, committeeSize inside the current roundState?

committeeSizeGauge metrics.Gauge

// Committee state provider
committeeStateProvider consensus.CommitteeStateProviderInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought, i think it would be better to inject the valset and the govModule. What do you think?

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.

2 participants