-
Notifications
You must be signed in to change notification settings - Fork 732
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
Asset Conversion: Pool Account ID derivation with additional Pallet ID seed #3250
Conversation
This reverts commit 03363c8.
…rsion-pool-account
The CI pipeline was cancelled due to failure one of the required jobs. |
Review required! Latest push from author must always be reviewed |
@@ -2474,6 +2496,9 @@ mod runtime { | |||
|
|||
#[runtime::pallet_index(78)] | |||
pub type PalletExampleMbms = pallet_example_mbm; | |||
|
|||
#[runtime::pallet_index(79)] | |||
pub type AssetConversionMigration = pallet_asset_conversion_ops; |
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 you need to add the migration to this runtime? It's not live, is 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.
This runtime serves as an example of pallets integration. I think it make sense to have here.
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.
Not required, I'm guessing it was probably added for pallet benchmarks.
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.
true, we also need it for the benchmarks.
|
||
doc: | ||
- audience: Runtime Dev | ||
description: | |
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.
Shouldn't you mention the migration?
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.
Yes, I can improve this
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.
Updated
if let Some((depositor, deposit)) = | ||
T::AssetsRefund::deposit_held(asset1.clone(), prior_account.clone()) | ||
{ | ||
T::DepositAsset::mint_into(&depositor, deposit + deposit_asset_ed)?; |
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.
Why do you mint deposit + deposit_asset_ed
? Doesn't the depositor already have the deposit
?
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.
No, depositor might now have it. There is a comment above.
} | ||
); | ||
|
||
#[derive_impl(frame_system::config_preludes::TestDefaultConfig as frame_system::DefaultConfig)] |
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.
You can remove many types given that you're deriving the defaults. Take a look at:
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)] |
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.
updated
type MaxConsumers = ConstU32<16>; | ||
} | ||
|
||
impl pallet_balances::Config for Test { |
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.
If you use derive_impl
here, it means less maintenance when we add new config items to these traits.
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.
updated
type RuntimeFreezeReason = (); | ||
} | ||
|
||
impl pallet_assets::Config<Instance1> for Test { |
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.
Same
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.
updated
@@ -1013,4 +1018,28 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> { | |||
}) | |||
.collect::<Vec<_>>() | |||
} | |||
|
|||
/// Reset the team for the asset with the given `id`. |
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.
What's the "team" of an asset?
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.
is not it clear from arguments? this also how we name it in pallet's call
@franciscoaguirre all the comments addressed, can you have a look again please |
@@ -2474,6 +2496,9 @@ mod runtime { | |||
|
|||
#[runtime::pallet_index(78)] | |||
pub type PalletExampleMbms = pallet_example_mbm; | |||
|
|||
#[runtime::pallet_index(79)] | |||
pub type AssetConversionMigration = pallet_asset_conversion_ops; |
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.
Not required, I'm guessing it was probably added for pallet benchmarks.
/// Trait for resetting the team configuration of an existing fungible asset. | ||
pub trait ResetTeam<AccountId>: Inspect<AccountId> { | ||
/// Reset the team for the asset with the given `id`. | ||
/// | ||
/// ### Parameters | ||
/// - `id`: The identifier of the asset for which the team is being reset. | ||
/// - `owner`: The new `owner` account for the asset. | ||
/// - `admin`: The new `admin` account for the asset. | ||
/// - `issuer`: The new `issuer` account for the asset. | ||
/// - `freezer`: The new `freezer` account for the asset. | ||
fn reset_team( | ||
id: Self::AssetId, | ||
owner: AccountId, | ||
admin: AccountId, | ||
issuer: AccountId, | ||
freezer: AccountId, | ||
) -> DispatchResult; | ||
} |
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.
Not sure this belongs in lifetime.rs
.. Maybe roles.rs
?
substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs
Outdated
Show resolved
Hide resolved
substrate/frame/support/src/traits/tokens/fungibles/lifetime.rs
Outdated
Show resolved
Hide resolved
…D seed (#3250) Introduce `PalletId` as an additional seed parameter for pool's account id derivation. The PR also introduces the `pallet_asset_conversion_ops` pallet with a call to migrate a given pool to thew new account. Additionally `fungibles::lifetime::ResetTeam` and `fungible::lifetime::Refund` traits, to facilitate the migration of pools. --------- Co-authored-by: command-bot <>
Introduce
PalletId
as an additional seed parameter for pool's account id derivation.The PR also introduces the
pallet_asset_conversion_ops
pallet with a call to migrate a given pool to thew new account. Additionallyfungibles::lifetime::ResetTeam
andfungible::lifetime::Refund
traits, to facilitate the migration of pools.