mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 04:28:01 +00:00
More remote tests for bags-list pallet (#4065)
* Remote test for bags-list in westend * new tests * REVAMPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP * reset cargo.lock changes * revert lock file * fix * cargo update -p sp-io
This commit is contained in:
Generated
+324
-199
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -94,7 +94,7 @@ members = [
|
||||
"parachain/test-parachains/adder/collator",
|
||||
"utils/staking-miner",
|
||||
"utils/remote-ext-tests/bags-list",
|
||||
"utils/voter-bags",
|
||||
"utils/generate-bags",
|
||||
]
|
||||
|
||||
# We want to be able to build the bridge relayer without pulling it (and all of its
|
||||
|
||||
@@ -7,18 +7,14 @@ edition = "2018"
|
||||
[dependencies]
|
||||
polkadot-runtime = { version = "0.9.8", path = "../../../runtime/polkadot" }
|
||||
kusama-runtime = { version = "0.9.8", path = "../../../runtime/kusama" }
|
||||
westend-runtime = { version = "0.9.8", path = "../../../runtime/westend" }
|
||||
|
||||
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
pallet-bags-list-remote-tests = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
remote-externalities = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
tokio = { version = "1", features = ["macros"] }
|
||||
log = { version = "0.4.14" }
|
||||
structopt = {version = "0.3.25" }
|
||||
clap = { version = "2.33.3" }
|
||||
|
||||
@@ -14,53 +14,123 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Remote tests.
|
||||
//! Remote tests for bags-list pallet.
|
||||
|
||||
use clap::arg_enum;
|
||||
use std::convert::TryInto;
|
||||
use structopt::StructOpt;
|
||||
|
||||
mod voter_bags;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
enum Runtime {
|
||||
Kusama,
|
||||
Polkadot,
|
||||
arg_enum! {
|
||||
#[derive(Debug)]
|
||||
enum Command {
|
||||
CheckMigration,
|
||||
SanityCheck,
|
||||
Snapshot,
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Runtime {
|
||||
type Err = &'static str;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_lowercase().as_str() {
|
||||
"kusama" => Ok(Runtime::Kusama),
|
||||
"polkadot" => Ok(Runtime::Polkadot),
|
||||
_ => Err("wrong Runtime: can be 'polkadot' or 'kusama'."),
|
||||
}
|
||||
arg_enum! {
|
||||
#[derive(Debug)]
|
||||
enum Runtime {
|
||||
Polkadot,
|
||||
Kusama,
|
||||
Westend,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Cli {
|
||||
#[structopt(long, default_value = "wss://rpc.polkadot.io")]
|
||||
#[structopt(long, short, default_value = "wss://kusama-rpc.polkadot.io")]
|
||||
uri: String,
|
||||
#[structopt(long, short, default_value = "polkadot")]
|
||||
#[structopt(long, short, case_insensitive = true, possible_values = &Runtime::variants(), default_value = "kusama")]
|
||||
runtime: Runtime,
|
||||
#[structopt(long, short, case_insensitive = true, possible_values = &Command::variants(), default_value = "SanityCheck")]
|
||||
command: Command,
|
||||
#[structopt(long, short)]
|
||||
snapshot_limit: Option<usize>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let options = Cli::from_args();
|
||||
sp_tracing::try_init_simple();
|
||||
|
||||
log::info!(
|
||||
target: "remote-ext-tests",
|
||||
"using runtime {:?} / command: {:?}",
|
||||
options.runtime,
|
||||
options.command
|
||||
);
|
||||
|
||||
use pallet_bags_list_remote_tests::*;
|
||||
match options.runtime {
|
||||
Runtime::Kusama => {
|
||||
Runtime::Polkadot => sp_core::crypto::set_default_ss58_version(
|
||||
<polkadot_runtime::Runtime as frame_system::Config>::SS58Prefix::get()
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
),
|
||||
Runtime::Kusama => sp_core::crypto::set_default_ss58_version(
|
||||
<kusama_runtime::Runtime as frame_system::Config>::SS58Prefix::get()
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
),
|
||||
Runtime::Westend => sp_core::crypto::set_default_ss58_version(
|
||||
<westend_runtime::Runtime as frame_system::Config>::SS58Prefix::get()
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
),
|
||||
};
|
||||
|
||||
match (options.runtime, options.command) {
|
||||
(Runtime::Kusama, Command::CheckMigration) => {
|
||||
use kusama_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
voter_bags::test_voter_bags_migration::<Runtime, Block>(
|
||||
UNITS as u64,
|
||||
migration::execute::<Runtime, Block>(UNITS as u64, "KSM", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Kusama, Command::SanityCheck) => {
|
||||
use kusama_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
sanity_check::execute::<Runtime, Block>(UNITS as u64, "KSM", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Kusama, Command::Snapshot) => {
|
||||
use kusama_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
snapshot::execute::<Runtime, Block>(
|
||||
options.snapshot_limit,
|
||||
UNITS.try_into().unwrap(),
|
||||
options.uri.clone(),
|
||||
)
|
||||
.await;
|
||||
},
|
||||
Runtime::Polkadot => {
|
||||
|
||||
(Runtime::Westend, Command::CheckMigration) => {
|
||||
use westend_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
migration::execute::<Runtime, Block>(UNITS as u64, "WND", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Westend, Command::SanityCheck) => {
|
||||
use westend_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
sanity_check::execute::<Runtime, Block>(UNITS as u64, "WND", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Westend, Command::Snapshot) => {
|
||||
use westend_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
snapshot::execute::<Runtime, Block>(
|
||||
options.snapshot_limit,
|
||||
UNITS.try_into().unwrap(),
|
||||
options.uri.clone(),
|
||||
)
|
||||
.await;
|
||||
},
|
||||
|
||||
(Runtime::Polkadot, Command::CheckMigration) => {
|
||||
use polkadot_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
voter_bags::test_voter_bags_migration::<Runtime, Block>(
|
||||
UNITS as u64,
|
||||
migration::execute::<Runtime, Block>(UNITS as u64, "DOT", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Polkadot, Command::SanityCheck) => {
|
||||
use polkadot_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
sanity_check::execute::<Runtime, Block>(UNITS as u64, "DOT", options.uri.clone()).await;
|
||||
},
|
||||
(Runtime::Polkadot, Command::Snapshot) => {
|
||||
use polkadot_runtime::{constants::currency::UNITS, Block, Runtime};
|
||||
snapshot::execute::<Runtime, Block>(
|
||||
options.snapshot_limit,
|
||||
UNITS.try_into().unwrap(),
|
||||
options.uri.clone(),
|
||||
)
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user