Skip to content

Commit

Permalink
fix: testnet compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Supremesource committed Nov 13, 2024
1 parent 14deb82 commit 2b218d4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 41 deletions.
1 change: 1 addition & 0 deletions pallets/offworker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ std = [
]
try-runtime = ["frame-support/try-runtime"]
testing-offworker = []
testnet = []

[dependencies]
pallet-subnet-emission = { path = "../subnet_emission", default-features = false }
Expand Down
7 changes: 5 additions & 2 deletions pallets/subnet_emission/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ pub mod pallet {
use subnet_pricing::root::RootPricing;
use types::KeylessBlockWeights;

pub const STORAGE_VERSION: frame_support::traits::StorageVersion =
frame_support::traits::StorageVersion::new(0);
#[cfg(feature = "testnet")]
const STORAGE_VERSION: StorageVersion = StorageVersion::new(12);

#[cfg(not(feature = "testnet"))]
const STORAGE_VERSION: StorageVersion = StorageVersion::new(0);

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
Expand Down
18 changes: 11 additions & 7 deletions pallets/subspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,12 @@ pub use crate::params::{
};
use selections::{config, dispatches, errors, events, genesis, hooks};

#[cfg(not(feature = "testnet"))]
use selections::storage_v_mainnet as storage_v;

#[cfg(feature = "testnet")]
use selections::storage_v_testnet as storage_v;

#[import_section(genesis::genesis)]
#[import_section(errors::errors)]
#[import_section(events::events)]
#[import_section(dispatches::dispatches)]
#[import_section(hooks::hooks)]
#[import_section(config::config)]
#[import_section(storage_v::storage_version)]
#[frame_support::pallet]
pub mod pallet {
#![allow(deprecated, clippy::let_unit_value, clippy::too_many_arguments)]
Expand All @@ -92,6 +85,17 @@ pub mod pallet {

pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;

#[cfg(feature = "testnet")]
const STORAGE_VERSION: StorageVersion = StorageVersion::new(31);

#[cfg(not(feature = "testnet"))]
const STORAGE_VERSION: StorageVersion = StorageVersion::new(14);

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

// --- Subnet Storage ---
define_subnet_includes!(
double_maps: {
Expand Down
4 changes: 0 additions & 4 deletions pallets/subspace/src/selections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@ pub mod errors;
pub mod events;
pub mod genesis;
pub mod hooks;
#[cfg(not(feature = "testnet"))]
pub mod storage_v_mainnet;
#[cfg(feature = "testnet")]
pub mod storage_v_testnet;
Empty file.
13 changes: 0 additions & 13 deletions pallets/subspace/src/selections/storage_v_mainnet.rs

This file was deleted.

14 changes: 0 additions & 14 deletions pallets/subspace/src/selections/storage_v_testnet.rs

This file was deleted.

8 changes: 7 additions & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ substrate-wasm-builder = { workspace = true, optional = true }
[features]
default = ["std"]
testnet-faucet = ["pallet-faucet"]
testnet = []
testnet = [
"pallet-subspace/testnet",
"pallet-governance/testnet",
"pallet-offworker/testnet",
"pallet-subnet-emission/testnet",
"pallet-faucet/testnet",
]
std = [
"frame-try-runtime?/std",
"frame-system-benchmarking?/std",
Expand Down

0 comments on commit 2b218d4

Please sign in to comment.