Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration & it-tests for release-v0.5.4 #1356

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
4 changes: 2 additions & 2 deletions integration-tests/moonwall.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}
]
},
"envVars": ["LOG_LEVEL=debug", "VERBOSE_LOG"],
"envVars": ["LOG_LEVEL=debug", "VERBOSE_LOG=true"],
"buildBlockMode": "manual",
"connections": [
{
Expand Down Expand Up @@ -106,7 +106,7 @@
}
]
},
"envVars": ["LOG_LEVEL=debug", "VERBOSE_LOG"],
"envVars": ["LOG_LEVEL=debug", "VERBOSE_LOG=true"],
"buildBlockMode": "manual",
"connections": [
{
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zeitgeist-macros"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ description = "An evolving blockchain for prediction markets and futarchy."
edition.workspace = true
homepage = "https://zeitgeist.pm"
name = "zeitgeist-node"
version = "0.5.3"
version = "0.5.4"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ std = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zeitgeist-primitives"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion runtime/battery-station/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ force-debug = ["sp-debug-derive/force-debug"]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "battery-station-runtime"
version = "0.5.3"
version = "0.5.4"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
4 changes: 2 additions & 2 deletions runtime/battery-station/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("zeitgeist"),
impl_name: create_runtime_str!("zeitgeist"),
authoring_version: 1,
spec_version: 56,
spec_version: 57,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 29,
transaction_version: 30,
state_version: 1,
};

Expand Down
2 changes: 1 addition & 1 deletion runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "common-runtime"
version = "0.5.3"
version = "0.5.4"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
2 changes: 1 addition & 1 deletion runtime/zeitgeist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ force-debug = ["sp-debug-derive/force-debug"]
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zeitgeist-runtime"
version = "0.5.3"
version = "0.5.4"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
4 changes: 2 additions & 2 deletions runtime/zeitgeist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("zeitgeist"),
impl_name: create_runtime_str!("zeitgeist"),
authoring_version: 1,
spec_version: 56,
spec_version: 57,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 29,
transaction_version: 30,
state_version: 1,
};

Expand Down
2 changes: 1 addition & 1 deletion zrml/authorized/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-authorized"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/court/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-court"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/global-disputes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-global-disputes"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/hybrid-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-hybrid-router"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/market-commons/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-market-commons"
version = "0.5.3"
version = "0.5.4"
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
23 changes: 22 additions & 1 deletion zrml/market-commons/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use frame_support::{
use frame_system::pallet_prelude::BlockNumberFor;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{Perbill, RuntimeDebug, Saturating};
use sp_runtime::{Perbill, RuntimeDebug, SaturatedConversion, Saturating};
use zeitgeist_primitives::types::{
Asset, Deadlines, EarlyClose, Market, MarketBonds, MarketCreation, MarketDisputeMechanism,
MarketPeriod, MarketStatus, MarketType, OutcomeReport, Report, ScoringRule,
Expand Down Expand Up @@ -98,6 +98,8 @@ pub enum OldMarketDisputeMechanism {
const MARKET_COMMONS_REQUIRED_STORAGE_VERSION: u16 = 11;
const MARKET_COMMONS_NEXT_STORAGE_VERSION: u16 = 12;

const CORRUPTED_MARKET_IDS_BATTERY_STATION: [u32; 5] = [879u32, 877u32, 878u32, 880u32, 882u32];

#[cfg(feature = "try-runtime")]
#[frame_support::storage_alias]
pub(crate) type Markets<T: Config> =
Expand Down Expand Up @@ -125,6 +127,18 @@ where
}
log::info!("MigrateDisputeMechanism: Starting...");

// 879, 877, 878, 880, 882 markets on Battery Station
// each have a campaign asset as the base asset, which is invalid
for market_id in CORRUPTED_MARKET_IDS_BATTERY_STATION {
let market_id = market_id.saturated_into::<MarketIdOf<T>>();
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 Expand Up @@ -213,6 +227,13 @@ where
assert_eq!(old_market.bonds, new_market.bonds);
assert_eq!(old_market.early_close, new_market.early_close);
}

for market_id in CORRUPTED_MARKET_IDS_BATTERY_STATION {
let market_id = market_id.saturated_into::<MarketIdOf<T>>();
assert!(!crate::Markets::<T>::contains_key(market_id));
assert!(crate::Markets::<T>::try_get(market_id).is_err());
}

log::info!("MigrateDisputeMechanism: Post-upgrade market count is {}!", new_market_count);
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion zrml/neo-swaps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-neo-swaps"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/orderbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-orderbook"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/parimutuel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-parimutuel"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/prediction-markets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ try-runtime = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-prediction-markets"
version = "0.5.3"
version = "0.5.4"
2 changes: 1 addition & 1 deletion zrml/prediction-markets/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ std = [
authors = ["Zeitgeist PM <contact@zeitgeist.pm>"]
edition.workspace = true
name = "zrml-prediction-markets-runtime-api"
version = "0.5.3"
version = "0.5.4"
Loading
Loading