jito-foundation / restaking

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

Add per-epoch withdraw caps #29

Open aoikurokawa opened 2 months ago

aoikurokawa commented 2 months ago

Motivation

Solution

aoikurokawa commented 2 months ago

@buffalu Can you review this PR? Thank you so much!

coachchucksol commented 2 months ago

Hey @aoikurokawa! Thanks for the contribution!

We've had some discussions around this and need the solution to #3 to be as follows:

The vault struct needs the following: epoch_withdraw_cap_bps, last_slot_updated, epoch_withdraw_amount, epoch_snapshot_amount along with the function is_update_needed

Flow:

At the beginning of the epoch ( When vault.is_update_needed is true ) we run process_update_vault this will:

When a burn or enqueue withdrawal ticket happens:

Hope this all makes sense!

aoikurokawa commented 1 month ago

@buffalu @coachchucksol Thank you for explanation! Ready for review it! Thank you!

coachchucksol commented 1 month ago

Hi! I'll take a look at it today!

aoikurokawa commented 1 month ago

@coachchucksol Thank you for reviewing!!

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 82.44275% with 23 lines in your changes missing coverage. Please review.

Project coverage is 83.51%. Comparing base (4af6d94) to head (fde61e1).

Files with missing lines Patch % Lines
vault_core/src/vault.rs 79.27% 23 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #29 +/- ## ========================================== + Coverage 82.29% 83.51% +1.22% ========================================== Files 86 86 Lines 8651 8780 +129 ========================================== + Hits 7119 7333 +214 + Misses 1532 1447 -85 ```

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