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

[pallet_broker] Fix adapt_price behaviour at zero #3636

Merged
merged 8 commits into from
Mar 11, 2024
Merged

Conversation

seadanda
Copy link
Contributor

This fixes the behaviour of Linear which is the default implementation of the AdaptPrice trait in the broker pallet. Previously if cores were offered but not sold in only one sale, the price would be set to zero and due to the logic being purely multiplicative, the price would stay at 0 indefinitely.

This could be further paired with a configurable minimum in the broker pallet itself, which will be a future PR.

This affects the Rococo and Westend Coretime chains, but Kusama has a different implementation so this isn't required for the Kusama launch. I actually thought I opened this a while ago.

@seadanda seadanda added the T2-pallets This PR/Issue is related to a particular pallet. label Mar 10, 2024
@seadanda seadanda self-assigned this Mar 10, 2024
@seadanda seadanda requested a review from a team as a code owner March 10, 2024 05:51
@seadanda seadanda requested a review from eskimor March 10, 2024 05:55
Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some tests would be nice to cover some edge cases.

prdoc/pr_3636.prdoc Outdated Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
@bkchr bkchr added this pull request to the merge queue Mar 11, 2024
Merged via the queue into master with commit aa35328 Mar 11, 2024
130 of 131 checks passed
@bkchr bkchr deleted the donal-adapt-price branch March 11, 2024 14:51
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Mar 24, 2024
This fixes the behaviour of `Linear` which is the default implementation
of the `AdaptPrice` trait in the broker pallet. Previously if cores were
offered but not sold in only one sale, the price would be set to zero
and due to the logic being purely multiplicative, the price would stay
at 0 indefinitely.

This could be further paired with a configurable minimum in the broker
pallet itself, which will be a future PR.

This affects the Rococo and Westend Coretime chains, but Kusama has a
different implementation so this isn't required for the Kusama launch. I
actually thought I opened this a while ago.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This fixes the behaviour of `Linear` which is the default implementation
of the `AdaptPrice` trait in the broker pallet. Previously if cores were
offered but not sold in only one sale, the price would be set to zero
and due to the logic being purely multiplicative, the price would stay
at 0 indefinitely.

This could be further paired with a configurable minimum in the broker
pallet itself, which will be a future PR.

This affects the Rococo and Westend Coretime chains, but Kusama has a
different implementation so this isn't required for the Kusama launch. I
actually thought I opened this a while ago.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants