-
Notifications
You must be signed in to change notification settings - Fork 2.6k
BREAKING - Try-runtime: Use proper error types #13993
BREAKING - Try-runtime: Use proper error types #13993
Conversation
@kianenigma @liamaharon PTAL. |
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.
LGTM. Just some errors on cargo c --features try-runtime
still to fix it looks like.
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
@liamaharon Thanks for the tip! @mordamax I would also like to use my Kusama address here also. Is the tip-bot working with opengov now? |
@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_state
toDispatchResult
pre_upgrade
toResult<_, DispatchError>
post_upgrade
toDispatchResult
try_on_runtime_upgrade
toResult<Weight, DispatchError>
TODO:
This PR introduces a new type inside
sp_runtime
calledTryRuntimeError
. This new type is essentially just an alias to theDispatchError
type. 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 theTryRuntimeError
type.Since
TryRuntimeError
is an alias forDispatchError
it allows us to use some existing error variants, but in case there isn't an existing variant that could convey the error message&'static str
should be used which will get converted toTryRuntimeError
during compile time.Polkadot companion: paritytech/polkadot#7146
Cumulus companion: paritytech/cumulus#2615
kusama address: DfqY6XQUSETTszBQ1juocTcG9iiDoXhvq1CoVadBSUqTGJS
Closes: #13736