-
Notifications
You must be signed in to change notification settings - Fork 195
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
fix: lowest epoch calc #2018
fix: lowest epoch calc #2018
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
lowestEpoch === undefined ? undefined : epochToDate(lowestEpoch + 52n), | ||
instructions.lowestEpoch === undefined | ||
? undefined | ||
: epochToDate(instructions.lowestEpoch + 53n), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the 52 was wrong and should instead be 53, if my math isn't wrong.
if ( | ||
lowestEpoch === undefined || | ||
position.activationEpoch < lowestEpoch | ||
) { | ||
lowestEpoch = position.activationEpoch; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use bigintMax here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we have to use bigintMin. It might be worth making it a funciton since it'll be used in 2 different places.
return { | ||
advanceDelegationRecordInstructions, | ||
mergePositionsInstruction, | ||
publishers, | ||
lowestEpoch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to refactor this function at some point, probably not worth doing rn.
Until now lowest epoch calculation was wrong because it only took into account delegation records, but these don't exist if you have never claimed.
When the delegation record doesn't exist, you need to look at the activationEpoch of the positions to get a sense of the expiry date of the rewards.