-
Notifications
You must be signed in to change notification settings - Fork 312
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
Implement parameters for liquidity tournament control (in funding) #5020
Conversation
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 add the logic to write the funding parameters in the state on a clean chain bootstrap
Other than that LGTM |
Closes #5013. I also added a little utility type for representing percentages. Not strictly necessary, but I think it's a good move towards type safety. The motivation here was all of the annoyance of dealing with keeping track of what u64s were bps or bps^2 or yadda yadda yadda in other parts of the codebase.
f20af27
to
4af0be1
Compare
@@ -30,7 +30,9 @@ impl Component for Funding { | |||
#[instrument(name = "funding", skip(state, app_state))] | |||
async fn init_chain<S: StateWrite>(mut state: S, app_state: Option<&Self::AppState>) { | |||
match app_state { | |||
None => { /* Checkpoint -- no-op */ } | |||
None => { | |||
state.put_funding_params(FundingParameters::default()); |
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.
Ah. I misspoke, and I understand your previous point better, I was thinking of the other variant Some(app_state)
. Here this is indeed a no-op. The None
case is only
Let me fix it
Closes #5013. Diverges slightly from the ADR draft in that it creates a nested proto sub-message specific to the LQT. My rationale here was that this is nicer than prefixing every relevant field with "liquidity_tournament", both in the proto definitions, but also in the Rust code, because that way we can have a default for that entire set of parameters, and then the code can explicitly mark the absence of that set as to be interpreted as this default. Also works nicer for the future, in which we might be using the funding component for other things, each of which can cleanly have its own set of parameters. I also added a little utility type for representing percentages. Not strictly necessary, but I think it's a good move towards type safety. The motivation here was all of the annoyance of dealing with keeping track of what u64s were bps or bps^2 or yadda yadda yadda in other parts of the codebase. I've added some relevant unit tests. ## 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: > adds new parameters that can be voted on, so consensus-breaking. --------- Co-authored-by: Erwan Or <[email protected]>
Closes #5013. Diverges slightly from the ADR draft in that it creates a nested proto sub-message specific to the LQT. My rationale here was that this is nicer than prefixing every relevant field with "liquidity_tournament", both in the proto definitions, but also in the Rust code, because that way we can have a default for that entire set of parameters, and then the code can explicitly mark the absence of that set as to be interpreted as this default. Also works nicer for the future, in which we might be using the funding component for other things, each of which can cleanly have its own set of parameters. I also added a little utility type for representing percentages. Not strictly necessary, but I think it's a good move towards type safety. The motivation here was all of the annoyance of dealing with keeping track of what u64s were bps or bps^2 or yadda yadda yadda in other parts of the codebase. I've added some relevant unit tests. ## 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: > adds new parameters that can be voted on, so consensus-breaking. --------- Co-authored-by: Erwan Or <[email protected]>
Closes #5013. Diverges slightly from the ADR draft in that it creates a nested proto sub-message specific to the LQT. My rationale here was that this is nicer than prefixing every relevant field with "liquidity_tournament", both in the proto definitions, but also in the Rust code, because that way we can have a default for that entire set of parameters, and then the code can explicitly mark the absence of that set as to be interpreted as this default. Also works nicer for the future, in which we might be using the funding component for other things, each of which can cleanly have its own set of parameters. I also added a little utility type for representing percentages. Not strictly necessary, but I think it's a good move towards type safety. The motivation here was all of the annoyance of dealing with keeping track of what u64s were bps or bps^2 or yadda yadda yadda in other parts of the codebase. I've added some relevant unit tests. ## 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: > adds new parameters that can be voted on, so consensus-breaking. --------- Co-authored-by: Erwan Or <[email protected]>
Closes #5013. Diverges slightly from the ADR draft in that it creates a nested proto sub-message specific to the LQT. My rationale here was that this is nicer than prefixing every relevant field with "liquidity_tournament", both in the proto definitions, but also in the Rust code, because that way we can have a default for that entire set of parameters, and then the code can explicitly mark the absence of that set as to be interpreted as this default. Also works nicer for the future, in which we might be using the funding component for other things, each of which can cleanly have its own set of parameters. I also added a little utility type for representing percentages. Not strictly necessary, but I think it's a good move towards type safety. The motivation here was all of the annoyance of dealing with keeping track of what u64s were bps or bps^2 or yadda yadda yadda in other parts of the codebase. I've added some relevant unit tests. ## 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: > adds new parameters that can be voted on, so consensus-breaking. --------- Co-authored-by: Erwan Or <[email protected]>
Closes #5013.
Diverges slightly from the ADR draft in that it creates a nested proto sub-message specific to the LQT. My rationale here was that this is nicer than prefixing every relevant field with "liquidity_tournament", both in the proto definitions, but also in the Rust code, because that way we can have a default for that entire set of parameters, and then the code can explicitly mark the absence of that set as to be interpreted as this default. Also works nicer for the future, in which we might be using the funding component for other things, each of which can cleanly have its own set of parameters.
I also added a little utility type for representing percentages. Not
strictly necessary, but I think it's a good move towards type safety.
The motivation here was all of the annoyance of dealing with keeping
track of what u64s were bps or bps^2 or yadda yadda yadda in other parts
of the codebase.
I've added some relevant unit tests.
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: