-
Notifications
You must be signed in to change notification settings - Fork 41
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
ZIP-0 Part II #938
ZIP-0 Part II #938
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #938 +/- ##
==========================================
+ Coverage 94.39% 94.53% +0.13%
==========================================
Files 93 95 +2
Lines 21060 21564 +504
==========================================
+ Hits 19880 20385 +505
+ Misses 1180 1179 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
After the merge from main into this branch, I currently can't get the try-runtime tests running because of the HTTP Additionally I had to do the following:
Shall I commit the addition of I noted these down:
Let me do these once we remove the |
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.
- Benchmark improved
- Try-runtime works
- General design improvement issue created
- PM tests extended
Shall I commit the addition of --no-spec-name-check?
No, we should leave it out as the makefile target is called during runtime releases, where the --no-spec-name-check
is important.
Once the remaining review comments are addresses I am ready to approve.
primitives/src/market.rs
Outdated
} | ||
|
||
#[derive(Default)] | ||
pub enum MDMWeight<MarketId, AccountId, Balance, BlockNumber, Moment, Asset> { |
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.
What's the purpose of this? It seems to me that it over-complicates things. What is the benefit of having this structure instead of just providing the function parameters directly to the respective functions, i.e. the parameters of <function>_weight
and <function>
are equal.
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.
What would you specify as default weight in the #[pallet::weight()]
macro? It doesn't seem easy to put the market id and market inside there.
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.
It depends on what the benchmarks depend on. I would do the following: All the parameters are optional. If a parameter is None
, it's maximum value is used. Otherwise the value provided is used.
I think the following approach would make even more sense:
- Every function in the
DisputeApi
returnsResultWithWeightInfo
. - Every function in the
DisputeApi
has a functionmaximum_weight
The functions of step 2 are used to determine the default weight in #[pallet::weight()]
, the functions of step 1 are used within the actual execution of the dispatchable (inside PM) to retrieve the result and the actual weight that is used to correct the weight later down the road.
To keep things tidy, it might make sense to create an additional Api for the worst-case weights.
What do you think about this? I am open to discuss it to find the best approach.
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.
Co-authored-by: Harald Heckmann <[email protected]>
Co-authored-by: Harald Heckmann <[email protected]>
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.
Last few points (please fix if it's possible without too many changes):
Changelog entry is missing. You'll have to mergemain
into the RC branch and then into this branch to get the newest version of the changelog.We decided to get rid of simple-disputes. Why don't we do that here (@sea212)?See discussion on discord.- Licenses need to be updated.
log::info!( | ||
"AddOutsiderAndDisputeBond: Market Counter post-upgrade is {}!", | ||
new_market_count | ||
); | ||
assert!(new_market_count > 0); |
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.
I think this was supposed to check that the old and new market counts are the same?
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.
assert_eq!(old_markets.len(), new_market_count);
This assert is above the other checks. assert!(new_market_count > 0);
was meant to check that we actually found markets for <zrml_market_commons::Pallet<T>>::market_iter().count()
(the new market structure).
Co-authored-by: Malte Kliemann <[email protected]>
* ZIP-0 Part II (#938) * move disputes to simple-disputes * move more to simple-disputes * wip * wip * some mock preparation * wip * fix tests * taplo fmt * update court authorized mdms * add dispute bond to market storage * mdm funds flow * fix clippy * fix pm benchmarks * add migration * simplify migration * correct migration * migration fixes and call filter * correct admin_destroy_market benchmark * improve simple-disputes mock * benchmark reserve_outcome * benchmark reserve_outcome * fix weights file * fix after merge * add migration tests * add migration reserve id test * apply review suggestions * rename reserve_outcome to suggest_outcome * separate resolve_disputed_market into parts * edit exchange API documentation * slash dispute bond * add empty commit * correct admin_destroy_market test * remove gd dependency from simple disputes * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * add doc string * add doc strings * Reduce settle_bonds LOC * cargo fmt * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * apply review suggestion * add correct mdm benchmarking on_dispute * use on_dispute_weight inside api * improve mdm weight technique * add mdm weights to on_resolution * add tests for pm * modify migration logs, fix try-runtime * little benchmark fix * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * use result with weight struct * improve dispute api weight system * Use accurate dispute weight instead of max * fix clippy * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Malte Kliemann <[email protected]> * add copyrights --------- Co-authored-by: Harald Heckmann <[email protected]> Co-authored-by: Malte Kliemann <[email protected]> * fix clippy * fix clippy * Update dependencies to v0.9.38 * More dependency updates * Update standalone runtimes * Fix build with feature runtime-benchmark * Update Zeitgeist parachain runtime * Update Battery Station parachain runtime * Deduplicated dependencies * Make tests succeed for parachain runtime * Partially fix Zeitgeist xcm tests * Make all runtime tests succeed * Update standalone client * Update parachain node * Add migrations * Cargo fmt * Satisfy Clippy * Cargo fmt * Taplo format * Update licenses * remove outsider bond from migration * Reduce runtime test dependencies by half * small changes * Add missing runtime-benchmark feature * Use upper case copyright name Strange, locally the copyright script says: "All copyright notices are up to date! 🍉" On GH pipeline: "error: zrml/prediction-markets/src/benchmarks.rs: no copyright notice for Forecasting Technologies LTD found" * Remove test logger * Implement Production Court (#976) * apply review suggestions * rename reserve_outcome to suggest_outcome * separate resolve_disputed_market into parts * add debug asserts * document types * modify sort check * avoid double remove * clarify docs * avoid mut * binary search by account id * Revert "binary search by account id" This reverts commit c04d5ff. * make pool item key unique * use secure random number generator * add tests * add tests * found bug in exit court * correct slashable * fix exit court * correct tests * fix bug, add tests * fix second get_winner bug * modify tests * fix draw active lock bug, add tests * rename total_slashable to consumed_stake * update config parameters, tests * modify params and add tests * add denounce tests * increase code safety * add tests * add tests * edit exchange API documentation * slash dispute bond * add empty commit * correct admin_destroy_market test * revert get_resolution_outcome to on_resolution * remove gd dependency from simple disputes * use appealed outcomes for global dispute * modify appeal bond formula * remove slash percentages * benchmark court * Update zrml/court/src/types.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/types.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/mock_storage.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * periods to round timing, modify tests * modify doc comments * use onunbalanced * improve RequestInterval documentation * improve consumed_stake documentation * remove court from filter * add treasury to court * correct errors * update comment * update get_pool_item comment * update get_pool_item comment * comment juror pool * improve doc comments * cargo fmt * rename constants * edit court pallet doc * update tests * rename secret to commitment * make commit reveal failsafer * outsource commitment function * update doc comments * merge punish tardy jurors reassign juror stakes * outsource get_n_random_numbers * correct logs * rename default to get * improve extrinsic comments * simplify choose_multiple_weighted * improve naming * remove back_global_dispute * unlock jurors from last draws * improve error description * shorten mock periods * document private functions * add assert to check max appeals * add stake to juror joined event * correct test * improve test * update reassigned event comment * correct test * add assert check * improve tests for draws * add reveal vote invalid salt fails test * denounce slash inside reassign_juror_stakes * improve test readibility * rename periods to cycle_ends * add select jurors test * change randomness source in court tests * fix clippy * imrpove tests * remove cccount lookup in tests * improve test setup * add API tests, add missing unlockings * add full cycle court tests * remove invalid test * add missing WeightInfo * add inflation inside court * improve benchmarking and testing * add integrity_test * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * add doc string * add doc strings * Reduce settle_bonds LOC * cargo fmt * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * apply review suggestion * add GDItem integration * add delegations * improve code structure * fix benchmarks * optimize logic * add correct mdm benchmarking on_dispute * use on_dispute_weight inside api * improve mdm weight technique * add mdm weights to on_resolution * add tests for pm * modify migration logs, fix try-runtime * adjust tests for binary search * improve benchmarking * do small change * little benchmark fix * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * use result with weight struct * improve code * update benchmark and weights * improve dispute api weight system * test delegations for reassign * correct benchmarks and test * remove comment * add API benchmarks * update weights * use generic vote item instead of outcome report * update to court id and generic court * fix stuff and add documentation * add court readme, use new parameters * improve naming, weighting * Use accurate dispute weight instead of max * take random ranges without replacement * switch get_random_number algo * integrate court and reject simple disputes * update start_global_dispute bench * fix clippy * use efficient draw without replacement algorithm * small edits * round to min juror stake, use other draw algo * use partial fisher yates algorithm * improve naming and comments * update changelog for devs * improve dispute api documentation * correct call filters * add copyright notice * remove is_outcome and is_binary * remove unnecessary "Court" prefix * update copyright notices * remove front end comment * Update zrml/court/README.md Co-authored-by: Malte Kliemann <[email protected]> * npx prettier court readme * improve style of terminology * update readme * remove unnecessary impl block * update comment * remove todo * make reward_pot package private * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * update integrity test * improve join court doc * improve extrinsic documentation * update delegate doc * make some types package private * fix struct comment * update readme * update readme * remove commitment matcher * fix doc string * remove unnecessary error * improve import * improve test case * fix inflation misbehaviour * improve round timing structure * improve error names * fix get_valid_delegated_juror * remove wrong break * update weight for select jurors * allow rejoin after exit preparation * remove unnecessary apis * improve naming and docs * fix clippy * fix copyrights * update changelog for devs * Update runtime/common/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * comment benchmark components * comment benchmark component * Update zrml/court/README.md Co-authored-by: Harald Heckmann <[email protected]> * add terminology for court * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * restructure import * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * use mul_floor and reduce indentation * safe guard inflation emission * use imbalance for minting * use saturated div * logging if inflation period mint too high * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * reduce court InflationPeriod for Battery Station * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * fmt * fix tests * fix issue tokens without burn * remove unnecessary error return * allow equal amount to previous stake --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * [Global Disputes] Fix issues after first battery station live test (#912) * apply review suggestions * use keep alive * cargo fmt * use function instead of raw * improve documentation * improve 2 outcome check * start gd requires two unqiue outcomes * fix error * add empty commit * correct admin_destroy_market test * revert get_resolution_outcome to on_resolution * remove gd dependency from simple disputes * fix clippy * use appealed outcomes for global dispute * fix tests and benchmarks * modify appeal bond formula * remove slash percentages * test default toolchain * benchmark court * Update zrml/court/src/types.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/types.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/mock_storage.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * Update zrml/court/src/tests.rs Co-authored-by: Malte Kliemann <[email protected]> * periods to round timing, modify tests * modify doc comments * use onunbalanced * improve RequestInterval documentation * improve consumed_stake documentation * remove court from filter * add treasury to court * correct errors * update comment * update get_pool_item comment * update get_pool_item comment * comment juror pool * improve doc comments * cargo fmt * rename constants * edit court pallet doc * update tests * rename secret to commitment * make commit reveal failsafer * outsource commitment function * Update scripts/tests/misc.sh * update doc comments * merge punish tardy jurors reassign juror stakes * outsource get_n_random_numbers * correct logs * rename default to get * improve extrinsic comments * simplify choose_multiple_weighted * improve naming * remove back_global_dispute * unlock jurors from last draws * improve error description * shorten mock periods * document private functions * add assert to check max appeals * add stake to juror joined event * correct test * improve test * update reassigned event comment * correct test * add assert check * improve tests for draws * add reveal vote invalid salt fails test * denounce slash inside reassign_juror_stakes * improve test readibility * rename periods to cycle_ends * add select jurors test * change randomness source in court tests * fix clippy * imrpove tests * remove cccount lookup in tests * improve test setup * add API tests, add missing unlockings * add full cycle court tests * remove invalid test * add missing WeightInfo * add inflation inside court * improve benchmarking and testing * add integrity_test * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/simple-disputes/src/mock.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * add doc string * add doc strings * Reduce settle_bonds LOC * cargo fmt * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/prediction-markets/src/migrations.rs Co-authored-by: Harald Heckmann <[email protected]> * apply review suggestion * add GDItem integration * add delegations * improve code structure * fix benchmarks * optimize logic * add correct mdm benchmarking on_dispute * use on_dispute_weight inside api * improve mdm weight technique * add mdm weights to on_resolution * add tests for pm * modify migration logs, fix try-runtime * adjust tests for binary search * improve benchmarking * do small change * little benchmark fix * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/authorized/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * use result with weight struct * improve code * update benchmark and weights * improve dispute api weight system * test delegations for reassign * correct benchmarks and test * remove comment * add API benchmarks * update weights * use generic vote item instead of outcome report * update to court id and generic court * fix stuff and add documentation * add court readme, use new parameters * improve naming, weighting * Use accurate dispute weight instead of max * take random ranges without replacement * add start_global_dispute tests * add test * fix typo * switch get_random_number algo * integrate court and reject simple disputes * update start_global_dispute bench * fix clippy * use efficient draw without replacement algorithm * small edits * round to min juror stake, use other draw algo * use partial fisher yates algorithm * improve naming and comments * update changelog for devs * improve dispute api documentation * correct call filters * add copyright notice * remove is_outcome and is_binary * remove unnecessary "Court" prefix * update copyright notices * remove front end comment * Update zrml/court/README.md Co-authored-by: Malte Kliemann <[email protected]> * npx prettier court readme * improve style of terminology * update readme * remove unnecessary impl block * update comment * remove todo * make reward_pot package private * Update zrml/court/src/lib.rs Co-authored-by: Malte Kliemann <[email protected]> * update integrity test * improve join court doc * improve extrinsic documentation * update delegate doc * make some types package private * fix struct comment * update readme * update readme * remove commitment matcher * fix doc string * remove unnecessary error * improve import * improve test case * fix inflation misbehaviour * improve round timing structure * improve error names * fix get_valid_delegated_juror * remove wrong break * update weight for select jurors * allow rejoin after exit preparation * remove unnecessary apis * improve naming and docs * fix clippy * correct migrations * fix copyrights * fmt * fix clippy * fix copyrights * update changelog for devs * Update runtime/common/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * comment benchmark components * comment benchmark component * Update zrml/court/README.md Co-authored-by: Harald Heckmann <[email protected]> * add terminology for court * Update zrml/prediction-markets/src/benchmarks.rs Co-authored-by: Harald Heckmann <[email protected]> * restructure import * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * use mul_floor and reduce indentation * safe guard inflation emission * use imbalance for minting * use saturated div * logging if inflation period mint too high * fix after merge * update changelog for devs * use imperative * fmt * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * reduce court InflationPeriod for Battery Station * Update zrml/court/src/lib.rs Co-authored-by: Harald Heckmann <[email protected]> * fmt * fix tests * fix issue tokens without burn * remove unnecessary error return * Update Makefile * allow equal amount to previous stake --------- Co-authored-by: Malte Kliemann <[email protected]> Co-authored-by: Harald Heckmann <[email protected]> * activate court and GD on battery station * bump storage version of market commons * Update runtime/zeitgeist/src/lib.rs * Update runtime/zeitgeist/src/lib.rs * Revert "Reduce runtime test dependencies by half" This reverts commit fe589a5. * Update weight templates * Use header option for benchmarks Also format benchmark script and moves header file into HEADER_GPL3. * Update rust-toolchain * Satisfy clippy * Use patched wasm-builder for new rustc * Format * Update licenses --------- Co-authored-by: Harald Heckmann <[email protected]> Co-authored-by: Malte Kliemann <[email protected]>
This is a continuation of #862.
reserve_outcome
extrinsic tosimple-disputes
, which contains the moved parts from the previous pm-palletoutcome
parameter ofdispute
extrinsicdispute
once in the pm-palletDisputeBond
inside the market storageOracleBond
, if the resolved outcome by the MDM is not equal to the oracle reportsimple-disputes
when MaxDisputes reachedIncludes migrations:
authorized
use the first dispute value insidepm Disputes
to save this in storage as themarket.bonds.dispute
simple-disputes
pm Disputes
tosd Disputes
Disputes
storage item insidesimple-disputes
and move the data fromDisputes
of the pm-pallet to the storage item of thesimple-disputes
palletTODO:
Disputes
storage item inside the pm-pallet after the migration was processedAppendix:
market.bonds.dispute
value stored forsimple-disputes
, because the bonds are stored insideDisputes
of simple-disputes