Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

bugfix: only fetch AddressLesserGreater when validator is eligible#28

Merged
eelanagaraj merged 2 commits into
masterfrom
eelanagaraj/fix-revoke-metadata
Mar 2, 2023
Merged

bugfix: only fetch AddressLesserGreater when validator is eligible#28
eelanagaraj merged 2 commits into
masterfrom
eelanagaraj/fix-revoke-metadata

Conversation

@eelanagaraj

@eelanagaraj eelanagaraj commented Mar 1, 2023

Copy link
Copy Markdown
Contributor

Description

This Bug is likely caused by an error in VoteMetadata when revoking votes for an ineligible validator, and would be triggered by anything calling RevokeMetadata (which in turn calls VoteMetadata), so any of the preprocessRevoke funcs (RevokeActiveVotes, RevokePendingVotes in Election.sol; ReleaseGoldRevokePendingVotes, ReleaseGoldRevokeActiveVotes which just call the Election.sol version from ReleaseGold.sol).

Election.sol revoke functions require passing in the (lesser, greater) addresses (prev/next addresses in the linked list storing the eligible validators, votes.total.eligible, which crucially excludes ineligible validators). In cases like this one, where validators are not eligible but have votes, the revoke functions simply ignore the lesser/greater addresses and don't update the linked list (since ineligible addresses are excluded).

Normal cases need to still find the (lesser, greater) addresses in the linked list of eligible validators, but in cases of ineligible validators, we can set (lesser, greater) to 0 (or anything else. -- Tested this against Election.sol directly).

Locally running Rosetta with this version of kliento looks like it fixes this issue.

Tested

  • Confirmed assumptions against Election.sol in the monorepo (adding protocol tests; will put up a PR for this)
  • Manually reproduced the error described in the issue (as best as possible, by hard-coding certain function returns -- couldn't get around this without a synced Rosetta node)
  • Manually tested locally and it seems to fix the error ^
  • Should be tested more extensively to be considered production ready

@eelanagaraj eelanagaraj marked this pull request as ready for review March 2, 2023 15:29
@eelanagaraj eelanagaraj requested a review from palango March 2, 2023 15:32
@eelanagaraj eelanagaraj changed the title Only fetch AddressLesserGreater when validator is eligible bugfix: only fetch AddressLesserGreater when validator is eligible Mar 2, 2023
Comment thread contracts/helpers/election.go Outdated
Comment thread contracts/helpers/election.go

@palango palango left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me! Thanks for fixing it so quickly!

@eelanagaraj eelanagaraj merged commit e3fe27e into master Mar 2, 2023
@eelanagaraj eelanagaraj deleted the eelanagaraj/fix-revoke-metadata branch March 2, 2023 17:41
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.

2 participants