From b8ffd62c50d2462d37b852a347764ef1e7d63458 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Wed, 9 Apr 2025 15:19:43 +0200 Subject: [PATCH] upgrade tests --- distance-oracle/src/mock.rs | 2 +- end2end-tests/tests/common/balances.rs | 39 +- end2end-tests/tests/common/cert.rs | 11 +- end2end-tests/tests/common/distance.rs | 18 +- end2end-tests/tests/common/identity.rs | 27 +- end2end-tests/tests/common/mod.rs | 67 +++- end2end-tests/tests/common/oneshot.rs | 36 +- end2end-tests/tests/cucumber_tests.rs | 56 +-- pallets/authority-members/src/mock.rs | 1 + pallets/distance/src/mock.rs | 12 +- pallets/duniter-wot/src/mock.rs | 11 +- resources/metadata.scale | Bin 152810 -> 156528 bytes runtime/gdev/tests/balance_tests.rs | 44 +-- runtime/gdev/tests/common/mod.rs | 4 +- runtime/gdev/tests/fee_tests.rs | 58 ++- runtime/gdev/tests/integration_tests.rs | 456 ++++++++++-------------- runtime/gdev/tests/xt_tests.rs | 91 +++-- 17 files changed, 448 insertions(+), 485 deletions(-) diff --git a/distance-oracle/src/mock.rs b/distance-oracle/src/mock.rs index 881022205..727637290 100644 --- a/distance-oracle/src/mock.rs +++ b/distance-oracle/src/mock.rs @@ -25,7 +25,7 @@ pub struct Client { wot: RustyWebOfTrust, pub pool_len: usize, } -pub type AccountId = subxt::ext::sp_runtime::AccountId32; +pub type AccountId = sp_runtime::AccountId32; pub type IdtyIndex = u32; pub type H256 = subxt::utils::H256; diff --git a/end2end-tests/tests/common/balances.rs b/end2end-tests/tests/common/balances.rs index e7b703736..b1c469e2b 100644 --- a/end2end-tests/tests/common/balances.rs +++ b/end2end-tests/tests/common/balances.rs @@ -15,10 +15,11 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use super::{gdev, gdev::runtime_types::pallet_balances, *}; -use sp_keyring::AccountKeyring; -use subxt::{tx::PairSigner, utils::MultiAddress}; +use crate::common::pair_signer::PairSigner; +use sp_keyring::sr25519::Keyring; +use subxt::utils::MultiAddress; -pub async fn set_balance(client: &FullClient, who: AccountKeyring, amount: u64) -> Result<()> { +pub async fn set_balance(client: &FullClient, who: Keyring, amount: u64) -> Result<()> { let _events = create_block_with_extrinsic( &client.rpc, client @@ -29,7 +30,7 @@ pub async fn set_balance(client: &FullClient, who: AccountKeyring, amount: u64) .sudo() .sudo(gdev::runtime_types::gdev_runtime::RuntimeCall::Balances( pallet_balances::pallet::Call::force_set_balance { - who: MultiAddress::Id(who.to_account_id().into()), + who: MultiAddress::Id(who.to_raw_public().into()), new_free: amount, }, )), @@ -43,14 +44,9 @@ pub async fn set_balance(client: &FullClient, who: AccountKeyring, amount: u64) Ok(()) } -pub async fn transfer( - client: &FullClient, - from: AccountKeyring, - amount: u64, - to: AccountKeyring, -) -> Result<()> { +pub async fn transfer(client: &FullClient, from: Keyring, amount: u64, to: Keyring) -> Result<()> { let from = PairSigner::new(from.pair()); - let to = to.to_account_id(); + let to = MultiAddress::Id(to.to_raw_public().into()); let _events = create_block_with_extrinsic( &client.rpc, @@ -58,9 +54,7 @@ pub async fn transfer( .client .tx() .create_signed( - &gdev::tx() - .universal_dividend() - .transfer_ud(to.clone().into(), amount), + &gdev::tx().universal_dividend().transfer_ud(to, amount), &from, SubstrateExtrinsicParamsBuilder::new().build(), ) @@ -71,13 +65,9 @@ pub async fn transfer( Ok(()) } -pub async fn transfer_all( - client: &FullClient, - from: AccountKeyring, - to: AccountKeyring, -) -> Result<()> { +pub async fn transfer_all(client: &FullClient, from: Keyring, to: Keyring) -> Result<()> { let from = PairSigner::new(from.pair()); - let to = to.to_account_id(); + let to = MultiAddress::Id(to.to_raw_public().into()); let _events = create_block_with_extrinsic( &client.rpc, @@ -85,7 +75,7 @@ pub async fn transfer_all( .client .tx() .create_signed( - &gdev::tx().balances().transfer_all(to.into(), false), + &gdev::tx().balances().transfer_all(to, false), &from, SubstrateExtrinsicParamsBuilder::new().build(), ) @@ -98,12 +88,11 @@ pub async fn transfer_all( pub async fn transfer_ud( client: &FullClient, - from: AccountKeyring, + from: Keyring, amount: u64, - to: AccountKeyring, + to: Keyring, ) -> Result<()> { let from = PairSigner::new(from.pair()); - let to = to.to_account_id(); let _events = create_block_with_extrinsic( &client.rpc, @@ -113,7 +102,7 @@ pub async fn transfer_ud( .create_signed( &gdev::tx() .universal_dividend() - .transfer_ud(to.clone().into(), amount), + .transfer_ud(MultiAddress::Id(to.to_raw_public().into()), amount), &from, SubstrateExtrinsicParamsBuilder::new().build(), ) diff --git a/end2end-tests/tests/common/cert.rs b/end2end-tests/tests/common/cert.rs index bccd2db93..2841643e0 100644 --- a/end2end-tests/tests/common/cert.rs +++ b/end2end-tests/tests/common/cert.rs @@ -15,13 +15,14 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use super::{gdev, gdev::runtime_types::pallet_certification, *}; -use sp_keyring::AccountKeyring; -use subxt::{tx::PairSigner, utils::MultiAddress}; +use crate::common::pair_signer::PairSigner; +use sp_keyring::sr25519::Keyring; +use subxt::utils::MultiAddress; -pub async fn certify(client: &FullClient, from: AccountKeyring, to: AccountKeyring) -> Result<()> { +pub async fn certify(client: &FullClient, from: Keyring, to: Keyring) -> Result<()> { let signer = PairSigner::new(from.pair()); - let from: subxt::utils::AccountId32 = from.to_account_id().into(); - let to: subxt::utils::AccountId32 = to.to_account_id().into(); + let from: subxt::utils::AccountId32 = from.to_raw_public().into(); + let to: subxt::utils::AccountId32 = to.to_raw_public().into(); let _issuer_index = client .client diff --git a/end2end-tests/tests/common/distance.rs b/end2end-tests/tests/common/distance.rs index f7d02df55..a08893ba4 100644 --- a/end2end-tests/tests/common/distance.rs +++ b/end2end-tests/tests/common/distance.rs @@ -15,15 +15,11 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use super::{gdev, gdev::runtime_types::pallet_identity, *}; -use crate::DuniterWorld; -use sp_keyring::AccountKeyring; -use subxt::{ - backend::rpc::RpcClient, - tx::{PairSigner, Signer}, - utils::AccountId32, -}; +use crate::{common::pair_signer::PairSigner, DuniterWorld}; +use sp_keyring::sr25519::Keyring; +use subxt::{backend::rpc::RpcClient, tx::Signer, utils::AccountId32}; -pub async fn request_evaluation(client: &FullClient, origin: AccountKeyring) -> Result<()> { +pub async fn request_evaluation(client: &FullClient, origin: Keyring) -> Result<()> { let origin = PairSigner::new(origin.pair()); let _events = create_block_with_extrinsic( @@ -43,11 +39,7 @@ pub async fn request_evaluation(client: &FullClient, origin: AccountKeyring) -> Ok(()) } -pub async fn run_oracle( - client: &FullClient, - origin: AccountKeyring, - rpc_url: String, -) -> Result<()> { +pub async fn run_oracle(client: &FullClient, origin: Keyring, rpc_url: String) -> Result<()> { let origin = PairSigner::new(origin.pair()); let account_id: &AccountId32 = origin.account_id(); diff --git a/end2end-tests/tests/common/identity.rs b/end2end-tests/tests/common/identity.rs index da532a67e..00c806e76 100644 --- a/end2end-tests/tests/common/identity.rs +++ b/end2end-tests/tests/common/identity.rs @@ -15,9 +15,12 @@ // along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>. use super::{gdev, gdev::runtime_types::pallet_identity, *}; -use crate::{gdev::runtime_types::pallet_identity::types::IdtyName, DuniterWorld}; -use sp_keyring::AccountKeyring; -use subxt::tx::PairSigner; +use crate::{ + common::pair_signer::PairSigner, gdev::runtime_types::pallet_identity::types::IdtyName, + DuniterWorld, +}; +use sp_keyring::sr25519::Keyring; +use subxt::config::substrate::MultiAddress; type BlockNumber = u32; type AccountId = subxt::utils::AccountId32; @@ -27,13 +30,9 @@ type IdtyValue = // submit extrinsics -pub async fn create_identity( - client: &FullClient, - from: AccountKeyring, - to: AccountKeyring, -) -> Result<()> { +pub async fn create_identity(client: &FullClient, from: Keyring, to: Keyring) -> Result<()> { let from = PairSigner::new(from.pair()); - let to = to.to_account_id(); + let to = to.to_raw_public(); let _events = create_block_with_extrinsic( &client.rpc, @@ -52,11 +51,7 @@ pub async fn create_identity( Ok(()) } -pub async fn confirm_identity( - client: &FullClient, - from: AccountKeyring, - pseudo: String, -) -> Result<()> { +pub async fn confirm_identity(client: &FullClient, from: Keyring, pseudo: String) -> Result<()> { let from = PairSigner::new(from.pair()); let pseudo: IdtyName = IdtyName(pseudo.as_bytes().to_vec()); @@ -79,9 +74,9 @@ pub async fn confirm_identity( // get identity index from account keyring name pub async fn get_identity_index(world: &DuniterWorld, account: String) -> Result<u32> { - let account: AccountId = AccountKeyring::from_str(&account) + let account: AccountId = Keyring::from_str(&account) .expect("unknown account") - .to_account_id() + .to_raw_public() .into(); let identity_index = world diff --git a/end2end-tests/tests/common/mod.rs b/end2end-tests/tests/common/mod.rs index 5f8230da5..c3acaa66b 100644 --- a/end2end-tests/tests/common/mod.rs +++ b/end2end-tests/tests/common/mod.rs @@ -32,7 +32,7 @@ use anyhow::anyhow; use codec::Encode; use notify_debouncer_mini::new_debouncer; use serde_json::Value; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; use std::{ io::prelude::*, path::{Path, PathBuf}, @@ -41,29 +41,28 @@ use std::{ time::{Duration, Instant}, }; use subxt::{ - backend::rpc::{RpcClient, RpcParams}, + backend::rpc::RpcClient, config::{substrate::SubstrateExtrinsicParamsBuilder, SubstrateExtrinsicParams}, - ext::{sp_core, sp_runtime}, - rpc_params, + ext::subxt_rpcs::client::{rpc_params, RpcParams}, }; pub type Client = subxt::OnlineClient<GdevConfig>; pub type Event = gdev::Event; pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; -pub type SubmittableExtrinsic = subxt::tx::SubmittableExtrinsic<GdevConfig, Client>; +pub type SubmittableExtrinsic = subxt::tx::SubmittableTransaction<GdevConfig, Client>; pub type TxProgress = subxt::tx::TxProgress<GdevConfig, Client>; pub enum GdevConfig {} impl subxt::config::Config for GdevConfig { type AccountId = subxt::utils::AccountId32; - type Address = sp_runtime::MultiAddress<Self::AccountId, u32>; + type Address = subxt::utils::MultiAddress<Self::AccountId, u32>; type AssetId = (); type ExtrinsicParams = SubstrateExtrinsicParams<Self>; type Hash = subxt::utils::H256; type Hasher = subxt::config::substrate::BlakeTwo256; type Header = subxt::config::substrate::SubstrateHeader<u32, subxt::config::substrate::BlakeTwo256>; - type Signature = sp_runtime::MultiSignature; + type Signature = subxt::utils::MultiSignature; } #[derive(Copy, Clone, Debug, Default, Encode)] @@ -89,7 +88,7 @@ impl From<u64> for Tip { } } -pub const SUDO_ACCOUNT: AccountKeyring = AccountKeyring::Alice; +pub const SUDO_ACCOUNT: Keyring = Keyring::Alice; pub struct Process(std::process::Child); impl Process { @@ -339,3 +338,55 @@ pub fn spawn_distance_oracle(distance_oracle_binary_path: &str, duniter_rpc_port .wait() .unwrap(); } + +/// A concrete PairSigner implementation which relies on `sr25519::Pair` for signing +/// and where GdevConfig is the runtime configuration. +mod pair_signer { + use super::*; + use sp_core::{sr25519, Pair as _}; + use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + MultiSignature as SpMultiSignature, + }; + use subxt::{ + config::substrate::{AccountId32, MultiSignature}, + tx::Signer, + Config, + }; + + #[derive(Clone)] + pub struct PairSigner { + account_id: <GdevConfig as Config>::AccountId, + signer: sr25519::Pair, + } + + impl PairSigner { + pub fn new(signer: sr25519::Pair) -> Self { + let account_id = + <SpMultiSignature as Verify>::Signer::from(signer.public()).into_account(); + Self { + account_id: AccountId32(account_id.into()), + signer, + } + } + + pub fn signer(&self) -> &sr25519::Pair { + &self.signer + } + + pub fn account_id(&self) -> &AccountId32 { + &self.account_id + } + } + + impl Signer<GdevConfig> for PairSigner { + fn account_id(&self) -> <GdevConfig as Config>::AccountId { + self.account_id.clone() + } + + fn sign(&self, signer_payload: &[u8]) -> <GdevConfig as Config>::Signature { + let signature = self.signer.sign(signer_payload); + MultiSignature::Sr25519(signature.0) + } + } +} diff --git a/end2end-tests/tests/common/oneshot.rs b/end2end-tests/tests/common/oneshot.rs index bcfe65dc8..255d5fd4a 100644 --- a/end2end-tests/tests/common/oneshot.rs +++ b/end2end-tests/tests/common/oneshot.rs @@ -19,15 +19,13 @@ use super::{ gdev::runtime_types::{pallet_balances, pallet_oneshot_account}, *, }; -use sp_keyring::AccountKeyring; -use subxt::{ - tx::PairSigner, - utils::{AccountId32, MultiAddress}, -}; +use crate::common::pair_signer::PairSigner; +use sp_keyring::sr25519::Keyring; +use subxt::utils::{AccountId32, MultiAddress}; pub enum Account { - Normal(AccountKeyring), - Oneshot(AccountKeyring), + Normal(Keyring), + Oneshot(Keyring), } impl Account { @@ -35,24 +33,24 @@ impl Account { &self, ) -> pallet_oneshot_account::types::Account<MultiAddress<AccountId32, ()>> { match self { - Account::Normal(account) => { - pallet_oneshot_account::types::Account::Normal(account.to_account_id().into()) - } - Account::Oneshot(account) => { - pallet_oneshot_account::types::Account::Oneshot(account.to_account_id().into()) - } + Account::Normal(account) => pallet_oneshot_account::types::Account::Normal( + MultiAddress::Id(account.to_raw_public().into()), + ), + Account::Oneshot(account) => pallet_oneshot_account::types::Account::Oneshot( + MultiAddress::Id(account.to_raw_public().into()), + ), } } } pub async fn create_oneshot_account( client: &FullClient, - from: AccountKeyring, + from: Keyring, amount: u64, - to: AccountKeyring, + to: Keyring, ) -> Result<()> { let from = PairSigner::new(from.pair()); - let to = to.to_account_id(); + let to = MultiAddress::Id(to.to_raw_public().into()); let _events = create_block_with_extrinsic( &client.rpc, @@ -62,7 +60,7 @@ pub async fn create_oneshot_account( .create_signed( &gdev::tx() .oneshot_account() - .create_oneshot_account(to.into(), amount), + .create_oneshot_account(to, amount), &from, SubstrateExtrinsicParamsBuilder::new().build(), ) @@ -75,7 +73,7 @@ pub async fn create_oneshot_account( pub async fn consume_oneshot_account( client: &FullClient, - from: AccountKeyring, + from: Keyring, to: Account, ) -> Result<()> { let from = PairSigner::new(from.pair()); @@ -101,7 +99,7 @@ pub async fn consume_oneshot_account( #[allow(clippy::too_many_arguments)] pub async fn consume_oneshot_account_with_remaining( client: &FullClient, - from: AccountKeyring, + from: Keyring, amount: u64, to: Account, remaining_to: Account, diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs index c65302732..2599ca7d5 100644 --- a/end2end-tests/tests/cucumber_tests.rs +++ b/end2end-tests/tests/cucumber_tests.rs @@ -18,7 +18,7 @@ mod common; use common::*; use cucumber::{given, then, when, StatsWriter, World}; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; use std::{ path::PathBuf, str::FromStr, @@ -169,7 +169,7 @@ fn parse_amount(amount: u64, unit: &str) -> (u64, bool) { #[given(regex = r"([a-zA-Z]+) ha(?:ve|s) (\d+) (ĞD|cĞD|UD|mUD)")] async fn who_have(world: &mut DuniterWorld, who: String, amount: u64, unit: String) -> Result<()> { // Parse inputs - let who = AccountKeyring::from_str(&who).expect("unknown to"); + let who = Keyring::from_str(&who).expect("unknown to"); let (mut amount, is_ud) = parse_amount(amount, &unit); if is_ud { @@ -208,8 +208,8 @@ async fn transfer( to: String, ) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); let (amount, is_ud) = parse_amount(amount, &unit); let res = if is_ud { @@ -235,8 +235,8 @@ async fn create_oneshot_account( to: String, ) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); let (amount, is_ud) = parse_amount(amount, &unit); assert!(!is_ud); @@ -253,8 +253,8 @@ async fn consume_oneshot_account( to: String, ) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); let to = match is_dest_oneshot.as_str() { "oneshot" => common::oneshot::Account::Oneshot(to), "account" => common::oneshot::Account::Normal(to), @@ -280,9 +280,9 @@ async fn consume_oneshot_account_with_remaining( remaining_to: String, ) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); - let remaining_to = AccountKeyring::from_str(&remaining_to).expect("unknown remaining_to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); + let remaining_to = Keyring::from_str(&remaining_to).expect("unknown remaining_to"); let to = match is_dest_oneshot.as_str() { "oneshot" => common::oneshot::Account::Oneshot(to), "account" => common::oneshot::Account::Normal(to), @@ -311,8 +311,8 @@ async fn consume_oneshot_account_with_remaining( #[when(regex = r"([a-zA-Z]+) sends? all (?:his|her) (?:ĞDs?|DUs?|UDs?) to ([a-zA-Z]+)")] async fn send_all_to(world: &mut DuniterWorld, from: String, to: String) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); common::balances::transfer_all(world.full_client(), from, to).await } @@ -321,8 +321,8 @@ async fn send_all_to(world: &mut DuniterWorld, from: String, to: String) -> Resu #[when(regex = r"([a-zA-Z]+) certifies ([a-zA-Z]+)")] async fn certifies(world: &mut DuniterWorld, from: String, to: String) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); common::cert::certify(world.full_client(), from, to).await } @@ -331,8 +331,8 @@ async fn certifies(world: &mut DuniterWorld, from: String, to: String) -> Result #[when(regex = r"([a-zA-Z]+) creates identity for ([a-zA-Z]+)")] async fn creates_identity(world: &mut DuniterWorld, from: String, to: String) -> Result<()> { // Parse inputs - let from = AccountKeyring::from_str(&from).expect("unknown from"); - let to = AccountKeyring::from_str(&to).expect("unknown to"); + let from = Keyring::from_str(&from).expect("unknown from"); + let to = Keyring::from_str(&to).expect("unknown to"); common::identity::create_identity(world.full_client(), from, to).await } @@ -340,7 +340,7 @@ async fn creates_identity(world: &mut DuniterWorld, from: String, to: String) -> #[allow(clippy::needless_pass_by_ref_mut)] #[when(regex = r#"([a-zA-Z]+) confirms (?:his|her) identity with pseudo "([a-zA-Z]+)""#)] async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String) -> Result<()> { - let from = AccountKeyring::from_str(&from).expect("unknown from"); + let from = Keyring::from_str(&from).expect("unknown from"); common::identity::confirm_identity(world.full_client(), from, pseudo).await } @@ -348,7 +348,7 @@ async fn confirm_identity(world: &mut DuniterWorld, from: String, pseudo: String #[allow(clippy::needless_pass_by_ref_mut)] #[when(regex = r#"([a-zA-Z]+) requests distance evaluation"#)] async fn request_distance_evaluation(world: &mut DuniterWorld, who: String) -> Result<()> { - let who = AccountKeyring::from_str(&who).expect("unknown origin"); + let who = Keyring::from_str(&who).expect("unknown origin"); common::distance::request_evaluation(world.full_client(), who).await } @@ -356,7 +356,7 @@ async fn request_distance_evaluation(world: &mut DuniterWorld, who: String) -> R #[allow(clippy::needless_pass_by_ref_mut)] #[when(regex = r#"([a-zA-Z]+) runs distance oracle"#)] async fn run_distance_oracle(world: &mut DuniterWorld, who: String) -> Result<()> { - let who = AccountKeyring::from_str(&who).expect("unknown origin"); + let who = Keyring::from_str(&who).expect("unknown origin"); common::distance::run_oracle( world.full_client(), @@ -398,9 +398,9 @@ async fn should_have( reserved: String, ) -> Result<()> { // Parse inputs - let who: subxt::utils::AccountId32 = AccountKeyring::from_str(&who) + let who: subxt::utils::AccountId32 = Keyring::from_str(&who) .expect("unknown to") - .to_account_id() + .to_raw_public() .into(); let (amount, _is_ud) = parse_amount(amount, &unit); @@ -425,9 +425,9 @@ async fn should_have_oneshot( unit: String, ) -> Result<()> { // Parse inputs - let who: subxt::utils::AccountId32 = AccountKeyring::from_str(&who) + let who: subxt::utils::AccountId32 = Keyring::from_str(&who) .expect("unknown to") - .to_account_id() + .to_raw_public() .into(); let (amount, _is_ud) = parse_amount(amount, &unit); @@ -475,13 +475,13 @@ async fn should_be_certified_by( issuer: String, ) -> Result<()> { // Parse inputs - let receiver_account: subxt::utils::AccountId32 = AccountKeyring::from_str(&receiver) + let receiver_account: subxt::utils::AccountId32 = Keyring::from_str(&receiver) .expect("unknown to") - .to_account_id() + .to_raw_public() .into(); - let issuer_account: subxt::utils::AccountId32 = AccountKeyring::from_str(&issuer) + let issuer_account: subxt::utils::AccountId32 = Keyring::from_str(&issuer) .expect("unknown to") - .to_account_id() + .to_raw_public() .into(); // get corresponding identities index diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs index 1a582ef73..23dcd5a66 100644 --- a/pallets/authority-members/src/mock.rs +++ b/pallets/authority-members/src/mock.rs @@ -103,6 +103,7 @@ impl ShouldEndSession<u64> for TestShouldEndSession { } impl pallet_session::Config for Test { + type DisablingStrategy = (); type Keys = MockSessionKeys; type NextSessionRotation = (); type RuntimeEvent = RuntimeEvent; diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs index 23f865212..e72adceae 100644 --- a/pallets/distance/src/mock.rs +++ b/pallets/distance/src/mock.rs @@ -51,7 +51,16 @@ impl From<[u8; 32]> for AccountId32Mock { } /// Test signature that impl From<ed25519::Signature> (required to compile pallet identity) -#[derive(Clone, codec::Decode, Debug, Eq, codec::Encode, PartialEq, scale_info::TypeInfo)] +#[derive( + Clone, + codec::DecodeWithMemTracking, + codec::Decode, + Debug, + Eq, + codec::Encode, + PartialEq, + scale_info::TypeInfo, +)] pub struct TestSignature(SubtrateTestSignature); impl From<sp_core::ed25519::Signature> for TestSignature { fn from(_: sp_core::ed25519::Signature) -> Self { @@ -143,6 +152,7 @@ impl ShouldEndSession<u64> for TestShouldEndSession { } impl pallet_session::Config for Test { + type DisablingStrategy = (); type Keys = MockSessionKeys; type NextSessionRotation = (); type RuntimeEvent = RuntimeEvent; diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index 0685fc5d3..0a73b1623 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -45,7 +45,16 @@ impl From<[u8; 32]> for AccountId32Mock { } /// Test signature that impl From<ed25519::Signature> (required to compile pallet identity) -#[derive(Clone, codec::Decode, Debug, Eq, codec::Encode, PartialEq, scale_info::TypeInfo)] +#[derive( + Clone, + codec::DecodeWithMemTracking, + codec::Decode, + Debug, + Eq, + codec::Encode, + PartialEq, + scale_info::TypeInfo, +)] pub struct TestSignature(SubtrateTestSignature); impl TestSignature { diff --git a/resources/metadata.scale b/resources/metadata.scale index 566b876a228174b3294280f96249b9b01095bd10..8f5350a5b4200601751248e988e45ba88d6ad749 100644 GIT binary patch delta 9847 zcmaF0lJmncPPW|Cl0^QK8`*v`GsaG0k!4KWEXU%;BwtaGn3I!Q5?`EJT%4JoXJzGD zmYP>$6I7a4l9`)ox4DW<i<vQW@={JU#>mNMINcc)Hj8j6Fex<zrDmljm!zh6=9MMp zWTrTlmSp4?Wmcu8gchV1C8nfuOkN)^HhE*PggZNnAfscRLMB9^LLywHLMcS4LV04b zLJ`zFh4PHdoK%I9qRPy?bcK?9g~Wn_oJxhvlFi0E)@+O#oAZTkvIsdirl;nmBzop0 z=jRsWq?V+zOukbst<1^N0+CS2ELO;bODd!l<>x9SlxL*oC2V#V|0y>4f-@VBhF@xV zFvQy|lMn8dpPZ*xRqql8@=an%evwONabi+VY6=UZ3fPArF$PA95GyOV63-L{MwS9N zS0N*@SRpAjHBTW0s#nhgE*X@Xnn&0?c?Kqy3b-DGfkmmhVC|C~6;(EK>ZeIDifk_M zJj}#r;F4O9Uz}MIke{8JA}~2oQfzXvm$<J^eojh!3PehR(ZDG&CowNM)j!Q9#EyYc zCoi=emm~|zhmed^1*leqwEQB4#K{*urT9|w6iN$H5=&B3^b7K{!R`q0v1DSD*xcv$ z0E;`s>$5ZSQUVznb)YWv&df_;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HkfrEsrh)ktMja4OBrNtrGX&m^&(J(lS_ fBlAYq*6larm|~e3w{AC2VlrlAyT}-@la&Dgo?2<L diff --git a/runtime/gdev/tests/balance_tests.rs b/runtime/gdev/tests/balance_tests.rs index 0d3955c54..93516456b 100644 --- a/runtime/gdev/tests/balance_tests.rs +++ b/runtime/gdev/tests/balance_tests.rs @@ -22,7 +22,7 @@ use common::*; use frame_support::{assert_noop, assert_ok, traits::StoredMap}; use gdev_runtime::*; use sp_core::Encode; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; use sp_runtime::MultiAddress; /// test currency transfer @@ -32,24 +32,24 @@ use sp_runtime::MultiAddress; fn test_transfer() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { // Alice gives 500 to Eve assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - AccountKeyring::Eve.to_account_id().into(), + frame_system::RawOrigin::Signed(Keyring::Alice.to_account_id()).into(), + Keyring::Eve.to_account_id().into(), 500 )); // check amounts assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 - 500 ); assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), + Balances::free_balance(Keyring::Eve.to_account_id()), 10_000 + 500 ); }) @@ -59,14 +59,14 @@ fn test_transfer() { #[test] fn test_transfer_not_enough() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 599)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 599)]) .build() .execute_with(|| { run_to_block(1); assert_noop!( Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - AccountKeyring::Dave.to_account_id().into(), + frame_system::RawOrigin::Signed(Keyring::Alice.to_account_id()).into(), + Keyring::Dave.to_account_id().into(), 500 ), sp_runtime::TokenError::Frozen // frozen because trying to transfer more than liquid @@ -79,15 +79,15 @@ fn test_transfer_not_enough() { #[test] fn test_transfer_underflow() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 400)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 400)]) .build() .execute_with(|| { run_to_block(1); assert_eq!(Balances::total_issuance(), 400); assert_noop!( Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - AccountKeyring::Dave.to_account_id().into(), + frame_system::RawOrigin::Signed(Keyring::Alice.to_account_id()).into(), + Keyring::Dave.to_account_id().into(), 500 // larger than total issuance ), sp_runtime::ArithmeticError::Underflow @@ -101,16 +101,16 @@ fn test_transfer_underflow() { fn test_transfer_funds_unavailable() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 499), - (AccountKeyring::Bob.to_account_id(), 200), + (Keyring::Alice.to_account_id(), 499), + (Keyring::Bob.to_account_id(), 200), ]) .build() .execute_with(|| { run_to_block(1); assert_noop!( Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - AccountKeyring::Dave.to_account_id().into(), + frame_system::RawOrigin::Signed(Keyring::Alice.to_account_id()).into(), + Keyring::Dave.to_account_id().into(), 500 ), sp_runtime::TokenError::FundsUnavailable @@ -122,16 +122,16 @@ fn test_transfer_funds_unavailable() { #[test] fn test_transfer_all_linked_no_member() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 5_000)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 5_000)]) .build() .execute_with(|| { run_to_block(1); let genesis_hash = System::block_hash(0); - let alice = AccountKeyring::Alice.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let alice = Keyring::Alice.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"link", genesis_hash, 1u32, ferdie.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); assert_ok!(Balances::transfer_allow_death( frame_system::RawOrigin::Signed(alice.clone()).into(), @@ -150,7 +150,7 @@ fn test_transfer_all_linked_no_member() { ); assert_ok!(Balances::transfer_all( frame_system::RawOrigin::Signed(ferdie.clone()).into(), - AccountKeyring::Bob.to_account_id().into(), + Keyring::Bob.to_account_id().into(), false ),); assert_eq!(Balances::free_balance(ferdie.clone()), 0); diff --git a/runtime/gdev/tests/common/mod.rs b/runtime/gdev/tests/common/mod.rs index b8d13eaef..6f4d0ed90 100644 --- a/runtime/gdev/tests/common/mod.rs +++ b/runtime/gdev/tests/common/mod.rs @@ -25,7 +25,7 @@ use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::{AuthorityId as BabeId, Slot, VrfInput, VrfProof}; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::IsWrappedBy, sr25519, Encode, Pair, Public, H256}; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; use sp_membership::MembershipData; use sp_runtime::{ generic::SignedPayload, @@ -488,7 +488,7 @@ pub fn get_unchecked_extrinsic( call: RuntimeCall, era: u64, block: u64, - signer: AccountKeyring, + signer: Keyring, tip: Balance, nonce: u32, ) -> gdev_runtime::UncheckedExtrinsic { diff --git a/runtime/gdev/tests/fee_tests.rs b/runtime/gdev/tests/fee_tests.rs index 14c7f15e3..c4647a6d4 100644 --- a/runtime/gdev/tests/fee_tests.rs +++ b/runtime/gdev/tests/fee_tests.rs @@ -21,35 +21,28 @@ mod common; use common::*; use frame_support::{assert_ok, pallet_prelude::DispatchClass}; use gdev_runtime::*; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; /// This test checks that an almost empty block incurs no fees for an extrinsic. #[test] fn test_fees_empty() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Eve.to_account_id().into(), + dest: Keyring::Eve.to_account_id().into(), value: 500, }); - let xt = common::get_unchecked_extrinsic( - call, - 4u64, - 8u64, - AccountKeyring::Alice, - 0u64, - 0u32, - ); + let xt = common::get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 0u64, 0u32); assert_ok!(Executive::apply_extrinsic(xt)); // The block is almost empty, so the extrinsic should incur no fee assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 - 500 ); }) @@ -62,8 +55,8 @@ fn test_fees_empty() { fn test_fees_weight() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { @@ -79,10 +72,10 @@ fn test_fees_weight() { let call = RuntimeCall::System(SystemCall::remark { remark: vec![255u8; 1], }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 0u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 0u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 ); @@ -93,10 +86,10 @@ fn test_fees_weight() { remark: vec![255u8; 1], }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 0u64, 1u32); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 0u64, 1u32); assert_ok!(Executive::apply_extrinsic(xt)); assert_ne!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 ); }) @@ -109,8 +102,8 @@ fn test_fees_weight() { fn test_fees_length() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { @@ -122,10 +115,10 @@ fn test_fees_length() { let call = RuntimeCall::System(SystemCall::remark { remark: vec![255u8; 100], }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 0u64, 0u32); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 0u64, 0u32); assert_ok!(Executive::apply_extrinsic(xt)); assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 ); @@ -134,10 +127,10 @@ fn test_fees_length() { let call = RuntimeCall::System(SystemCall::remark { remark: vec![0u8; 147], }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 0u64, 1u32); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 0u64, 1u32); assert_ok!(Executive::apply_extrinsic(xt)); assert_ne!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 ); @@ -151,12 +144,9 @@ fn test_fees_length() { remark: vec![255u8; 1], }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Eve, 0u64, 0u32); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Eve, 0u64, 0u32); assert_ok!(Executive::apply_extrinsic(xt)); - assert_ne!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 10_000 - ); + assert_ne!(Balances::free_balance(Keyring::Eve.to_account_id()), 10_000); }) } @@ -166,8 +156,8 @@ fn test_fees_length() { fn test_fees_multiplier_weight() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { @@ -214,8 +204,8 @@ fn test_fees_multiplier_weight() { fn test_fees_multiplier_length() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index 4031f377f..463f8842e 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -29,7 +29,7 @@ use pallet_session::historical::SessionManager; use pallet_smith_members::{SmithMeta, SmithStatus}; use scale_info::prelude::num::NonZeroU16; use sp_core::{Encode, Pair}; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; use sp_runtime::MultiAddress; #[test] @@ -96,35 +96,26 @@ fn test_genesis_build() { fn test_initial_state() { ExtBuilder::new(1, 2, 3) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 1_000), - (AccountKeyring::Bob.to_account_id(), 200), - (AccountKeyring::Charlie.to_account_id(), 100), // below ED allowed for identities - (AccountKeyring::Dave.to_account_id(), 900), + (Keyring::Alice.to_account_id(), 1_000), + (Keyring::Bob.to_account_id(), 200), + (Keyring::Charlie.to_account_id(), 100), // below ED allowed for identities + (Keyring::Dave.to_account_id(), 900), ]) .build() .execute_with(|| { run_to_block(1); assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 1_000 ); + assert_eq!(Balances::free_balance(Keyring::Bob.to_account_id()), 200); assert_eq!( - Balances::free_balance(AccountKeyring::Bob.to_account_id()), - 200 - ); - assert_eq!( - Balances::free_balance(AccountKeyring::Charlie.to_account_id()), + Balances::free_balance(Keyring::Charlie.to_account_id()), 100 ); - assert_eq!( - Balances::free_balance(AccountKeyring::Dave.to_account_id()), - 900 - ); - assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 0 - ); + assert_eq!(Balances::free_balance(Keyring::Dave.to_account_id()), 900); + assert_eq!(Balances::free_balance(Keyring::Eve.to_account_id()), 0); // total issuance and monetary mass should be coherent assert_eq!(Balances::total_issuance(), 2_200); assert_eq!( @@ -141,9 +132,9 @@ fn test_initial_state() { fn test_total_issuance_vs_monetary_mass() { ExtBuilder::new(1, 2, 3) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 2000), - (AccountKeyring::Bob.to_account_id(), 1000), - (AccountKeyring::Charlie.to_account_id(), 0), + (Keyring::Alice.to_account_id(), 2000), + (Keyring::Bob.to_account_id(), 1000), + (Keyring::Charlie.to_account_id(), 0), ]) .build() .execute_with(|| { @@ -167,7 +158,7 @@ fn test_total_issuance_vs_monetary_mass() { ); // Alice claims her UD assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() ))); assert_eq!(Balances::total_issuance(), 4000); assert_eq!( @@ -178,7 +169,7 @@ fn test_total_issuance_vs_monetary_mass() { run_to_block(21); // Bob claims his 2 UDs assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( - AccountKeyring::Bob.to_account_id() + Keyring::Bob.to_account_id() ))); assert_eq!(Balances::total_issuance(), 6000); assert_eq!( @@ -192,7 +183,7 @@ fn test_total_issuance_vs_monetary_mass() { #[test] fn test_identity_below_ed() { ExtBuilder::new(1, 1, 1) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 900)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 900)]) .build() .execute_with(|| { run_to_block(1); @@ -200,8 +191,8 @@ fn test_identity_below_ed() { // a transfer below ED will lead to frozen token error assert_noop!( Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Bob.to_account_id()), 850 ), sp_runtime::TokenError::Frozen @@ -209,33 +200,33 @@ fn test_identity_below_ed() { // // Old behavior below // // Should be able to go below existential deposit, loose dust, and still not die // assert_ok!(Balances::transfer( - // RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - // MultiAddress::Id(AccountKeyring::Bob.to_account_id()), + // RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + // MultiAddress::Id(Keyring::Bob.to_account_id()), // 800 // )); // assert_eq!( - // Balances::free_balance(AccountKeyring::Alice.to_account_id()), + // Balances::free_balance(Keyring::Alice.to_account_id()), // 0 // ); // assert_eq!( - // Balances::free_balance(AccountKeyring::Bob.to_account_id()), + // Balances::free_balance(Keyring::Bob.to_account_id()), // 800 // ); // // since alice is identity, her account should not be killed even she lost currency below ED // System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Transfer { - // from: AccountKeyring::Alice.to_account_id(), - // to: AccountKeyring::Bob.to_account_id(), + // from: Keyring::Alice.to_account_id(), + // to: Keyring::Bob.to_account_id(), // amount: 800, // })); // System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::DustLost { - // account: AccountKeyring::Alice.to_account_id(), + // account: Keyring::Alice.to_account_id(), // amount: 100, // })); // System::assert_has_event(RuntimeEvent::System(frame_system::Event::NewAccount { - // account: AccountKeyring::Bob.to_account_id(), + // account: Keyring::Bob.to_account_id(), // })); // System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Endowed { - // account: AccountKeyring::Bob.to_account_id(), + // account: Keyring::Bob.to_account_id(), // free_balance: 800, // })); }) @@ -319,7 +310,7 @@ fn test_remove_identity() { )); // since Dave does not have ED, his account is killed System::assert_has_event(RuntimeEvent::System(frame_system::Event::KilledAccount { - account: AccountKeyring::Dave.to_account_id(), + account: Keyring::Dave.to_account_id(), })); }); } @@ -329,37 +320,37 @@ fn test_remove_identity() { fn test_validate_identity_when_claim() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Eve.to_account_id(), 2000), - (AccountKeyring::Ferdie.to_account_id(), 1000), + (Keyring::Eve.to_account_id(), 2000), + (Keyring::Ferdie.to_account_id(), 1000), ]) .build() .execute_with(|| { run_to_block(1); // alice create identity for Eve assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); run_to_block(2); // eve confirms her identity assert_ok!(Identity::confirm_identity( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), "Eeeeeveeeee".into(), )); run_to_block(3); // eve gets certified by bob and charlie assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 5 )); assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), 5 )); // eve request distance evaluation for herself assert_ok!(Distance::request_distance_evaluation( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), )); // Pass 2nd evaluation period @@ -368,7 +359,7 @@ fn test_validate_identity_when_claim() { // simulate an evaluation published by smith Alice assert_ok!(Distance::force_update_evaluation( RuntimeOrigin::root(), - AccountKeyring::Alice.to_account_id(), + Keyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], } @@ -386,7 +377,7 @@ fn test_validate_identity_when_claim() { // the following call does not exist anymore // assert_noop!( // Membership::claim_membership( - // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + // RuntimeOrigin::signed(Keyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -408,17 +399,17 @@ fn test_validate_identity_when_claim() { fn test_identity_creation_workflow() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Charlie.to_account_id(), 10_000), // necessary for evalation distance reserve - (AccountKeyring::Eve.to_account_id(), 2_000), - (AccountKeyring::Ferdie.to_account_id(), 1_000), + (Keyring::Charlie.to_account_id(), 10_000), // necessary for evalation distance reserve + (Keyring::Eve.to_account_id(), 2_000), + (Keyring::Ferdie.to_account_id(), 1_000), ]) .build() .execute_with(|| { run_to_block(1); // alice create identity for Eve assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); assert_eq!( Identity::identity(5), @@ -426,7 +417,7 @@ fn test_identity_creation_workflow() { data: Default::default(), next_creatable_identity_on: 0u32, old_owner_key: None, - owner_key: AccountKeyring::Eve.to_account_id(), + owner_key: Keyring::Eve.to_account_id(), next_scheduled: 1 + 40, status: pallet_identity::IdtyStatus::Unconfirmed, }) @@ -434,7 +425,7 @@ fn test_identity_creation_workflow() { run_to_block(2); // eve confirms her identity assert_ok!(Identity::confirm_identity( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), "Eeeeeveeeee".into(), )); assert_eq!( @@ -443,7 +434,7 @@ fn test_identity_creation_workflow() { data: Default::default(), next_creatable_identity_on: 0u32, old_owner_key: None, - owner_key: AccountKeyring::Eve.to_account_id(), + owner_key: Keyring::Eve.to_account_id(), next_scheduled: 2 + 876600, status: pallet_identity::IdtyStatus::Unvalidated, }) @@ -451,23 +442,23 @@ fn test_identity_creation_workflow() { run_to_block(3); // eve gets certified by bob and charlie assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 5 )); assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), 5 )); // charlie also request distance evaluation for eve // (could be done in batch) assert_ok!(Distance::request_distance_evaluation_for( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), 5 )); // then the evaluation is pending assert_eq!( Distance::pending_evaluation_request(5), - Some(AccountKeyring::Charlie.to_account_id(),) + Some(Keyring::Charlie.to_account_id(),) ); // Pass 2nd evaluation period @@ -476,7 +467,7 @@ fn test_identity_creation_workflow() { // simulate evaluation published by smith Alice assert_ok!(Distance::force_update_evaluation( RuntimeOrigin::root(), - AccountKeyring::Alice.to_account_id(), + Keyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], } @@ -509,7 +500,7 @@ fn test_identity_creation_workflow() { }, next_creatable_identity_on: 0u32, old_owner_key: None, - owner_key: AccountKeyring::Eve.to_account_id(), + owner_key: Keyring::Eve.to_account_id(), next_scheduled: 0, status: pallet_identity::IdtyStatus::Member, }) @@ -525,13 +516,13 @@ fn test_identity_creation_workflow() { }, )); assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( - AccountKeyring::Eve.to_account_id() + Keyring::Eve.to_account_id() ),)); System::assert_has_event(RuntimeEvent::UniversalDividend( pallet_universal_dividend::Event::UdsClaimed { count: (10 - first_eligible), total: (10 - first_eligible as u64) * 1_000, - who: AccountKeyring::Eve.to_account_id(), + who: Keyring::Eve.to_account_id(), }, )); }); @@ -554,10 +545,7 @@ fn test_can_not_issue_cert_when_membership_lost() { // Bob can not issue a certification assert_noop!( - Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), - 3, - ), + Certification::add_cert(RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 3,), pallet_duniter_wot::Error::<gdev_runtime::Runtime>::IssuerNotMember ); }); @@ -609,13 +597,13 @@ fn test_membership_expiry_with_identity_removal() { #[test] fn test_membership_renewal() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 2000)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 2000)]) .build() .execute_with(|| { // can not renew membership immediately assert_noop!( Distance::request_distance_evaluation(RuntimeOrigin::signed( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() ),), pallet_duniter_wot::Error::<Runtime>::MembershipRenewalPeriodNotRespected, ); @@ -623,7 +611,7 @@ fn test_membership_renewal() { // but ok after waiting 10 blocks delay run_to_block(11); assert_ok!(Distance::request_distance_evaluation( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), )); // Pass 3rd evaluation period @@ -631,7 +619,7 @@ fn test_membership_renewal() { run_to_block(3 * eval_period); assert_ok!(Distance::force_update_evaluation( RuntimeOrigin::root(), - AccountKeyring::Alice.to_account_id(), + Keyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], } @@ -651,7 +639,7 @@ fn test_membership_renewal() { // can not ask renewal when period is not respected assert_noop!( Distance::request_distance_evaluation(RuntimeOrigin::signed( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() ),), pallet_duniter_wot::Error::<Runtime>::MembershipRenewalPeriodNotRespected, ); @@ -679,8 +667,7 @@ fn test_revoke_identity_should_unlink() { Identity::do_revoke_identity(1, pallet_identity::RevocationReason::Root); assert_eq!( - frame_system::Pallet::<Runtime>::get(&AccountKeyring::Alice.to_account_id()) - .linked_idty, + frame_system::Pallet::<Runtime>::get(&Keyring::Alice.to_account_id()).linked_idty, None ); }) @@ -699,10 +686,7 @@ fn test_revoke_identity_after_one_ud() { // before UD, dave has 0 (initial amount) run_to_block(1); - assert_eq!( - Balances::free_balance(AccountKeyring::Dave.to_account_id()), - 0 - ); + assert_eq!(Balances::free_balance(Keyring::Dave.to_account_id()), 0); // go after UD creation block run_to_block( @@ -719,12 +703,12 @@ fn test_revoke_identity_after_one_ud() { pallet_universal_dividend::Event::UdsAutoPaid { count: 1, total: 1_000, - who: AccountKeyring::Dave.to_account_id(), + who: Keyring::Dave.to_account_id(), }, )); // dave account actually received this UD System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Deposit { - who: AccountKeyring::Dave.to_account_id(), + who: Keyring::Dave.to_account_id(), amount: 1_000, })); // membership and identity were actually removed @@ -742,10 +726,7 @@ fn test_revoke_identity_after_one_ud() { )); assert!(Identity::identity(4).is_some()); // identity still exists, but its status is revoked - assert_eq!( - Balances::free_balance(AccountKeyring::Dave.to_account_id()), - 1_000 - ); + assert_eq!(Balances::free_balance(Keyring::Dave.to_account_id()), 1_000); }); } @@ -761,18 +742,12 @@ fn test_claim_ud_after_revoke() { // before UD, bob has 0 (initial amount) run_to_block(1); - assert_eq!( - Balances::free_balance(AccountKeyring::Bob.to_account_id()), - 0 - ); + assert_eq!(Balances::free_balance(Keyring::Bob.to_account_id()), 0); // revoke identity Identity::do_revoke_identity(2, pallet_identity::RevocationReason::Root); - assert_eq!( - Balances::free_balance(AccountKeyring::Bob.to_account_id()), - 1_000 - ); + assert_eq!(Balances::free_balance(Keyring::Bob.to_account_id()), 1_000); // go after UD creation block run_to_block( @@ -781,22 +756,14 @@ fn test_claim_ud_after_revoke() { + 1) as u32, ); - assert_eq!( - Balances::free_balance(AccountKeyring::Bob.to_account_id()), - 1_000 - ); + assert_eq!(Balances::free_balance(Keyring::Bob.to_account_id()), 1_000); assert_err!( - UniversalDividend::claim_uds(RuntimeOrigin::signed( - AccountKeyring::Bob.to_account_id() - )), + UniversalDividend::claim_uds(RuntimeOrigin::signed(Keyring::Bob.to_account_id())), pallet_universal_dividend::Error::<Runtime>::AccountNotAllowedToClaimUds, ); - assert_eq!( - Balances::free_balance(AccountKeyring::Bob.to_account_id()), - 1_000 - ); + assert_eq!(Balances::free_balance(Keyring::Bob.to_account_id()), 1_000); }); } @@ -816,10 +783,7 @@ fn test_ud_claimed_membership_on_and_off() { }, )); // UD not claimed, still initial balance to initial 0 - assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), - 0 - ); + assert_eq!(Balances::free_balance(Keyring::Alice.to_account_id()), 0); run_to_block(13); // alice identity expires @@ -828,14 +792,11 @@ fn test_ud_claimed_membership_on_and_off() { pallet_universal_dividend::Event::UdsAutoPaid { count: 1, total: 1_000, - who: AccountKeyring::Alice.to_account_id(), + who: Keyring::Alice.to_account_id(), }, )); // alice balances should be increased by 1 UD - assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), - 1000 - ); + assert_eq!(Balances::free_balance(Keyring::Alice.to_account_id()), 1000); // UD number 2 run_to_block(14); @@ -857,7 +818,7 @@ fn test_ud_claimed_membership_on_and_off() { // because the call does not exist anymore // assert_noop!( // Membership::claim_membership( - // RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), + // RuntimeOrigin::signed(Keyring::Alice.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -882,17 +843,17 @@ fn test_ud_claimed_membership_on_and_off() { // one block later, alice claims her new UD run_to_block(25); assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() ))); System::assert_has_event(RuntimeEvent::UniversalDividend( pallet_universal_dividend::Event::UdsClaimed { count: 1, total: 1_000, - who: AccountKeyring::Alice.to_account_id(), + who: Keyring::Alice.to_account_id(), }, )); assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 2000 // one more UD ); @@ -935,18 +896,12 @@ fn test_smith_certification() { run_to_block(1); assert_noop!( - SmithMembers::certify_smith( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - 2 - ), + SmithMembers::certify_smith(RuntimeOrigin::signed(Keyring::Alice.to_account_id()), 2), pallet_smith_members::Error::<Runtime>::CertificationAlreadyExists ); assert_noop!( - SmithMembers::certify_smith( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - 4 - ), + SmithMembers::certify_smith(RuntimeOrigin::signed(Keyring::Alice.to_account_id()), 4), pallet_smith_members::Error::<Runtime>::CertificationReceiverMustHaveBeenInvited ); }); @@ -965,15 +920,15 @@ fn create_dummy_session_keys() -> gdev_runtime::opaque::SessionKeys { #[test] fn test_smith_process() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Dave.to_account_id(), 1_000)]) + .with_initial_balances(vec![(Keyring::Dave.to_account_id(), 1_000)]) .build() .execute_with(|| { run_to_block(1); - let alice = AccountKeyring::Alice.to_account_id(); - let bob = AccountKeyring::Bob.to_account_id(); - let charlie = AccountKeyring::Charlie.to_account_id(); - let dave = AccountKeyring::Dave.to_account_id(); + let alice = Keyring::Alice.to_account_id(); + let bob = Keyring::Bob.to_account_id(); + let charlie = Keyring::Charlie.to_account_id(); + let dave = Keyring::Dave.to_account_id(); let dummy_session_keys = create_dummy_session_keys(); // Eve can not request smith membership because not member of the smith wot @@ -991,7 +946,7 @@ fn test_smith_process() { // Dave cannot (yet) set his session keys assert_err!( AuthorityMembers::set_session_keys( - RuntimeOrigin::signed(AccountKeyring::Dave.to_account_id()), + RuntimeOrigin::signed(Keyring::Dave.to_account_id()), dummy_session_keys.clone() ), pallet_authority_members::Error::<Runtime>::NotMember @@ -1026,13 +981,13 @@ fn test_smith_process() { // Dave can set his (dummy) session keys assert_ok!(AuthorityMembers::set_session_keys( - RuntimeOrigin::signed(AccountKeyring::Dave.to_account_id()), + RuntimeOrigin::signed(Keyring::Dave.to_account_id()), dummy_session_keys )); // Dave can go online assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( - AccountKeyring::Dave.to_account_id() + Keyring::Dave.to_account_id() ),)); }) } @@ -1132,7 +1087,7 @@ fn test_expired_smith_has_null_expires_on() { #[test] fn test_create_new_account() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 1_000)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 1_000)]) .build() .execute_with(|| { run_to_block(2); @@ -1140,49 +1095,43 @@ fn test_create_new_account() { // Should be able to transfer 5 units to a new account assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 500 )); //println!("{:#?}", System::events()); System::assert_has_event(RuntimeEvent::System(frame_system::Event::NewAccount { - account: AccountKeyring::Eve.to_account_id(), + account: Keyring::Eve.to_account_id(), })); System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Endowed { - account: AccountKeyring::Eve.to_account_id(), + account: Keyring::Eve.to_account_id(), free_balance: 500, })); System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Transfer { - from: AccountKeyring::Alice.to_account_id(), - to: AccountKeyring::Eve.to_account_id(), + from: Keyring::Alice.to_account_id(), + to: Keyring::Eve.to_account_id(), amount: 500, })); // The new account must be created immediately - assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 500 - ); + assert_eq!(Balances::free_balance(Keyring::Eve.to_account_id()), 500); // 100 initial + no deposit (there is no account creation fee) assert_eq!(Balances::free_balance(Treasury::account_id()), 100); // can remove an account using transfer assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), - MultiAddress::Id(AccountKeyring::Alice.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), + MultiAddress::Id(Keyring::Alice.to_account_id()), 500 )); // Account reaped + assert_eq!(Balances::free_balance(Keyring::Eve.to_account_id()), 0); assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 0 - ); - assert_eq!( - frame_system::Pallet::<Runtime>::get(&AccountKeyring::Eve.to_account_id()), + frame_system::Pallet::<Runtime>::get(&Keyring::Eve.to_account_id()), pallet_duniter_account::AccountData::default() ); System::assert_has_event(RuntimeEvent::System(frame_system::Event::KilledAccount { - account: AccountKeyring::Eve.to_account_id(), + account: Keyring::Eve.to_account_id(), })); }); } @@ -1190,34 +1139,34 @@ fn test_create_new_account() { #[test] fn test_create_new_idty() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 1_000)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 1_000)]) .build() .execute_with(|| { run_to_block(2); // Should be able to create an identity assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 200 )); assert_noop!( Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), ), pallet_identity::Error::<Runtime>::InsufficientBalance ); assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 200 )); assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); // At next block, nothing should be preleved @@ -1230,39 +1179,36 @@ fn test_create_new_idty() { #[test] fn test_create_new_idty_without_founds() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 1_000)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 1_000)]) .build() .execute_with(|| { run_to_block(2); - assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 0 - ); + assert_eq!(Balances::free_balance(Keyring::Eve.to_account_id()), 0); // Should not be able to create an identity without founds assert_noop!( Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), ), pallet_identity::Error::<Runtime>::AccountNotExist ); // Deposit some founds on the account assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 500 )); assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); System::assert_has_event(RuntimeEvent::Identity( pallet_identity::Event::IdtyCreated { idty_index: 5, - owner_key: AccountKeyring::Eve.to_account_id(), + owner_key: Keyring::Eve.to_account_id(), }, )); @@ -1273,10 +1219,7 @@ fn test_create_new_idty_without_founds() { // At next block, nothing should be preleved run_to_block(4); - assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), - 500 - ); + assert_eq!(Balances::free_balance(Keyring::Eve.to_account_id()), 500); }); } @@ -1285,10 +1228,10 @@ fn test_create_new_idty_without_founds() { fn test_validate_new_idty_after_few_uds() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 1_000), - (AccountKeyring::Bob.to_account_id(), 1_000), - (AccountKeyring::Charlie.to_account_id(), 1_000), - (AccountKeyring::Eve.to_account_id(), 1_000), + (Keyring::Alice.to_account_id(), 1_000), + (Keyring::Bob.to_account_id(), 1_000), + (Keyring::Charlie.to_account_id(), 1_000), + (Keyring::Eve.to_account_id(), 1_000), ]) .build() .execute_with(|| { @@ -1296,26 +1239,26 @@ fn test_validate_new_idty_after_few_uds() { // Should be able to create an identity assert_ok!(Balances::transfer_allow_death( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 200 )); assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); // At next block, the created identity should be confirmed by its owner run_to_block(22); assert_ok!(Identity::confirm_identity( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), pallet_identity::IdtyName::from("Eve"), )); // At next block, Bob should be able to certify the new identity run_to_block(23); assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 5, )); // valid distance status should trigger identity validation @@ -1327,7 +1270,7 @@ fn test_validate_new_idty_after_few_uds() { // because the call does not exist anymore // assert_noop!( // Membership::claim_membership( - // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + // RuntimeOrigin::signed(Keyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -1350,10 +1293,10 @@ fn test_validate_new_idty_after_few_uds() { fn test_claim_memberhsip_after_few_uds() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 1_000), - (AccountKeyring::Bob.to_account_id(), 1_000), - (AccountKeyring::Charlie.to_account_id(), 1_000), - (AccountKeyring::Eve.to_account_id(), 1_000), + (Keyring::Alice.to_account_id(), 1_000), + (Keyring::Bob.to_account_id(), 1_000), + (Keyring::Charlie.to_account_id(), 1_000), + (Keyring::Eve.to_account_id(), 1_000), ]) .build() .execute_with(|| { @@ -1361,21 +1304,21 @@ fn test_claim_memberhsip_after_few_uds() { // Should be able to create an identity assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Eve.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Eve.to_account_id(), )); // At next block, the created identity should be confirmed by its owner run_to_block(22); assert_ok!(Identity::confirm_identity( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), pallet_identity::IdtyName::from("Eve"), )); // At next block, Bob should be able to certify the new identity run_to_block(23); assert_ok!(Certification::add_cert( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 5, )); @@ -1388,7 +1331,7 @@ fn test_claim_memberhsip_after_few_uds() { // because the call does not exist // assert_noop!( // Membership::claim_membership( - // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + // RuntimeOrigin::signed(Keyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -1410,73 +1353,61 @@ fn test_claim_memberhsip_after_few_uds() { fn test_oneshot_accounts() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 1_000), - (AccountKeyring::Eve.to_account_id(), 1_000), + (Keyring::Alice.to_account_id(), 1_000), + (Keyring::Eve.to_account_id(), 1_000), ]) .build() .execute_with(|| { run_to_block(6); assert_ok!(OneshotAccount::create_oneshot_account( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - MultiAddress::Id(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + MultiAddress::Id(Keyring::Eve.to_account_id()), 400 )); - assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), - 600 - ); + assert_eq!(Balances::free_balance(Keyring::Alice.to_account_id()), 600); run_to_block(7); assert_ok!(OneshotAccount::consume_oneshot_account_with_remaining( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Oneshot(MultiAddress::Id( - AccountKeyring::Ferdie.to_account_id() + Keyring::Ferdie.to_account_id() )), pallet_oneshot_account::Account::Normal(MultiAddress::Id( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() )), 300 )); - assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), - 700 - ); + assert_eq!(Balances::free_balance(Keyring::Alice.to_account_id()), 700); assert_noop!( OneshotAccount::consume_oneshot_account( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Oneshot(MultiAddress::Id( - AccountKeyring::Ferdie.to_account_id() + Keyring::Ferdie.to_account_id() )), ), pallet_oneshot_account::Error::<Runtime>::OneshotAccountNotExist ); run_to_block(8); // Oneshot account consumption should not increment the nonce - assert_eq!( - System::account(AccountKeyring::Eve.to_account_id()).nonce, - 0 - ); + assert_eq!(System::account(Keyring::Eve.to_account_id()).nonce, 0); assert_ok!(OneshotAccount::consume_oneshot_account( - RuntimeOrigin::signed(AccountKeyring::Ferdie.to_account_id()), + RuntimeOrigin::signed(Keyring::Ferdie.to_account_id()), 0, pallet_oneshot_account::Account::Normal(MultiAddress::Id( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() )), )); - assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), - 1000 - ); + assert_eq!(Balances::free_balance(Keyring::Alice.to_account_id()), 1000); assert_noop!( OneshotAccount::consume_oneshot_account( - RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), + RuntimeOrigin::signed(Keyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Normal(MultiAddress::Id( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() )), ), pallet_oneshot_account::Error::<Runtime>::OneshotAccountNotExist @@ -1488,14 +1419,14 @@ fn test_oneshot_accounts() { #[test] fn test_link_account() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Alice.to_account_id(), 8888)]) + .with_initial_balances(vec![(Keyring::Alice.to_account_id(), 8888)]) .build() .execute_with(|| { let genesis_hash = System::block_hash(0); - let alice = AccountKeyring::Alice.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let alice = Keyring::Alice.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"link", genesis_hash, 1u32, ferdie.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); // Ferdie's account cannot be linked to Alice identity because the account does not exist assert_noop!( @@ -1525,14 +1456,14 @@ fn test_link_account() { #[test] fn test_change_owner_key_validator_online() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Ferdie.to_account_id(), 8888)]) + .with_initial_balances(vec![(Keyring::Ferdie.to_account_id(), 8888)]) .build() .execute_with(|| { let genesis_hash = System::block_hash(0); - let alice = AccountKeyring::Alice.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let alice = Keyring::Alice.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"icok", genesis_hash, 1u32, alice.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); // Alice is an online validator assert!(pallet_authority_members::OnlineAuthorities::<Runtime>::get().contains(&1)); @@ -1560,14 +1491,14 @@ fn test_change_owner_key_validator_online() { #[ignore = "long to go to ReportLongevity"] fn test_change_owner_key_offline() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Ferdie.to_account_id(), 8888)]) + .with_initial_balances(vec![(Keyring::Ferdie.to_account_id(), 8888)]) .build() .execute_with(|| { let genesis_hash = System::block_hash(0); - let charlie = AccountKeyring::Charlie.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let charlie = Keyring::Charlie.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"icok", genesis_hash, 3u32, charlie.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); // Charlie is an offline smith SmithMembers::on_smith_goes_offline(3); @@ -1608,7 +1539,7 @@ fn test_change_owner_key_offline() { // Charlie can set its session_keys assert_ok!(AuthorityMembers::set_session_keys( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), create_dummy_session_keys() )); assert_eq!( @@ -1644,14 +1575,14 @@ fn test_change_owner_key_offline() { #[ignore = "long to go to ReportLongevity"] fn test_change_owner_key() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Ferdie.to_account_id(), 8888)]) + .with_initial_balances(vec![(Keyring::Ferdie.to_account_id(), 8888)]) .build() .execute_with(|| { let genesis_hash = System::block_hash(0); - let charlie = AccountKeyring::Charlie.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let charlie = Keyring::Charlie.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"icok", genesis_hash, 3u32, charlie.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); SmithMembers::on_smith_goes_offline(3); // Charlie is now offline smith @@ -1734,11 +1665,11 @@ fn test_change_owner_key() { // Ferdie can set its session_keys and go online frame_system::Pallet::<Runtime>::inc_providers(&ferdie); assert_ok!(AuthorityMembers::set_session_keys( - RuntimeOrigin::signed(AccountKeyring::Ferdie.to_account_id()), + RuntimeOrigin::signed(Keyring::Ferdie.to_account_id()), create_dummy_session_keys() )); assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( - AccountKeyring::Ferdie.to_account_id() + Keyring::Ferdie.to_account_id() ))); // Charlie is still an offline smith @@ -1780,13 +1711,13 @@ fn test_smith_member_can_revoke_its_idty() { run_to_block(2); // Charlie goes online - frame_system::Pallet::<Runtime>::inc_providers(&AccountKeyring::Charlie.to_account_id()); + frame_system::Pallet::<Runtime>::inc_providers(&Keyring::Charlie.to_account_id()); assert_ok!(AuthorityMembers::set_session_keys( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), create_dummy_session_keys() )); assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( - AccountKeyring::Charlie.to_account_id() + Keyring::Charlie.to_account_id() ))); run_to_block(25); @@ -1803,12 +1734,12 @@ fn test_smith_member_can_revoke_its_idty() { genesis_hash: System::block_hash(0), }; let signature = - AccountKeyring::Charlie.sign(&(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()); + Keyring::Charlie.sign(&(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()); assert_ok!(Identity::revoke_identity( - RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), + RuntimeOrigin::signed(Keyring::Charlie.to_account_id()), 3, - AccountKeyring::Charlie.to_account_id(), + Keyring::Charlie.to_account_id(), signature.into() )); // membership should be removed @@ -1844,11 +1775,11 @@ fn test_smith_member_can_revoke_its_idty() { #[test] fn test_genesis_account_of_identity_linked() { ExtBuilder::new(1, 3, 4) - .with_initial_balances(vec![(AccountKeyring::Eve.to_account_id(), 8888)]) + .with_initial_balances(vec![(Keyring::Eve.to_account_id(), 8888)]) .build() .execute_with(|| { // Alice account - let account_id = AccountKeyring::Alice.to_account_id(); + let account_id = Keyring::Alice.to_account_id(); // Alice identity index is 1 assert_eq!(Identity::identity_index_of(&account_id), Some(1)); // get account data @@ -1856,8 +1787,7 @@ fn test_genesis_account_of_identity_linked() { assert_eq!(account_data.linked_idty, Some(1)); // Eve is not member, her account has no linked identity assert_eq!( - frame_system::Pallet::<Runtime>::get(&AccountKeyring::Eve.to_account_id()) - .linked_idty, + frame_system::Pallet::<Runtime>::get(&Keyring::Eve.to_account_id()).linked_idty, None ); }) @@ -1867,13 +1797,13 @@ fn test_genesis_account_of_identity_linked() { #[test] fn test_unlink_identity() { ExtBuilder::new(1, 3, 4).build().execute_with(|| { - let alice_account = AccountKeyring::Alice.to_account_id(); + let alice_account = Keyring::Alice.to_account_id(); // check that Alice is 1 assert_eq!(Identity::identity_index_of(&alice_account), Some(1)); // Alice can unlink her identity from her account assert_ok!(Account::unlink_identity(RuntimeOrigin::signed( - AccountKeyring::Alice.to_account_id() + Keyring::Alice.to_account_id() ),)); // Alice account has been unlinked @@ -1889,19 +1819,19 @@ fn test_unlink_identity() { fn test_new_account_linked() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 1_000), - (AccountKeyring::Eve.to_account_id(), 1_000), + (Keyring::Alice.to_account_id(), 1_000), + (Keyring::Eve.to_account_id(), 1_000), ]) .build() .execute_with(|| { - let eve_account = AccountKeyring::Eve.to_account_id(); + let eve_account = Keyring::Eve.to_account_id(); assert_eq!( frame_system::Pallet::<Runtime>::get(&eve_account).linked_idty, None ); // Alice creates identity for Eve assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), eve_account.clone(), )); // then eve account should be linked to her identity @@ -1918,11 +1848,11 @@ fn test_new_account_linked() { #[test] fn test_killed_account() { ExtBuilder::new(1, 2, 4) - .with_initial_balances(vec![(AccountKeyring::Bob.to_account_id(), 1_000)]) + .with_initial_balances(vec![(Keyring::Bob.to_account_id(), 1_000)]) .build() .execute_with(|| { - let alice_account = AccountKeyring::Alice.to_account_id(); - let bob_account = AccountKeyring::Bob.to_account_id(); + let alice_account = Keyring::Alice.to_account_id(); + let bob_account = Keyring::Bob.to_account_id(); // check that Alice is 1 and Bob 2 assert_eq!(Identity::identity_index_of(&alice_account), Some(1)); assert_eq!(Identity::identity_index_of(&bob_account), Some(2)); diff --git a/runtime/gdev/tests/xt_tests.rs b/runtime/gdev/tests/xt_tests.rs index efac8a18f..80e3036b4 100644 --- a/runtime/gdev/tests/xt_tests.rs +++ b/runtime/gdev/tests/xt_tests.rs @@ -28,7 +28,7 @@ use frame_support::{ }; use gdev_runtime::*; use sp_core::Encode; -use sp_keyring::AccountKeyring; +use sp_keyring::sr25519::Keyring; /// test currency transfer with extrinsic // the signer account should pay fees and a tip @@ -37,18 +37,18 @@ use sp_keyring::AccountKeyring; fn test_transfer_xt() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Eve.to_account_id().into(), + dest: Keyring::Eve.to_account_id().into(), value: 500, }); // 1 cĞD of tip - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 1u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 1u64, 0); // let info = xt.get_dispatch_info(); // println!("dispatch info:\n\t {:?}\n", info); @@ -57,11 +57,11 @@ fn test_transfer_xt() { assert_ok!(Executive::apply_extrinsic(xt)); // check amounts assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 - 500 - 3 // initial - transfered - fees ); assert_eq!( - Balances::free_balance(AccountKeyring::Eve.to_account_id()), + Balances::free_balance(Keyring::Eve.to_account_id()), 10_000 + 500 // initial + transfered ); assert_eq!(Balances::free_balance(Treasury::account_id()), 100 + 3); @@ -73,18 +73,18 @@ fn test_transfer_xt() { fn test_refund_queue() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Eve.to_account_id().into(), + dest: Keyring::Eve.to_account_id().into(), value: 500, }); // 1 cĞD of tip - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 1u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 1u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); // check that refund was added to the queue @@ -93,7 +93,7 @@ fn test_refund_queue() { .first() .expect("a refund should have been added to the queue"), &pallet_quota::pallet::Refund { - account: AccountKeyring::Alice.to_account_id(), + account: Keyring::Alice.to_account_id(), identity: 1u32, amount: 2u64 } @@ -106,18 +106,18 @@ fn test_refund_queue() { fn test_refund_on_idle() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Eve.to_account_id().into(), + dest: Keyring::Eve.to_account_id().into(), value: 500, }); // 1 cĞD of tip - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Alice, 1u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Alice, 1u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); // call on_idle to activate refund @@ -125,7 +125,7 @@ fn test_refund_on_idle() { // check that refund event existed System::assert_has_event(RuntimeEvent::Quota(pallet_quota::Event::Refunded { - who: AccountKeyring::Alice.to_account_id(), + who: Keyring::Alice.to_account_id(), identity: 1u32, amount: 1u64, })); @@ -133,7 +133,7 @@ fn test_refund_on_idle() { // check that refund queue is empty assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); assert_eq!( - Balances::free_balance(AccountKeyring::Alice.to_account_id()), + Balances::free_balance(Keyring::Alice.to_account_id()), 10_000 - 500 - 1 - 2 + 1 // initial - transfered - tip - fees + refunded fees ); }) @@ -144,17 +144,17 @@ fn test_refund_on_idle() { fn test_no_refund() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Eve.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Eve.to_account_id(), 10_000), ]) .build() .execute_with(|| { // Eve → Alice let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Alice.to_account_id().into(), + dest: Keyring::Alice.to_account_id().into(), value: 500, }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Eve, 1u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Eve, 1u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); // check that refund queue is empty assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); @@ -167,16 +167,16 @@ fn test_no_refund() { fn test_refund_reaped_linked_account() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Ferdie.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Ferdie.to_account_id(), 10_000), ]) .build() .execute_with(|| { let genesis_hash = System::block_hash(0); - let alice = AccountKeyring::Alice.to_account_id(); - let ferdie = AccountKeyring::Ferdie.to_account_id(); + let alice = Keyring::Alice.to_account_id(); + let ferdie = Keyring::Ferdie.to_account_id(); let payload = (b"link", genesis_hash, 1u32, ferdie.clone()).encode(); - let signature = AccountKeyring::Ferdie.sign(&payload); + let signature = Keyring::Ferdie.sign(&payload); // Ferdie's account can be linked to Alice identity assert_ok!(Identity::link_account( @@ -191,10 +191,10 @@ fn test_refund_reaped_linked_account() { // transfer_all call to extrinsic let call = RuntimeCall::Balances(BalancesCall::transfer_all { - dest: AccountKeyring::Alice.to_account_id().into(), + dest: Keyring::Alice.to_account_id().into(), keep_alive: false, }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Ferdie, 0u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Ferdie, 0u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); assert_eq!(Balances::free_balance(ferdie.clone()), 0); @@ -213,8 +213,8 @@ fn test_refund_reaped_linked_account() { fn test_no_member_no_refund() { ExtBuilder::new(1, 3, 4) .with_initial_balances(vec![ - (AccountKeyring::Alice.to_account_id(), 10_000), - (AccountKeyring::Bob.to_account_id(), 10_000), + (Keyring::Alice.to_account_id(), 10_000), + (Keyring::Bob.to_account_id(), 10_000), ]) .build() .execute_with(|| { @@ -223,7 +223,7 @@ fn test_no_member_no_refund() { idty_index: 2u32, genesis_hash: System::block_hash(0), }; - let signature = AccountKeyring::Bob.sign( + let signature = Keyring::Bob.sign( &( pallet_identity::REVOCATION_PAYLOAD_PREFIX, revocation_payload, @@ -231,9 +231,9 @@ fn test_no_member_no_refund() { .encode(), ); assert_ok!(Identity::revoke_identity( - RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), + RuntimeOrigin::signed(Keyring::Bob.to_account_id()), 2, - AccountKeyring::Bob.to_account_id(), + Keyring::Bob.to_account_id(), signature.into() )); assert_eq!( @@ -243,17 +243,17 @@ fn test_no_member_no_refund() { pallet_identity::IdtyStatus::Revoked ); let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Ferdie.to_account_id().into(), + dest: Keyring::Ferdie.to_account_id().into(), value: 500, }); - let xt = get_unchecked_extrinsic(call, 4u64, 8u64, AccountKeyring::Bob, 0u64, 0); + let xt = get_unchecked_extrinsic(call, 4u64, 8u64, Keyring::Bob, 0u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); // Unconfirmed identities are not eligible for a refund assert_ok!(Identity::create_identity( - RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), - AccountKeyring::Ferdie.to_account_id(), + RuntimeOrigin::signed(Keyring::Alice.to_account_id()), + Keyring::Ferdie.to_account_id(), )); assert_eq!( pallet_identity::Identities::<Runtime>::get(&5) @@ -262,17 +262,16 @@ fn test_no_member_no_refund() { pallet_identity::IdtyStatus::Unconfirmed ); let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Alice.to_account_id().into(), + dest: Keyring::Alice.to_account_id().into(), value: 500, }); - let xt = - get_unchecked_extrinsic(call.clone(), 4u64, 8u64, AccountKeyring::Ferdie, 0u64, 0); + let xt = get_unchecked_extrinsic(call.clone(), 4u64, 8u64, Keyring::Ferdie, 0u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); // Unvalidated identities are not eligible for a refund assert_ok!(Identity::confirm_identity( - RuntimeOrigin::signed(AccountKeyring::Ferdie.to_account_id()), + RuntimeOrigin::signed(Keyring::Ferdie.to_account_id()), "ferdie".into(), )); assert_eq!( @@ -281,8 +280,7 @@ fn test_no_member_no_refund() { .status, pallet_identity::IdtyStatus::Unvalidated ); - let xt = - get_unchecked_extrinsic(call.clone(), 4u64, 8u64, AccountKeyring::Ferdie, 0u64, 1); + let xt = get_unchecked_extrinsic(call.clone(), 4u64, 8u64, Keyring::Ferdie, 0u64, 1); assert_ok!(Executive::apply_extrinsic(xt)); assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); @@ -295,11 +293,10 @@ fn test_no_member_no_refund() { pallet_identity::IdtyStatus::NotMember ); let call = RuntimeCall::Balances(BalancesCall::transfer_allow_death { - dest: AccountKeyring::Bob.to_account_id().into(), + dest: Keyring::Bob.to_account_id().into(), value: 500, }); - let xt = - get_unchecked_extrinsic(call.clone(), 4u64, 8u64, AccountKeyring::Alice, 0u64, 0); + let xt = get_unchecked_extrinsic(call.clone(), 4u64, 8u64, Keyring::Alice, 0u64, 0); assert_ok!(Executive::apply_extrinsic(xt)); assert!(pallet_quota::RefundQueue::<Runtime>::get().is_empty()); }) -- GitLab