Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Update validators from DPoS module - Closes #6876 #6878

Merged

Conversation

shuse2
Copy link
Collaborator

@shuse2 shuse2 commented Nov 3, 2021

What was the problem?

This PR resolves #6876

How was it solved?

  • Migrated the old utilities to select standby delegates
  • Update to get random seed from random module
  • Update to set validator to validator module

Migrated from

How was it tested?

Migrate tests from previous dpos

@shuse2 shuse2 marked this pull request as draft November 3, 2021 10:35
@shuse2 shuse2 self-assigned this Nov 3, 2021
@shuse2 shuse2 force-pushed the 6876-dpos_update_validator branch from 51a388a to cf9de86 Compare November 3, 2021 10:38
- Migrate _updateValidators function to new DPoS module
- Migrate corresponding tests
- Migrate necessary util functions
@shuse2 shuse2 force-pushed the 6876-dpos_update_validator branch from cf9de86 to 20b061e Compare November 3, 2021 21:18
@shuse2 shuse2 marked this pull request as ready for review November 3, 2021 21:18
Copy link
Contributor

@mehmetegemen mehmetegemen left a comment

Choose a reason for hiding this comment

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

Minor comments, LGTM 🎉

isCurrentlyPunished,
selectStandbyDelegates,
shuffleDelegateList,
validtorsEqual,
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

}
const result: Buffer[] = [];
const index = pickStandByDelegate(delegateWeights, randomSeed1);
const [selected] = delegateWeights.splice(index, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

if the below is secondStandby maybe we can call this firstStandby?

forgerSelectionZeroStandbyScenario,
forgerSelectionOneStandbyScenario,
forgerSelectionTwoStandbyScenario,
forgerSelectionLessTHan103Scenario,
Copy link
Contributor

Choose a reason for hiding this comment

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

THan, typo

];
const defaultRound = 5;

for (const scenario of scenarios) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use describe.each here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can, but i would keep it like this for now. I just copied from the existing test =)

@shuse2 shuse2 requested a review from mehmetegemen November 5, 2021 10:55
Base automatically changed from 6875-create_voteweight_snapshot to feature/6554-improve-framework-architecture November 5, 2021 13:59
@shuse2 shuse2 force-pushed the 6876-dpos_update_validator branch from 2224e06 to 23448b9 Compare November 8, 2021 10:13
@shuse2 shuse2 merged commit 3a2f8b4 into feature/6554-improve-framework-architecture Nov 8, 2021
@shuse2 shuse2 deleted the 6876-dpos_update_validator branch January 13, 2022 15:55
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.

3 participants