Skip to content

Efficiency of NeoToken VoterRewardPerCommittee records #2815

@devhawk

Description

@devhawk

NeoToken contract use of Prefix_VoterRewardPerCommittee seems pretty inefficient.

  • NeoToken.PostPersist creates a new Prefix_VoterRewardPerCommittee for every committee member with votes every time the committee is refreshed. Since the committee size == the epoch block count, this means we are generating an average of one new VoterRewardPerCommittee every block. This comes out to about 275 records per member per day
  • NeoToken.CheckCandidate will find and delete all Prefix_VoterRewardPerCommittee records for a candidate who is not registered and has no votes. For a candidate that had been a committee member for a while but is dropping out of the race, this could end up deleting 10,000s of records.
  • Once the GAS for a given block has been claimed, this record is no longer needed but continues to take up space in the data store.
  • Retrieving 10000s of records via StateService is not feasible, so the [StateServiceStore'](https://github.com/ngdenterprise/neo-blockchaintoolkit-library/blob/master/src/bctklib/persistence/StateServiceStore.cs) can't provide these records. So offline / trace / branch scenarios that use StateServiceStore` can't rely on committee rewards as part of unclaimed gas calculations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionInitial issue state - proposed but not yet accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions