From 64479288592e594e5afaf2954b6b525c4a9c6131 Mon Sep 17 00:00:00 2001 From: Chralt98 Date: Tue, 13 Aug 2024 15:26:37 +0200 Subject: [PATCH] fix corrupted markets, main-net endpoint, storage version --- Makefile | 2 +- zrml/market-commons/src/lib.rs | 2 +- zrml/market-commons/src/migrations.rs | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c4b4241c1..d6887defc 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ try-runtime-upgrade-battery-station: --execute-try-runtime try-runtime-upgrade-zeitgeist: - @$(MAKE) TRYRUNTIME_URL="wss://zeitgeist-rpc.dwellir.com:443" \ + @$(MAKE) TRYRUNTIME_URL="wss://zeitgeist.api.onfinality.io:443/public-ws" \ RUNTIME_PATH="./target/release/wbuild/zeitgeist-runtime/zeitgeist_runtime.compact.compressed.wasm" \ -- \ --execute-try-runtime diff --git a/zrml/market-commons/src/lib.rs b/zrml/market-commons/src/lib.rs index cce65a670..8a3deb0f9 100644 --- a/zrml/market-commons/src/lib.rs +++ b/zrml/market-commons/src/lib.rs @@ -57,7 +57,7 @@ mod pallet { }; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(11); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(12); pub(crate) type AccountIdOf = ::AccountId; pub(crate) type AssetOf = Asset>; diff --git a/zrml/market-commons/src/migrations.rs b/zrml/market-commons/src/migrations.rs index adf04862f..2ff04dd5b 100644 --- a/zrml/market-commons/src/migrations.rs +++ b/zrml/market-commons/src/migrations.rs @@ -17,7 +17,7 @@ // along with Zeitgeist. If not, see . use crate::{AccountIdOf, BalanceOf, Config, MarketIdOf, MomentOf, Pallet as MarketCommons}; -use alloc::vec::Vec; +use alloc::{vec, vec::Vec}; use core::marker::PhantomData; use frame_support::{ pallet_prelude::Weight, @@ -125,6 +125,18 @@ where } log::info!("MigrateDisputeMechanism: Starting..."); + // 879, 877, 878, 880, 882 markets have each campaign asset as the base asset, which is invalid + let bs_corrupted_market_ids: Vec> = + vec![879u32.into(), 877u32.into(), 878u32.into(), 880u32.into(), 882u32.into()]; + for market_id in bs_corrupted_market_ids { + if crate::Markets::::contains_key(market_id) + // this produces a decoding error for the corrupted markets + && crate::Markets::::try_get(market_id).is_err() + { + crate::Markets::::remove(market_id); + } + } + let mut translated = 0u64; crate::Markets::::translate::, _>(|_, old_market| { translated.saturating_inc();