-
Notifications
You must be signed in to change notification settings - Fork 101
consensus/istanbul: Deduplicate ValSet logic in consensus #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…yRound|GetProposerByRound
7265256 to
a955240
Compare
| } | ||
|
|
||
| return sb.GetCommitteeStateByRound(num, uint64(header.Round())) | ||
| return sb.committeeStateProvider.GetValidatorSet(num) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
Proposed changes
Some validator-related functions are duplicated, and these do not need the interfaces in the
consensuspackage. If those functions can be used directly via eachkaiaxmodule, they can be removed from theistanbul.Backedinterface.Changes:
istanbul.BackedinterfaceGetProposer,GetCommitteeState,GetValidatorSet,GetCommitteeStateByRound,GetProposerByRoundbackend.backendimplementationGetProposer: Remove because there is no usage in production. Use existing testcase usage only: b273293GetCommitteeState: Convert to a private function because it is used for thebackend.GetConsensusInfo(consensus/istanbul/backend)function only: d9c3d53getRewardAddressis also the same reasonGetValidatorSet,GetCommitteeStateByRound,GetProposerByRoundconsensuspackage, so they cannot be removed/changedcorepackage logics because core accesses them via theistanbul.Backendinterface: a6de335committeeStateProvideror notcommitteeStateProviderfor use anywhere: 098c23bcommitteeStateProviderfrom thecorepackage logics: ba9eaeaTypes of changes
Checklist
I have read the CLA Document and I hereby sign the CLAin first time contribute after having read CLA$ make test)Related issues
Further comments