onflow/flow-core-contracts

Nodes should only be considered for slot selection if they've been newly added in the current epoch

pgebheim opened this issue · 0 comments

The existing algorithm has a known issue: If a user removes their stake, or if the service accounts sets a nodes weight to 0, or if the node is slashed by the system setting their weight to 0 — the above algorithm would include those nodes in the set of possible nodes to include randomly in future open slots.

Ideally, only newly nodes which hadn’t been previously considered would be addable via this process.

Solution

Questions

  • Does the pending node list need to be updated when a user unstakes their node or if the node is slashed?
    • It is possible for completeness that this happen
    • I think that by making removedUnapprovedNodes use the pending list as a filter condition, we can sidestep needing to bookkeep for removed nodes. Any nodes which don’t show up in the main node list at the end of the epoch would not be considered, and this epoch-global pending list would be cleared at the end of the epoch.