Skip to content

Commit

Permalink
Add identity and collator_selection migrations (#1248)
Browse files Browse the repository at this point in the history
  • Loading branch information
hqwangningbo authored May 17, 2024
1 parent 4fe7cd8 commit 6028c1f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
15 changes: 8 additions & 7 deletions runtime/bifrost-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ use frame_support::{
OnUnbalanced,
},
};
use frame_system::pallet_prelude::BlockNumberFor;
use frame_system::{EnsureRoot, EnsureRootWithSuccess, EnsureSigned};
use frame_system::{
pallet_prelude::BlockNumberFor, EnsureRoot, EnsureRootWithSuccess, EnsureSigned,
};
use hex_literal::hex;
use orml_oracle::{DataFeeder, DataProvider, DataProviderExtended};
use pallet_identity::legacy::IdentityInfo;
Expand Down Expand Up @@ -501,8 +502,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
},
ProxyType::IdentityJudgement => matches!(
c,
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })
| RuntimeCall::Utility(..)
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
),
}
}
Expand Down Expand Up @@ -1119,12 +1120,11 @@ impl FeeGetter<RuntimeCall> for ExtraFeeMatcher {
extra_fee_name: ExtraFeeName::StatemineTransfer,
extra_fee_currency: RelayCurrencyId::get(),
},
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::vote { vtoken, .. }) => {
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::vote { vtoken, .. }) =>
ExtraFeeInfo {
extra_fee_name: ExtraFeeName::VoteVtoken,
extra_fee_currency: vtoken.to_token().unwrap_or(vtoken),
}
},
},
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::remove_delegator_vote {
vtoken,
..
Expand Down Expand Up @@ -2071,6 +2071,7 @@ pub mod migrations {
BountiesPalletName,
<Runtime as frame_system::Config>::DbWeight,
>,
pallet_identity::migration::versioned::V0ToV1<Runtime, 100>,
);
}

Expand Down
28 changes: 15 additions & 13 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ use frame_support::{
Currency, EitherOf, EitherOfDiverse, Get, LinearStoragePrice,
},
};
use frame_system::pallet_prelude::BlockNumberFor;
use frame_system::{EnsureRoot, EnsureRootWithSuccess, EnsureSigned};
use frame_system::{
pallet_prelude::BlockNumberFor, EnsureRoot, EnsureRootWithSuccess, EnsureSigned,
};
use hex_literal::hex;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
// zenlink imports
Expand Down Expand Up @@ -459,20 +460,20 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
),
ProxyType::Governance => matches!(
c,
RuntimeCall::Democracy(..)
| RuntimeCall::Council(..)
| RuntimeCall::TechnicalCommittee(..)
| RuntimeCall::PhragmenElection(..)
| RuntimeCall::Treasury(..)
| RuntimeCall::Utility(..)
RuntimeCall::Democracy(..) |
RuntimeCall::Council(..) |
RuntimeCall::TechnicalCommittee(..) |
RuntimeCall::PhragmenElection(..) |
RuntimeCall::Treasury(..) |
RuntimeCall::Utility(..)
),
ProxyType::CancelProxy => {
matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }))
},
ProxyType::IdentityJudgement => matches!(
c,
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })
| RuntimeCall::Utility(..)
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility(..)
),
}
}
Expand Down Expand Up @@ -971,12 +972,11 @@ impl FeeGetter<RuntimeCall> for ExtraFeeMatcher {
extra_fee_name: ExtraFeeName::StatemineTransfer,
extra_fee_currency: RelayCurrencyId::get(),
},
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::vote { vtoken, .. }) => {
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::vote { vtoken, .. }) =>
ExtraFeeInfo {
extra_fee_name: ExtraFeeName::VoteVtoken,
extra_fee_currency: vtoken.to_token().unwrap_or(vtoken),
}
},
},
RuntimeCall::VtokenVoting(bifrost_vtoken_voting::Call::remove_delegator_vote {
vtoken,
..
Expand Down Expand Up @@ -1886,6 +1886,8 @@ pub mod migrations {
BountiesPalletName,
<Runtime as frame_system::Config>::DbWeight,
>,
pallet_identity::migration::versioned::V0ToV1<Runtime, 100>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
);
}

Expand Down

0 comments on commit 6028c1f

Please sign in to comment.