Skip to content

Commit

Permalink
Merge pull request #421 from UniqueNetwork/release-v924011
Browse files Browse the repository at this point in the history
Release v924011
  • Loading branch information
kozyrevdev authored Jul 8, 2022
2 parents a458077 + 846700d commit 566036f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 122 deletions.
60 changes: 1 addition & 59 deletions pallets/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,65 +553,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {
use up_data_structs::{CollectionVersion1, CollectionVersion2};
<CollectionById<T>>::translate::<CollectionVersion1<T::AccountId>, _>(|id, v| {
let mut props = Vec::new();
if !v.offchain_schema.is_empty() {
props.push(Property {
key: b"_old_offchainSchema".to_vec().try_into().unwrap(),
value: v
.offchain_schema
.clone()
.into_inner()
.try_into()
.expect("offchain schema too big"),
});
}
if !v.variable_on_chain_schema.is_empty() {
props.push(Property {
key: b"_old_variableOnChainSchema".to_vec().try_into().unwrap(),
value: v
.variable_on_chain_schema
.clone()
.into_inner()
.try_into()
.expect("offchain schema too big"),
});
}
if !v.const_on_chain_schema.is_empty() {
props.push(Property {
key: b"_old_constOnChainSchema".to_vec().try_into().unwrap(),
value: v
.const_on_chain_schema
.clone()
.into_inner()
.try_into()
.expect("offchain schema too big"),
});
}
props.push(Property {
key: b"_old_schemaVersion".to_vec().try_into().unwrap(),
value: match v.schema_version {
SchemaVersion::ImageURL => b"ImageUrl".as_slice(),
SchemaVersion::Unique => b"Unique".as_slice(),
}
.to_vec()
.try_into()
.unwrap(),
});
Self::set_scoped_collection_properties(
id,
PropertyScope::None,
props.into_iter(),
)
.expect("existing data larger than properties");
let mut new = CollectionVersion2::from(v.clone());
new.permissions.access = Some(v.access);
new.permissions.mint_mode = Some(v.mint_mode);
Some(new)
});
}
StorageVersion::new(1).put::<Pallet<T>>();

0
}
Expand Down
56 changes: 1 addition & 55 deletions pallets/nonfungible/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,61 +183,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {
let mut had_consts = BTreeSet::new();
<TokenData<T>>::translate::<ItemDataVersion1<T::CrossAccountId>, _>(
|(collection, token), v| {
let mut props = vec![];
if !v.const_data.is_empty() {
props.push(Property {
key: b"_old_constData".to_vec().try_into().unwrap(),
value: v
.const_data
.clone()
.into_inner()
.try_into()
.expect("const too long"),
});
had_consts.insert(collection);
}
if !v.variable_data.is_empty() {
props.push(Property {
key: b"_old_variableData".to_vec().try_into().unwrap(),
value: v
.variable_data
.clone()
.into_inner()
.try_into()
.expect("variable too long"),
})
}
if !props.is_empty() {
Self::set_scoped_token_properties(
collection,
token,
PropertyScope::None,
props.into_iter(),
)
.expect("existing token data exceeds property storage");
}
Some(<ItemDataVersion2<T::CrossAccountId>>::from(v))
},
);
for collection in had_consts {
<PalletCommon<T>>::set_property_permission_unchecked(
collection,
PropertyKeyPermission {
key: b"_old_constData".to_vec().try_into().unwrap(),
permission: PropertyPermission {
mutable: false,
collection_admin: true,
token_owner: false,
},
},
)
.expect("failed to configure permission");
}
}
StorageVersion::new(1).put::<Pallet<T>>();

0
}
Expand Down
6 changes: 1 addition & 5 deletions pallets/refungible/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
if StorageVersion::get::<Pallet<T>>() < StorageVersion::new(1) {
<TokenData<T>>::translate_values::<ItemDataVersion1, _>(|v| {
Some(<ItemDataVersion2>::from(v))
})
}
StorageVersion::new(1).put::<Pallet<T>>();

0
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/opal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
spec_version: 924010,
spec_version: 924011,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
2 changes: 1 addition & 1 deletion runtime/quartz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
spec_version: 924010,
spec_version: 924011,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
2 changes: 1 addition & 1 deletion runtime/unique/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!(RUNTIME_NAME),
impl_name: create_runtime_str!(RUNTIME_NAME),
authoring_version: 1,
spec_version: 924010,
spec_version: 924011,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 566036f

Please sign in to comment.