Skip to content
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

kaiax: apply valset module on istanbul consensus #183

Merged
merged 16 commits into from
Dec 26, 2024

Conversation

yoomee1313
Copy link
Contributor

@yoomee1313 yoomee1313 commented Dec 19, 2024

Proposed changes

This PR applies valset module so that it can replace the snapshot validator in consensus.

Main Changes

  • The following methods were added or modified in the Istanbul consensus interface:
    • Removed Validators(proposal Proposal) ValidatorSet
    • Removed ParentValidators(proposal Proposal) ValidatorSet
    • Added GetValidatorSet(num uint64) (*BlockValSet, error)
    • Added GetCommitteeSet(num uint64) (*RoundCommitteeState, error)
    • Added GetCommitteeStateByRound(num uint64, round uint64) (*RoundCommitteeState, error)
  • Introduction of BlockValSet and RoundCommitteeState
    • BlockValSet: a list of registered council nodes, divided into two sublists: qualified, demoted
    • RoundCommitteeState: Extends BlockValSet with additional information: committee, proposer, f, requiredMessageCount
  • The core structure now maintains the validator set for the current view (N, Round), which is essential for processing consensus messages:
    • Removed valSet istanbul.ValidatorSet
    • Added currentCommittee *istanbul.RoundCommitteeState

Points of Interest

  • The transition from the Istanbul snapshot to the valset module involves the following changes:
    • Valset.SubList and Valset.SubListWithProposer have been replaced by RoundCommitteeState.Committee().
    • Valset.GetProposer has been replaced by RoundCommitteeState.Proposer().
      • The new implementation ensures the proposer is always consistent with the current view, addressing a known TODO in the previous codebase.
    • Valset.GetByAddress has been replaced by BlockValSet.Qualified().At().
  • Proposer updates in weighted random logic
    • In the weighted random logic used for proposer selection, when a remove validator vote is detected, the corresponding address is removed from the proposer list. This behavior has been implemented in the kaiax valset module. 0ff82f4
  • This PR didn't delete the snapshot code yet. After sync test is done, new PR will be uploaded with snapshot code deletion.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribute
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@yoomee1313 yoomee1313 force-pushed the apply-valset branch 2 times, most recently from d242427 to 5af51ea Compare December 19, 2024 04:46
@blukat29 blukat29 mentioned this pull request Dec 20, 2024
9 tasks
@blukat29
Copy link
Contributor

@yoomee1313 #169 is now merged. Please rebase against it (or re-stack your commits after latest dev)

consensus/istanbul/backend/backend.go Outdated Show resolved Hide resolved
consensus/istanbul/backend/backend.go Outdated Show resolved Hide resolved
consensus/istanbul/backend/engine.go Outdated Show resolved Hide resolved
consensus/istanbul/validator.go Outdated Show resolved Hide resolved
consensus/istanbul/backend/validator.go Outdated Show resolved Hide resolved
node/cn/backend.go Outdated Show resolved Hide resolved
@yoomee1313 yoomee1313 changed the title [Draft] kaiax: apply valset module kaiax: apply valset module Dec 23, 2024
@yoomee1313 yoomee1313 changed the title kaiax: apply valset module kaiax: apply valset module on consensus Dec 23, 2024
@yoomee1313 yoomee1313 changed the title kaiax: apply valset module on consensus kaiax: apply valset module on istanbul consensus Dec 23, 2024
@yoomee1313 yoomee1313 marked this pull request as ready for review December 23, 2024 01:01
@yoomee1313 yoomee1313 requested a review from blukat29 as a code owner December 23, 2024 01:01
@yoomee1313
Copy link
Contributor Author

yoomee1313 commented Dec 24, 2024

@blukat29 @ian0371 @hyeonLewis A commit has been pushed about removeValidatorsFromProposers when remove vote casted. 0ff82f4 (changed to the new commit). Please take a look, thank you.

@yoomee1313 yoomee1313 merged commit e8f3467 into kaiachain:dev Dec 26, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants