Skip to content
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

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

cronokirby
Copy link
Contributor

@cronokirby cronokirby commented Jan 29, 2025

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:

    adds new parameters that can be voted on, so consensus-breaking.

@cronokirby cronokirby added the consensus-breaking breaking change to execution of on-chain data label Jan 29, 2025
@cronokirby cronokirby requested a review from erwanor January 29, 2025 00:15
Copy link
Member

@erwanor erwanor left a 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

@erwanor
Copy link
Member

erwanor commented Jan 29, 2025

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.
@@ -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());
Copy link
Member

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

@erwanor erwanor merged commit 1b1edc2 into protocol/lqt_branch Jan 29, 2025
13 checks passed
@erwanor erwanor deleted the cronokirby/5013 branch January 29, 2025 18:57
conorsch pushed a commit that referenced this pull request Jan 31, 2025
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]>
conorsch pushed a commit that referenced this pull request Feb 4, 2025
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]>
conorsch pushed a commit that referenced this pull request Feb 5, 2025
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]>
conorsch pushed a commit that referenced this pull request Feb 5, 2025
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus-breaking breaking change to execution of on-chain data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants