jito-foundation / restaking

https://docs.restaking.jito.network/
Other
54 stars 5 forks source link

VAULT: update state tracker now accounts for multiple epochs passing when advancing state enqueued withdrawn VRT #124

Open coachchucksol opened 1 week ago

coachchucksol commented 1 week ago

To address H-02, Ive added the ability to shift the state of VRTs enqueued to withdraw - this mimics how the operators state is updated over multiple epochs.

Tests have also been added to cover this edgecase.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.

Project coverage is 82.51%. Comparing base (743a649) to head (968e0a1).

Files with missing lines Patch % Lines
restaking_core/src/config.rs 0.00% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #124 +/- ## ========================================== - Coverage 82.54% 82.51% -0.04% ========================================== Files 86 86 Lines 8784 8788 +4 ========================================== Hits 7251 7251 - Misses 1533 1537 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

coachchucksol commented 4 days ago

The error code I've added is because we want to use checked_div. There is no way to make the epoch_length 0, so this can never happen. However, to add some clarity to it, I made a config helper function that will calculate the epoch given a slot. I have also added some - cant-be-zero checks in the integration tests for future proofing.