-
Notifications
You must be signed in to change notification settings - Fork 49
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 deposits migration #1636
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Xavier Lau <[email protected]>
f410124
to
7a91c09
Compare
@@ -86,5 +87,11 @@ fn migrate() -> frame_support::weights::Weight { | |||
]), | |||
); | |||
|
|||
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(r, w + 5) | |||
let _ = Balances::transfer_all( | |||
RuntimeOrigin::signed(PalletId(*b"dar/depo").into_account_truncating()), |
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.
The is still some CRAB left in deposit pallet account on Crab chain.
https://crab-scan.darwinia.network/address/0x6d6F646C6461722F6465706F0000000000000000
We also need to do the transfer migration for CRAB to clean it.
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 haven't noticed anything from a few days back. This might be due to the account migration.
@AurevoirXavier CI failed |
Signed-off-by: Xavier Lau <[email protected]>
pallet/deposit/src/lib.rs
Outdated
@@ -216,14 +213,13 @@ pub mod pallet { | |||
} | |||
|
|||
if to_claim.0 != 0 { | |||
T::Ring::transfer(&account_id(), who, to_claim.0, AllowDeath)?; | |||
T::Ring::transfer(&T::Treasury::get(), who, to_claim.0, AllowDeath)?; |
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.
Also emit failure event here if error.
runtime/crab/src/migration.rs
Outdated
@@ -52,6 +52,11 @@ fn migrate() -> frame_support::weights::Weight { | |||
} | |||
|
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.
Please remove previous migration which have been done in last upgrade.
Signed-off-by: Xavier Lau <[email protected]>
Signed-off-by: Xavier Lau <[email protected]>
{ | ||
Self::deposit_event(Event::MigrationFailedOnRefund); | ||
|
||
Err(e)?; |
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.
Do not throw errors, otherwise there are still side effects l.
Self::deposit_event(Event::DepositsClaimed { | ||
owner: who.clone(), | ||
deposits: to_claim.1, | ||
}); | ||
} | ||
if to_migrate.0 != 0 { | ||
T::Ring::transfer(&account_id(), &T::Treasury::get(), to_migrate.0, AllowDeath)?; | ||
T::DepositMigrator::migrate(who.clone(), to_migrate.0, to_migrate.2)?; |
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.
Should not throw errors here right?
Closes #1635.