diff --git a/Cargo.lock b/Cargo.lock index f61d6bb4..c3438c9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3324,7 +3324,7 @@ dependencies = [ [[package]] name = "jur-node" -version = "2.0.1" +version = "2.0.2" dependencies = [ "clap", "frame-benchmarking", @@ -3370,7 +3370,7 @@ dependencies = [ [[package]] name = "jur-node-runtime" -version = "2.0.1" +version = "2.0.2" dependencies = [ "frame-benchmarking", "frame-executive", @@ -6256,9 +6256,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" dependencies = [ "ring", "untrusted", diff --git a/node/Cargo.toml b/node/Cargo.toml index 5b3a7954..f2b908b0 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jur-node" -version = "2.0.1" +version = "2.0.2" edition = "2021" license = "Unlicense" publish = false @@ -55,7 +55,7 @@ frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/parityte frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" } # Local Dependencies -jur-node-runtime = { version = "2.0.1", path = "../runtime" } +jur-node-runtime = { version = "2.0.2", path = "../runtime" } primitives = { package = 'jur-primitives', path = '../primitives' } # CLI-specific dependencies diff --git a/pallets/community/src/benchmarking.rs b/pallets/community/src/benchmarking.rs index 1b794162..24c8d64e 100644 --- a/pallets/community/src/benchmarking.rs +++ b/pallets/community/src/benchmarking.rs @@ -180,7 +180,7 @@ benchmarks! { Some("#E76080".into()) ).unwrap(); - let member: T::AccountId = whitelisted_caller(); + let member: T::AccountId = account("sub", 2, SEED); }: _( RawOrigin::Signed(member), T::Helper::community(1) diff --git a/pallets/community/src/lib.rs b/pallets/community/src/lib.rs index 6c415b0f..c26a3b07 100644 --- a/pallets/community/src/lib.rs +++ b/pallets/community/src/lib.rs @@ -397,7 +397,10 @@ pub mod pallet { let mut community_members = community.members.clone(); + ensure!(community.founder != member, Error::::AlreadyMember); + ensure!(!community_members.contains(&member), Error::::AlreadyMember); + community_members.push(member.clone()); community.members = community_members; diff --git a/pallets/passport/src/benchmarking.rs b/pallets/passport/src/benchmarking.rs index e793b53d..26613538 100644 --- a/pallets/passport/src/benchmarking.rs +++ b/pallets/passport/src/benchmarking.rs @@ -81,7 +81,7 @@ benchmarks! { ) verify { assert_last_event::(Event::::MintedPassport( - ::Helper::passport(4851) + ::Helper::passport(5001) ).into()); } @@ -104,7 +104,7 @@ benchmarks! { }: _(RawOrigin::Signed(member), community_id, bounded_passport_address) verify { assert_last_event::(Event::::UpdatedPassport( - ::Helper::passport(4851) + ::Helper::passport(5001) ).into()); } diff --git a/pallets/passport/src/tests.rs b/pallets/passport/src/tests.rs index acaa572c..8240b01b 100644 --- a/pallets/passport/src/tests.rs +++ b/pallets/passport/src/tests.rs @@ -63,7 +63,7 @@ fn mint_passport_works_for_founder() { add_founder(); create_community(); assert_ok!(Passport::mint(RuntimeOrigin::signed(1), 1)); - assert_eq!(Passports::::get(1, 1).unwrap().id, 4851); + assert_eq!(Passports::::get(1, 1).unwrap().id, 5001); create_community(); assert_ok!(Passport::mint(RuntimeOrigin::signed(1), 2)); assert_eq!(Passports::::get(2, 1).unwrap().id, 1); diff --git a/pallets/user/src/lib.rs b/pallets/user/src/lib.rs index e450541f..bddae89d 100644 --- a/pallets/user/src/lib.rs +++ b/pallets/user/src/lib.rs @@ -117,10 +117,10 @@ pub mod pallet { } // Validating the duplicate username - for (_, userdata) in Users::::iter() { + for (account, userdata) in Users::::iter() { ensure!( - userdata.name != name || userdata.name == None, - Error::::UsernameNotAvailable + userdata.name != name || userdata.name == None || + ( account == user && userdata.name == name),Error::::UsernameNotAvailable ); } diff --git a/pallets/user/src/tests.rs b/pallets/user/src/tests.rs index e4c878fa..c711d414 100644 --- a/pallets/user/src/tests.rs +++ b/pallets/user/src/tests.rs @@ -30,7 +30,7 @@ fn update_user_not_works_with_existing_name() { ); assert_noop!( User::update_user( - RuntimeOrigin::signed(1), + RuntimeOrigin::signed(2), Some("Alice".as_bytes().to_vec().try_into().unwrap()), Some("avatar".as_bytes().to_vec().try_into().unwrap()) ), diff --git a/primitives/src/macros.rs b/primitives/src/macros.rs index 9ca7ca7e..c59351ae 100644 --- a/primitives/src/macros.rs +++ b/primitives/src/macros.rs @@ -14,7 +14,7 @@ macro_rules! impl_incrementable { } fn jur_community_reserve_slots() -> Self { - 4851 + 5001 } } )+ diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index cdd65477..6e87457b 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jur-node-runtime" -version = "2.0.1" +version = "2.0.2" edition = "2021" license = "Unlicense" publish = false diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 3ea022ee..7e52e9d8 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -120,7 +120,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 105, + spec_version: 106, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,