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

Release centrifuge 1024 client 1035 #1607

Merged
merged 31 commits into from
Dec 7, 2023
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dbd5934
feat: new weights altair
mustermeiszer Nov 15, 2023
09bf25e
feat: new weights centrifuge
mustermeiszer Nov 15, 2023
6a5f505
wip
mustermeiszer Nov 15, 2023
0654dac
migrations: Add migration for account data
cdamian Nov 16, 2023
4d7e8c5
migrations: Adjust pre upgrade logic for accounts
cdamian Nov 20, 2023
44e5e7d
migrations: Log total count for accounts
cdamian Nov 20, 2023
71a1fc5
migrations: Log total count for accounts with frozen and reserved bal…
cdamian Nov 21, 2023
0e52d38
Merge branch 'main' into release-centrifuge_1024-client_1035
wischli Nov 21, 2023
6ef6cc5
deps: Remove double orml-tokens dep
cdamian Nov 21, 2023
f8d871e
migrations: Add test account data for balances
cdamian Nov 21, 2023
08ff938
fix: account info checks
wischli Nov 22, 2023
c4c754e
fix: local docker setup
wischli Nov 22, 2023
e8fbe8a
CI release bug fixes (#1611)
gpmayorga Nov 21, 2023
b80639b
Fix: Transfer debt (#1615)
mustermeiszer Nov 21, 2023
e84e22c
chore(deps): bump google-github-actions/auth from 1.1.1 to 1.2.0 (#1614)
dependabot[bot] Nov 22, 2023
cb2e474
fix: minor stuff balances migration
wischli Nov 22, 2023
2dd0a6b
chore: bump development version, rm dummy migration
wischli Nov 22, 2023
205024a
chore: bump MaxFeedValues from 10 to 500
wischli Nov 22, 2023
5299da0
Merge remote-tracking branch 'origin/main' into release-centrifuge_10…
mustermeiszer Dec 1, 2023
ab0a221
fix: toml versions
wischli Dec 1, 2023
2451724
fix: remove balance migration from runtimes
wischli Dec 1, 2023
0da6e58
refactor: remove balance migration from codebase
wischli Dec 1, 2023
9d4922e
chore: update dev weights
wischli Dec 4, 2023
84bf880
chore: update cfg weights
wischli Dec 4, 2023
27baf14
chore: altair weights
wischli Dec 4, 2023
a0ea8cb
fix: enable XCM benches for dev
wischli Dec 4, 2023
597f674
Merge remote-tracking branch 'origin/main' into release-centrifuge_10…
wischli Dec 4, 2023
bf0885e
chore: bump dev to 1035
wischli Dec 4, 2023
52ee34a
fix: missed renaming
wischli Dec 4, 2023
f01b929
chore: bump client to 0.10.35
wischli Dec 6, 2023
372606f
Merge branch 'main' into release-centrifuge_1024-client_1035
wischli Dec 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
mustermeiszer committed Nov 15, 2023
commit 6a5f50524d301f6f2f6941979af81e7a7e6ba1db
76 changes: 76 additions & 0 deletions runtime/common/src/migrations/balances.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2021 Centrifuge Foundation (centrifuge.io).
//
// This file is part of the Centrifuge chain project.
// Centrifuge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version (see http://www.gnu.org/licenses).
// Centrifuge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

use frame_support::{traits::OnRuntimeUpgrade, weights::Weight};
use sp_runtime::DispatchError;

Check warning on line 14 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

unused import: `sp_runtime::DispatchError`

/// All balance information for an account.
#[derive(Encode, Decode, Clone, PartialEq, Eq, Default, RuntimeDebug, MaxEncodedLen, TypeInfo)]

Check failure on line 17 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

cannot find derive macro `Encode` in this scope

Check failure on line 17 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

cannot find derive macro `Decode` in this scope

Check failure on line 17 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

cannot find derive macro `RuntimeDebug` in this scope

Check failure on line 17 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

cannot find derive macro `MaxEncodedLen` in this scope

Check failure on line 17 in runtime/common/src/migrations/balances.rs

GitHub Actions / docs

cannot find derive macro `TypeInfo` in this scope
pub struct OldAccountData<Balance> {
/// Non-reserved part of the balance. There may still be restrictions on
/// this, but it is the total pool what may in principle be transferred,
/// reserved and used for tipping.
///
/// This is the only balance that matters in terms of most operations on
/// tokens. It alone is used to determine the balance when in the contract
/// execution environment.
pub free: Balance,
/// Balance which is reserved and may not be used at all.
///
/// This can still get slashed, but gets slashed last of all.
///
/// This balance is a 'reserve' balance that other subsystems use in order
/// to set aside tokens that are still 'owned' by the account holder, but
/// which are suspendable. This includes named reserve and unnamed reserve.
pub reserved: Balance,
/// The amount that `free` may not drop below when withdrawing for *anything
/// except transaction fee payment*.
pub misc_frozen: Balance,
/// The amount that `free` may not drop below when withdrawing specifically
/// for transaction fee payment.
pub fee_frozen: Balance,
}

pub struct Migration<T: pallet_balances::Config>(sp_std::marker::PhantomData<T>);

impl<T> OnRuntimeUpgrade for Migration<T>
where
T: pallet_balances::Config,
{
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, DispatchError> {
// CHECKING DECODING OLD DATASTRUCTURE WITH NEW LAYOUT WORKS:
// * Fetch storage from chain with NEW data structure
// * Check if fetched accounts matches on-chain storage entries

// TODO:
// * Research whether orml-pallets datastructure also changed
// * Research whether we need to migrate locks in orml (maybe first check if
// there exist any. ^^
Copy link
Contributor

@wischli wischli Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orml-tokens has not updated their AccountData yet:
https://github.com/open-web3-stack/open-runtime-module-library/blob/8f59b50ab45d15572d18cee0425966e43567a954/tokens/src/lib.rs#L142-L160

I would assume, they won't do that to not force consumers into synchronous migrations. In Substrate, the misc_frozen field of AccountData was replaced with flags. However, both fields have the same size which removes the requirement of a sync migration: https://github.com/paritytech/substrate/pull/12951/files#r1140113642

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, just thought that it might be a good idea to have similar checks like we do for the normal accounts. No actual migrations taking place, just us having some checks before the upgrade itself. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is a good idea!


let accounts = frame_system::Account::<T>::full_storage_key;

Ok(Vec::new())
}

fn on_runtime_upgrade() -> Weight {
// WE CAN NOT MIGRATE. THIS CODE IS JUST FOR CHECKING IF WE NEED ANYTHING
// BESIDES THE LAZY MIGRATION FROM PARITY
// See: https://kflabs.slack.com/archives/C05TBFRBL15/p1699956615421249
Weight::from_parts(0, 0)
}

#[cfg(feature = "try-runtime")]
fn post_upgrade(_: Vec<u8>) -> Result<(), DispatchError> {
Ok(())
}
}
1 change: 1 addition & 0 deletions runtime/common/src/migrations/mod.rs
Original file line number Diff line number Diff line change
@@ -13,5 +13,6 @@
//! Centrifuge Runtime-Common Migrations

pub mod asset_registry_xcmv3;
pub mod balances;
pub mod nuke;
pub mod precompile_account_codes;