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

Broker new price adapter #4521

Merged
merged 39 commits into from
May 29, 2024
Merged

Broker new price adapter #4521

merged 39 commits into from
May 29, 2024

Conversation

eskimor
Copy link
Member

@eskimor eskimor commented May 20, 2024

Fixes #4360

Also rename: AllowedRenewals -> PotentialRenewals to avoid confusion of future readers. (An entry in AllowedRenewals is not enough to allow a renewal, the assignment also has to be complete, which is only checked afterwards.)

  • Does not work with renewals as is - fix.
  • More tests
  • PR docs

Edit 1:
(Relevant blog post: https://grillapp.net/12935/agile-coretime-pricing-explained-166522?ref=29715)

eskimor added 9 commits May 10, 2024 15:52
not on number of cores. I have to think a bit more about this, but I
believe we will arrive
have been sold at almost the base price
The old type was very misleading as an entry in `AllowedRenewals` does
not mean that a renewal is actually allowed.
@eskimor eskimor marked this pull request as ready for review May 21, 2024 17:15
@eskimor eskimor requested a review from a team as a code owner May 21, 2024 17:15
@eskimor eskimor added T2-pallets This PR/Issue is related to a particular pallet. R1-breaking_change This PR introduces a breaking change and should be highlighted in the upcoming release. labels May 22, 2024
@eskimor eskimor changed the title WIP: Broker new price adapter Broker new price adapter May 22, 2024
Copy link
Contributor

@Overkillus Overkillus left a comment

Choose a reason for hiding this comment

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

Left some questions and notes here and there but overall looking solid.

substrate/frame/broker/src/adapt_price.rs Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/tick_impls.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

This PR includes three separate pallet-level changes as I see it:

  1. Giving more scope to the PriceAdapter by removing restrictive logic from the pallet and allowing it to dictate the renewal price
  2. Changing adapt_price to only consider price changes
  3. Renaming AllowedRenewals to reflect its actual implementation

  1. I am fully behind. Although I think that we should be adding more information to SalePerformance, rather than stripping it back to only the price. Including other metrics from the sale like cores offered and cores sold would achieve this without committing to 2.

  2. I am not convinced by this approach, I think the new model that you're proposing here weakens the price finding mechanism in cases where we do not sell out, and would increase the time for the price to respond to market fluctuations -- both internal (demand for and perceived value of coretime) and external (DOT-FIAT volatility).
    Even if I'm wrong, I think the work in 1 would allow more flexibility in the PriceAdapter would allow experimentation in the implementation without committing to it at the pallet level.

  3. Good point, maybe we should reconsider where the completeness check happens. The check for a complete mask for a given workplan and full duration should probably happen before we put it in the AllowedRenewals at all, leaving it as a definitive list of cores that can be renewed. I think that's useful information to have in state.

substrate/frame/broker/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/types.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/tick_impls.rs Show resolved Hide resolved
substrate/frame/broker/src/tick_impls.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/utility_impls.rs Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Outdated Show resolved Hide resolved
substrate/frame/broker/src/adapt_price.rs Show resolved Hide resolved
@paritytech-review-bot paritytech-review-bot bot requested a review from a team May 23, 2024 10:57
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6312420

@eskimor eskimor force-pushed the rk-broker-new-price-adapter branch from 4882a2a to 7e2992c Compare May 29, 2024 10:42
@eskimor
Copy link
Member Author

eskimor commented May 29, 2024

bot bench help

@command-bot
Copy link

command-bot bot commented May 29, 2024

@eskimor Unknown subcommand of "bench". Refer to help docs and/or source code.

@eskimor
Copy link
Member Author

eskimor commented May 29, 2024

bot bench substrate-pallet --pallet=pallet_broker

@command-bot
Copy link

command-bot bot commented May 29, 2024

@eskimor https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6338420 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker. Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 1-32355f27-7c3f-4ecb-81b8-18c5fd66045a to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented May 29, 2024

@eskimor Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6338420 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6338420/artifacts/download.

Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

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

Sweet, let's get it merged. Future models can add anything more general that is needed.

@eskimor eskimor enabled auto-merge May 29, 2024 20:54
@eskimor eskimor added this pull request to the merge queue May 29, 2024
Merged via the queue into master with commit f4dc8d2 May 29, 2024
156 of 157 checks passed
@eskimor eskimor deleted the rk-broker-new-price-adapter branch May 29, 2024 21:50
EgorPopelyaev pushed a commit that referenced this pull request May 30, 2024
Fixes #4360

Also rename: AllowedRenewals -> PotentialRenewals to avoid confusion of
future readers. (An entry in `AllowedRenewals` is not enough to allow a
renewal, the assignment also has to be complete, which is only checked
afterwards.)

- [x] Does not work with renewals as is - fix.
- [x] More tests
- [x] PR docs

Edit 1:
(Relevant blog post:
https://grillapp.net/12935/agile-coretime-pricing-explained-166522?ref=29715)

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: command-bot <>
ordian added a commit that referenced this pull request May 30, 2024
* master: (93 commits)
  Fix broken windows build (#4636)
  Beefy client generic on aduthority Id (#1816)
  pallet-staking: Put tests behind `cfg(debug_assertions)` (#4620)
  Broker new price adapter (#4521)
  Change `XcmDryRunApi::dry_run_extrinsic` to take a call instead (#4621)
  Update README.md (#4623)
  Publish `chain-spec-builder` (#4518)
  Add omni bencher & chain-spec-builder bins to release (#4557)
  Moves runtime macro out of experimental flag (#4249)
  Filter workspace dependencies in the templates (#4599)
  parachain-inherent: Make `para_id` more prominent (#4555)
  Add metric to measure the time it takes to gather enough assignments (#4587)
  Improve On_demand_assigner events (#4339)
  Conditional `required` checks (#4544)
  [CI] Deny adding git deps (#4572)
  [subsytem-bench] Remove redundant banchmark_name param (#4540)
  Add availability-recovery from systematic chunks (#1644)
  Remove workspace lints from templates (#4598)
  `sc-chain-spec`: deprecated code removed (#4410)
  [subsystem-benchmarks] Add statement-distribution benchmarks (#3863)
  ...
seadanda added a commit that referenced this pull request May 31, 2024
Only the price adapter changes are backported to avoid out-of-order migrations
seadanda added a commit that referenced this pull request Jun 3, 2024
Only the price adapter changes are backported to avoid out-of-order
migrations
seadanda added a commit that referenced this pull request Jun 3, 2024
seadanda added a commit that referenced this pull request Jun 3, 2024
Only the price adapter changes are backported to avoid out-of-order
migrations
ordian added a commit that referenced this pull request Jun 4, 2024
* master: (106 commits)
  [ci] Delete unused flow (#4676)
  Fix umbrella CI check and fix the C&P message (#4670)
  Add Dockerfiles to the templates (#4637)
  Revamp the Readme of the minimal template (#4649)
  Add chain-spec-builder docker image (#4655)
  Update Amforc bootnodes for Kusama and Polkadot (#4668)
  make all storage items in parachain-system public (#4645)
  [Pools] Refactors and runtime apis for DelegateStake (#4537)
  update amforc westend and its parachain bootnodes (#4641)
  Better error for missing index in CRV2 (#4643)
  Implement `XcmPaymentApi` and `DryRunApi` on all system parachains (#4634)
  Use Unlicense for templates (#4628)
  collator-protocol: remove `elastic-scaling-experimental` feature (#4595)
  Update `runtime_type` ref doc with the new "Associated Type Bounds" (#4624)
  Adds ability to specify chain type in chain-spec-builder (#4542)
  Fix broken windows build (#4636)
  Beefy client generic on aduthority Id (#1816)
  pallet-staking: Put tests behind `cfg(debug_assertions)` (#4620)
  Broker new price adapter (#4521)
  Change `XcmDryRunApi::dry_run_extrinsic` to take a call instead (#4621)
  ...
@seadanda seadanda mentioned this pull request Jun 4, 2024
EgorPopelyaev pushed a commit that referenced this pull request Jun 4, 2024
Related to #4521 and
#4656

This allows a release of the Broker pallet so the new price adapter can
be tested on Kusama ASAP
(polkadot-fellows/runtimes#334).
hitchhooker pushed a commit to ibp-network/polkadot-sdk that referenced this pull request Jun 5, 2024
Fixes paritytech#4360 

Also rename: AllowedRenewals -> PotentialRenewals to avoid confusion of
future readers. (An entry in `AllowedRenewals` is not enough to allow a
renewal, the assignment also has to be complete, which is only checked
afterwards.)

- [x] Does not work with renewals as is - fix.
- [x] More tests
- [x] PR docs

Edit 1:
(Relevant blog post:
https://grillapp.net/12935/agile-coretime-pricing-explained-166522?ref=29715)

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: command-bot <>
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
Fixes paritytech#4360 

Also rename: AllowedRenewals -> PotentialRenewals to avoid confusion of
future readers. (An entry in `AllowedRenewals` is not enough to allow a
renewal, the assignment also has to be complete, which is only checked
afterwards.)

- [x] Does not work with renewals as is - fix.
- [x] More tests
- [x] PR docs

Edit 1:
(Relevant blog post:
https://grillapp.net/12935/agile-coretime-pricing-explained-166522?ref=29715)

---------

Co-authored-by: eskimor <eskimor@no-such-url.com>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: command-bot <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R1-breaking_change This PR introduces a breaking change and should be highlighted in the upcoming release. T2-pallets This PR/Issue is related to a particular pallet.
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

Improve Coretime pricing
5 participants