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

Remove BuiltInFunctionOnMetaEnableEpoch and FixWaitingList #4936

Merged
merged 11 commits into from Feb 6, 2023

Conversation

mariusmihaic
Copy link
Contributor

@mariusmihaic mariusmihaic commented Jan 31, 2023

Reasoning behind the pull request

  • Obsolete/unused flags : BuiltInFunctionOnMetaEnableEpoch, WaitingListFixEnableEpoch
  • There was a bug in sharding/nodesCoordinator/indexHashedNodesCoordinator.go when computing computeNodesConfigFromList for previous nodes config. When having a leaving node, addValidatorToPreviousMap would always consider that node was eligible.
  • Linter errors

Proposed changes

  • Removed BuiltInFunctionOnMetaEnableEpoch + WaitingListFixEnableEpoch
  • Used implemented flagWaitingListFix in addValidatorToPreviousMap, but from flagStakingV4Started and completely removed it from hashValidatorShuffler. This is mandatory, since an auction unstaked node, would've been considered as previously elgibile otherwise. Therefore, in case of forced/actually remaining nodes, that auction node could've been directly sent to eligible nodes, without being selected with sufficient topUp

Testing procedure

  • Integration tests

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@mariusmihaic mariusmihaic marked this pull request as ready for review January 31, 2023 12:45
Base automatically changed from EN-13748-remove-ls-from-staking-v4 to feat/staking-v4 February 1, 2023 08:33
@mariusmihaic mariusmihaic changed the title FIX: Remove BuiltInFunctionOnMetaEnableEpoch Remove BuiltInFunctionOnMetaEnableEpoch and FixWaitingList Feb 2, 2023
@mariusmihaic mariusmihaic self-assigned this Feb 2, 2023
@sasurobert sasurobert self-requested a review February 2, 2023 11:42
// IsTransferToMetaFlagEnabled returns true if builtInFunctionOnMetaFlag is enabled
// this is a duplicate for BuiltInFunctionOnMetaEnableEpoch needed for consistency into vm-common
// IsTransferToMetaFlagEnabled returns false
// This is used for consistency into vm-common
Copy link
Contributor

Choose a reason for hiding this comment

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

we should update and simplify on vm-common as well. We do not need this function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add a task to delete it on vm-common as well then, but on a separate PR

@@ -753,7 +753,7 @@ func (ihnc *indexHashedNodesCoordinator) computeNodesConfigFromList(
newNodesList := make([]Validator, 0)
auctionList := make([]Validator, 0)

if ihnc.flagWaitingListFix.IsSet() && previousEpochConfig == nil {
if previousEpochConfig == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

if ihnc.flagStakingV4Started.IsSet() && previousEpochConfig == nil { ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After discussions with @AdoAdoAdo , we will delete this "previousEpochConfig" completely in the next PR anyway, but I'll add it for consistency

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (feat/staking-v4@c8a2453). Click here to learn what that means.
Patch has no changes to coverable lines.

❗ Current head 517cff1 differs from pull request most recent head c1d9cfe. Consider uploading reports for the commit c1d9cfe to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@                Coverage Diff                 @@
##             feat/staking-v4    #4936   +/-   ##
==================================================
  Coverage                   ?   70.87%           
==================================================
  Files                      ?      662           
  Lines                      ?    86493           
  Branches                   ?        0           
==================================================
  Hits                       ?    61299           
  Misses                     ?    20644           
  Partials                   ?     4550           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

found, shardId := searchInMap(previousEpochConfig.eligibleMap, currentValidator.PubKey())
if found {
log.Debug("leaving node found in", "list", "eligible", "shardId", shardId)
eligibleMap[shardId] = append(eligibleMap[currentValidatorShardId], currentValidator)
Copy link
Contributor

Choose a reason for hiding this comment

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

...append(eligibleMap[shardId] ?

found, shardId = searchInMap(previousEpochConfig.waitingMap, currentValidator.PubKey())
if found {
log.Debug("leaving node found in", "list", "waiting", "shardId", shardId)
waitingMap[shardId] = append(waitingMap[currentValidatorShardId], currentValidator)
Copy link
Contributor

Choose a reason for hiding this comment

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

...append(waitingMap[shardId] ?

return
}

log.Debug("leaving node not in eligible or waiting, probably was in auction/inactive/jailed",
Copy link
Contributor

Choose a reason for hiding this comment

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

currentValidatorShardId instead shardId. I think in this point shardId will have not value set, probably 0, as found were false in both searching above.

@mariusmihaic mariusmihaic merged commit e6410fc into feat/staking-v4 Feb 6, 2023
@mariusmihaic mariusmihaic deleted the EN-13754-remove-ls-flags-from-stakingV4 branch February 6, 2023 11:14
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

5 participants