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

Make usage of delegate list BFT compliant - Closes #3681 #4397

Merged

Conversation

lsilvs
Copy link
Contributor

@lsilvs lsilvs commented Oct 16, 2019

What was the problem?

List of delegates used to verify block forger was different from the on used to forge.
The delegate list round offset was not being used to calculate delegates who missed the slot in order to update missedBlocks property.

How did I solve it?

  • I've added the property delegateListRoundOffset to apply/undo/getForgerPublicKeysForRound.
  • Moved the usage of Dpos.apply/undo into each block processor allowing it to call with its own params.
  • Added the config property DELEGATE_LIST_ROUND_OFFSET to set the delegateListRoundOffset default value for Dpos module

How to manually test it?

Review checklist

@lsilvs lsilvs self-assigned this Oct 16, 2019
Copy link
Contributor

@yatki yatki left a comment

Choose a reason for hiding this comment

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

just one feedback, but all looks good to me.

framework/src/modules/chain/block_processor_v0.js Outdated Show resolved Hide resolved
Invert params on Dpos methods to make use of default value of delegateListRoundOffset
@lsilvs lsilvs force-pushed the 3681-failed_verify_slot_after_101 branch from fcc62f5 to 7dd644a Compare October 16, 2019 12:29
@lsilvs lsilvs force-pushed the 3681-failed_verify_slot_after_101 branch from f23d160 to a217e92 Compare October 18, 2019 09:17
@lsilvs lsilvs marked this pull request as ready for review October 18, 2019 09:41
@lsilvs lsilvs requested review from yatki and shuse2 October 18, 2019 09:41
async getForgerPublicKeysForRound(round) {
async getForgerPublicKeysForRound(round, delegateListRoundOffset) {
// Delegate list is generated from round 1 hence `roundWithOffset` can't be less than 1
const roundWithOffset = Math.max(round - delegateListRoundOffset, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think adding a check against negative offset values make sense? For instance, if round: 6 and I provide offset: -2 I can get the list for round 8. Just saying..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point but I would prefer doing this in another ticket to avoid more changes and tests broken in this PR 😬

framework/src/modules/chain/dpos/dpos.js Show resolved Hide resolved
framework/src/modules/chain/dpos/dpos.js Show resolved Hide resolved
framework/test/mocha/setup.js Show resolved Hide resolved
@lsilvs lsilvs requested a review from yatki October 18, 2019 12:57
@shuse2 shuse2 merged commit c74977d into feature/introduce_bft_consensus Oct 19, 2019
@shuse2 shuse2 deleted the 3681-failed_verify_slot_after_101 branch October 19, 2019 12:59
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.

None yet

3 participants