Skip to content

Commit

Permalink
fix corrupted markets, main-net endpoint, storage version
Browse files Browse the repository at this point in the history
  • Loading branch information
Chralt98 committed Aug 13, 2024
1 parent 0b858a2 commit 6447928
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion zrml/market-commons/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = <T as frame_system::Config>::AccountId;
pub(crate) type AssetOf<T> = Asset<MarketIdOf<T>>;
Expand Down
14 changes: 13 additions & 1 deletion zrml/market-commons/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// along with Zeitgeist. If not, see <https://www.gnu.org/licenses/>.

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,
Expand Down Expand Up @@ -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<MarketIdOf<T>> =
vec![879u32.into(), 877u32.into(), 878u32.into(), 880u32.into(), 882u32.into()];
for market_id in bs_corrupted_market_ids {
if crate::Markets::<T>::contains_key(market_id)
// this produces a decoding error for the corrupted markets
&& crate::Markets::<T>::try_get(market_id).is_err()
{
crate::Markets::<T>::remove(market_id);
}
}

let mut translated = 0u64;
crate::Markets::<T>::translate::<OldMarketOf<T>, _>(|_, old_market| {
translated.saturating_inc();
Expand Down

0 comments on commit 6447928

Please sign in to comment.