-
Notifications
You must be signed in to change notification settings - Fork 313
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
funding: apportion rewards to voters/LPs #5035
Conversation
848a0dc
to
756e7f3
Compare
a13b372
to
67043e4
Compare
position::State::Opened => position::State::Opened, | ||
position::State::Closed => position::State::Closed, | ||
position::State::Withdrawn { sequence } => position::State::Withdrawn { | ||
sequence: sequence.saturating_add(1), |
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 it would be better to remove the defensive guard, in a separate PR.
There are already two levels of defense:
- the value balance mint/burn flow
- the withdraw position implementation
We are not losing any ground by not having the sequential check in the inner update guard, and we don't have to fabricate withdrawal sequence numbers in return, that seems good
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 like extra defensive guards, but the sequential number bit does seem contrived.
crates/core/component/funding/src/component/liquidity_tournament/bank.rs
Show resolved
Hide resolved
crates/core/component/funding/src/component/liquidity_tournament/bank.rs
Outdated
Show resolved
Hide resolved
// portion > budget, so eat the whole budget. | ||
None => (0u64.into(), budget), | ||
}; | ||
state.set_lqt_reward_issuance_for_epoch(new_budget); |
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 don't feel super good about rewriting the budget every run rather than letting this be a top-level concern in a single simple loop that it is easy to read. As is, we have to walk through a yo-yo of reads and writes to figure out if this works correctly. And it makes an innocuous method in a different component, totally load-bearing of something that is far away from its context (for example, the keying by epoch is ambient)
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 also think there's a bug here, we want:
and
right?
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.
Yeah that makes sense, let's just refactor the module to take in amounts, and tie in the budget at one level higher
No implementation yet, but this is the shape I think we want.
67043e4
to
3271f07
Compare
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.
Great work
## Describe your changes This trait is responsible for the actual accounting of moving funds around, to be later consumed by the end epoch handler, which figures out what portion of the rewards needs to go where. The bank will just actually move fractions of its budget in the community pool to the requested locations, atomically. Testing deferred. ## Checklist before requesting a review - [x] I have added guiding text to explain how a reviewer should test these changes. - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > yes indeed
## Describe your changes This trait is responsible for the actual accounting of moving funds around, to be later consumed by the end epoch handler, which figures out what portion of the rewards needs to go where. The bank will just actually move fractions of its budget in the community pool to the requested locations, atomically. Testing deferred. ## Checklist before requesting a review - [x] I have added guiding text to explain how a reviewer should test these changes. - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > yes indeed
## Describe your changes This trait is responsible for the actual accounting of moving funds around, to be later consumed by the end epoch handler, which figures out what portion of the rewards needs to go where. The bank will just actually move fractions of its budget in the community pool to the requested locations, atomically. Testing deferred. ## Checklist before requesting a review - [x] I have added guiding text to explain how a reviewer should test these changes. - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > yes indeed
## Describe your changes This trait is responsible for the actual accounting of moving funds around, to be later consumed by the end epoch handler, which figures out what portion of the rewards needs to go where. The bank will just actually move fractions of its budget in the community pool to the requested locations, atomically. Testing deferred. ## Checklist before requesting a review - [x] I have added guiding text to explain how a reviewer should test these changes. - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > yes indeed
Describe your changes
This trait is responsible for the actual accounting of moving funds around, to be later consumed by the end epoch handler, which figures out what portion of the rewards needs to go where. The bank will just actually move fractions of its budget in the community pool to the requested locations, atomically.
Testing deferred.
Checklist before requesting a review
I have added guiding text to explain how a reviewer should test these changes.
If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: