Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Improve deposits migration #1636

wants to merge 7 commits into from

Conversation

AurevoirXavier
Copy link
Member

@AurevoirXavier AurevoirXavier commented Nov 29, 2024

Closes #1635.

@AurevoirXavier AurevoirXavier added C-Pallet [Component] Something about pallet C-Runtime [Component] Something about runtime labels Nov 29, 2024
Signed-off-by: Xavier Lau <[email protected]>
Copy link

Check df9ebc8 darwinia-dev

Check runtime version

Check runtime storage

Copy link

Check df9ebc8 koi-dev

Check runtime version

Check runtime storage

Copy link

Check df9ebc8 crab-dev

Check runtime version

Check runtime storage

@@ -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()),
Copy link
Contributor

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.

Copy link
Member Author

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.

@hackfisher
Copy link
Contributor

@AurevoirXavier CI failed

Signed-off-by: Xavier Lau <[email protected]>
@@ -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)?;
Copy link
Contributor

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.

@@ -52,6 +52,11 @@ fn migrate() -> frame_support::weights::Weight {
}

Copy link
Contributor

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]>
{
Self::deposit_event(Event::MigrationFailedOnRefund);

Err(e)?;
Copy link
Contributor

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)?;
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Pallet [Component] Something about pallet C-Runtime [Component] Something about runtime
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Filter non-zero deposit items during migration
2 participants