Skip to content

Commit

Permalink
Add Migration for Unlinking Reserved Tickers Mappings (#1769)
Browse files Browse the repository at this point in the history
* Add migration for unlinking AssetIdTicker for reserved tickers

* Add logs

* Add logs to new migration

* Add TickerRegistered event

* Add check for not updating expiry when expiry is none

* Remove unnecessary reads

---------

Co-authored-by: Robert Gabriel Jakabosky <rjakabosky+neopallium@neoawareness.com>
  • Loading branch information
HenriqueNogara and Neopallium authored Dec 27, 2024
1 parent a59ad90 commit 7f87afa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 452 deletions.
10 changes: 4 additions & 6 deletions pallets/asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ type Identity<T> = pallet_identity::Module<T>;
type Portfolio<T> = pallet_portfolio::Module<T>;
type Statistics<T> = pallet_statistics::Module<T>;

storage_migration_ver!(5);
storage_migration_ver!(6);

decl_storage! {
trait Store for Module<T: Config> as Asset {
Expand Down Expand Up @@ -245,7 +245,7 @@ decl_storage! {
pub AssetNonce: map hasher(identity) T::AccountId => u64;

/// Storage version.
StorageVersion get(fn storage_version) build(|_| Version::new(5)): Version;
StorageVersion get(fn storage_version) build(|_| Version::new(6)): Version;
}

add_extra_genesis {
Expand Down Expand Up @@ -291,11 +291,9 @@ decl_module! {
fn deposit_event() = default;

fn on_runtime_upgrade() -> Weight {
storage_migrate_on!(StorageVersion, 5, {
migrations::migrate_to_v5::<T>();
storage_migrate_on!(StorageVersion, 6, {
migrations::migrate_to_v6::<T>();
});
// Only needed on staging, but safe to run on other networks.
migrations::migrate_to_v5_fixup_asset_id_maps::<T>();

Weight::zero()
}
Expand Down
Loading

0 comments on commit 7f87afa

Please sign in to comment.