-
Notifications
You must be signed in to change notification settings - Fork 707
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
Improve On_demand_assigner events #4339
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.
Thanks! Left a few nits and triggered CI for you. Please remove unrelated formatting changes as well.
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.
Hey @bolajahmad o/
Always happy to have some external contributors so if you need any help please feel free to ping me.
- OnDemandOrderPlaced looking good
- SpotTrafficSet needs changes
I think there is a small misunderstanding so let me clear it up:
Eskimor:
SpotTrafficSet This value will be largely useless for people, maybe we should have a SpotPriceSet?
SpotTrafficSet is used in the update_spot_traffic call. What is the intended effect of changing the EventName to SpotPriceSet, especilly if the resulting event has the same arguments?
I assume that Eskimor meant not only renaming that event but also changing what it actually represents (to be in-line with the new name). The new event should represent the actual SpotPrice instead of the Traffic component. It seems that this might be much more useful for users.
Notice that if both SpotPriceSet
as proposed by Eskimor and OnDemandOrderPlaced
have the spot price then in case of an order being made we would get a double event with the same thing. This might not be undesirable IMO.
TODO:
- rename
SpotTrafficSet
toSpotPriceSet
- After updating traffic calculate spot price and deposit it in that new
SpotPriceSet
event
@eskimor I'm not sure if I agree with:
Issue SpotTrafficSet ... only if price changed without an order getting placed.
First of all I assume you meant SpotPriceSet
otherwise it seems inconsistent with what you said earlier.
Issue here is that SpotPrice can also change when orders are placed so someone could easily follow this event thinking he has the most up to date spot price which would be false if we emit it only when price changed without an order getting placed.
I suggest always emitting this spot price update (traffic goes down due to no orders or orders boost the price up). Then we can either drop the spot price from the OnDemandOrderPlaced
event or simply have it in both places for absolute clarity.
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.
A lot of formatting nits. We use nightly fmt cargo +nightly fmt --all
. Feel free to run locally and see the changes yourself.
For more details feel free to read this: https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/STYLE_GUIDE.md
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.
Running the cargo +nightly fmt --all
worked but some of the formatting remained inconsistent with the styleguide example.
I'll try to run it while paying more attention if there's an issue
…n module; restored changes in cargo.lock
Hey @bolajahmad Thanks for fixing it! Seems we are nearly good to go and the only item missing is the PRdoc. I see that you've added it into the description of that PR but what you need to do is put it in a file in this folder: Name it
Once you get that done we can do a final review and merge 🚀 |
bot fmt |
@eskimor https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6311702 was started for your command Comment |
@eskimor Command |
bot fmt |
@eskimor https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6324500 was started for your command Comment |
@eskimor Command |
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.
Would be nice to get the remaining formatting inconsistencies fixed. Other than that looks good.
650b124
/// An order was placed at some spot price amount. | ||
OnDemandOrderPlaced { para_id: ParaId, spot_price: BalanceOf<T> }, | ||
/// The value of the spot traffic multiplier changed. | ||
SpotTrafficSet { traffic: FixedU128 }, | ||
/// An order was placed at some spot price amount by orderer ordered_by | ||
OnDemandOrderPlaced { para_id: ParaId, spot_price: BalanceOf<T>, ordered_by: T::AccountId }, | ||
/// The value of the spot price has likely changed | ||
SpotPriceSet { spot_price: BalanceOf<T> }, |
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.
This may be problematic as you're changing the formats of the existing events here. As events from the previous block are reset after the runtime upgrade but before running any hooks, event storage must always be compatible. So, technically, this part needs more care.
Buuuut, given that, IIUC,
OnDemandOrderPlaced
was never deposited by the previous version of the code, andSpotPriceSet
internal representation is the same, asBalanceOf<T>
coincides withFixedU128
in all the current use cases,
it may be safe to leave it as is.
That said, some more research is needed on how safe it is.
* 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) ...
title: Improving `on_demand_assigner` emitted events doc: - audience: Rutime User description: OnDemandOrderPlaced event that is useful for indexers to save data related to on demand orders. Check [discussion here](https://substrate.stackexchange.com/questions/11366/ondemandassignmentprovider-ondemandorderplaced-event-was-removed/11389#11389). Closes paritytech#4254 crates: [ 'runtime-parachain] --------- Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
title: Improving `on_demand_assigner` emitted events doc: - audience: Rutime User description: OnDemandOrderPlaced event that is useful for indexers to save data related to on demand orders. Check [discussion here](https://substrate.stackexchange.com/questions/11366/ondemandassignmentprovider-ondemandorderplaced-event-was-removed/11389#11389). Closes paritytech#4254 crates: [ 'runtime-parachain] --------- Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
title: Improving `on_demand_assigner` emitted events doc: - audience: Rutime User description: OnDemandOrderPlaced event that is useful for indexers to save data related to on demand orders. Check [discussion here](https://substrate.stackexchange.com/questions/11366/ondemandassignmentprovider-ondemandorderplaced-event-was-removed/11389#11389). Closes paritytech#4254 crates: [ 'runtime-parachain] --------- Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
title: Improving
on_demand_assigner
emitted eventsdoc:
description: OnDemandOrderPlaced event that is useful for indexers to save data related to on demand orders. Check discussion here.
Closes #4254
crates: [ 'runtime-parachain]