BREAKING - Try-runtime: Use proper error types#13993
BREAKING - Try-runtime: Use proper error types#13993paritytech-processbot[bot] merged 38 commits intoparitytech:masterfrom
Conversation
|
@kianenigma @liamaharon PTAL. |
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
|
@Szegoo yes, it should work now. I fixed len for Lookup and we deployed today. I guess we need to re-tip you in the other PR again ) |
|
/tip medium |
|
/tip medium |
|
/tip medium |
|
/tip medium |
|
@mordamax A medium tip was successfully submitted for @Szegoo (DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS on kusama). https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-rpc.polkadot.io#/referenda |
|
Thanks @mordamax ! |
|
Hey @Szegoo did you use a script to rewrite all the changes ? |
|
@pgherveou I used basic vscode search and replace for You can do something like this: |
|
Ty ended up doing the same, was not too much trouble |
|
You also updated all the assert_eq -> ensure right in this pre/post upgrade methods |
Yes, that also needs to be updated. |
* Try-state: DispatchResult as return type * try_state for the rest of the pallets * pre_upgrade * post_upgrade * try_runtime_upgrade * fixes * bags-list fix * fix * update test * warning fix * ... * final fixes 🤞 * warning.. * frame-support * warnings * Update frame/staking/src/migrations.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * fix * fix warning * nit fix * merge fixes * small fix * should be good now * missed these ones * introduce TryRuntimeError and TryRuntimeResult * fixes * fix * removed TryRuntimeResult & made some fixes * fix testsg * tests passing * unnecessary imports * Update frame/assets/src/migration.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
|
@mordamax From my understanding by looking at this: https://kusama.subsquare.io/referenda/referendum/205 the proposal is approved and executed. But it seems like the tokens didn't get transferred from the treasury 🤔 |
|
@Szegoo thank you for pinging me back! |
|
/tip medium |
|
@rzadp A medium (5 KSM) tip was successfully submitted for @Szegoo (DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS on kusama). https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkusama-rpc.polkadot.io#/referenda |
* Try-state: DispatchResult as return type * try_state for the rest of the pallets * pre_upgrade * post_upgrade * try_runtime_upgrade * fixes * bags-list fix * fix * update test * warning fix * ... * final fixes 🤞 * warning.. * frame-support * warnings * Update frame/staking/src/migrations.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * fix * fix warning * nit fix * merge fixes * small fix * should be good now * missed these ones * introduce TryRuntimeError and TryRuntimeResult * fixes * fix * removed TryRuntimeResult & made some fixes * fix testsg * tests passing * unnecessary imports * Update frame/assets/src/migration.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
* Try-state: DispatchResult as return type * try_state for the rest of the pallets * pre_upgrade * post_upgrade * try_runtime_upgrade * fixes * bags-list fix * fix * update test * warning fix * ... * final fixes 🤞 * warning.. * frame-support * warnings * Update frame/staking/src/migrations.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * fix * fix warning * nit fix * merge fixes * small fix * should be good now * missed these ones * introduce TryRuntimeError and TryRuntimeResult * fixes * fix * removed TryRuntimeResult & made some fixes * fix testsg * tests passing * unnecessary imports * Update frame/assets/src/migration.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>


Updates the return types of:
try_statetoDispatchResultpre_upgradetoResult<_, DispatchError>post_upgradetoDispatchResulttry_on_runtime_upgradetoResult<Weight, DispatchError>TODO:
This PR introduces a new type inside
sp_runtimecalledTryRuntimeError. This new type is essentially just an alias to theDispatchErrortype. This only improves the readability of the code.All of the hooks that now have a different error type should no longer use
assert!or similar. The reason for this is that we don't want the code in these macros to panic, instead in case of an error we want to return theTryRuntimeErrortype.Since
TryRuntimeErroris an alias forDispatchErrorit allows us to use some existing error variants, but in case there isn't an existing variant that could convey the error message&'static strshould be used which will get converted toTryRuntimeErrorduring compile time.Polkadot companion: paritytech/polkadot#7146
Cumulus companion: paritytech/cumulus#2615
kusama address: DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS
Closes: #13736