diff --git a/docs/api/runtime-calls.md b/docs/api/runtime-calls.md index 064ef8b059bb138b7c1d74a635822a813939d7d0..5adde95a843e80509d6e673d0b10f95218751734 100644 --- a/docs/api/runtime-calls.md +++ b/docs/api/runtime-calls.md @@ -12,7 +12,7 @@ Calls are categorized according to the dispatch origin they require: We only document user calls below. -There are **64** user calls from **17** pallets. +There are **63** user calls from **17** pallets. ## Account - 1 @@ -105,28 +105,6 @@ The dispatch origin of this call must be Signed. transfer everything except at least the existential deposit, which will guarantee to keep the sender account alive (true). -### burn - 10 - -<details><summary><code>burn(value, keep_alive)</code></summary> - -No weight available. - -```rust -value: T::Balance -keep_alive: bool -``` -</details> - - - -Burn the specified liquid free balance from the origin account. - -If the origin's account ends up below the existential deposit as a result -of the burn and `keep_alive` is false, the account will be reaped. - -Unlike sending funds to a _burn_ address, which merely makes the funds inaccessible, -this `burn` operation will reduce total issuance by the amount _burned_. - ## OneshotAccount - 7 ### create_oneshot_account - 0 diff --git a/node/src/chain_spec/gen_genesis_data.rs b/node/src/chain_spec/gen_genesis_data.rs index a7c338ac60e080bc48569576b511bdd2f8b9a5a2..59717f6cd970ee6541070b08796b0dcb5705d672 100644 --- a/node/src/chain_spec/gen_genesis_data.rs +++ b/node/src/chain_spec/gen_genesis_data.rs @@ -187,8 +187,6 @@ struct IdentityV1 { membership_revokes_on: TimestampV1, /// whether the identity is revoked (manually or automatically) revoked: bool, - /// timestamp at which the next cert can be emitted - next_cert_issuable_on: TimestampV1, // TODO: unused? /// balance of the account of this identity balance: u64, /// certs received with their expiration timestamp @@ -212,8 +210,6 @@ struct IdentityV2 { identity_revoke_on: u32, /// whether the identity is revoked (manually or automatically) revoked: bool, - /// block at which the next cert can be emitted - next_cert_issuable_on: u32, /// balance of the account of this identity balance: u64, /// certs received with their expiration block @@ -1232,10 +1228,6 @@ fn genesis_data_to_identities_v2( genesis_timestamp, ), revoked: i.revoked, - next_cert_issuable_on: timestamp_to_relative_blocs( - i.next_cert_issuable_on, - genesis_timestamp, - ), balance: i.balance, certs_received: i .certs_received @@ -1276,7 +1268,6 @@ fn make_authority_exist<SessionKeys: Encode, SKP: SessionKeysProvider<SessionKey membership_expire_on: common_parameters.membership_membership_period, identity_revoke_on: common_parameters.membership_membership_period, revoked: false, - next_cert_issuable_on: 0, }, ); }; diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index 70518f7fd0f83752431c2e5f5c69a5385401cde9..6fda9a68c9621cb34358ede9a3cc138b7eb58905 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -331,10 +331,11 @@ pub mod pallet { core::num::NonZeroU16::new(current_ud_index) .expect("unreachable because current_ud_index is never zero."), ); - let _ = T::Currency::deposit(who, uds_total, Precision::Exact); + // Currency is issued here + let actual_total = T::Currency::mint_into(who, uds_total)?; Self::deposit_event(Event::UdsClaimed { count: uds_count, - total: uds_total, + total: actual_total, who: who.clone(), }); Ok(().into()) diff --git a/pallets/universal-dividend/src/tests.rs b/pallets/universal-dividend/src/tests.rs index 3240e9b5fdc713dedd381870e57e6ad22c2e0e39..c8a726fb2fe8f36fd32c32b92f29c803c9cd27d8 100644 --- a/pallets/universal-dividend/src/tests.rs +++ b/pallets/universal-dividend/src/tests.rs @@ -62,6 +62,11 @@ fn test_claim_uds() { total: 1_000, who: 1, })); + // the expected event from pallet balances is Minted + System::assert_has_event(RuntimeEvent::Balances(pallet_balances::Event::Minted { + who: 1, + amount: 1000, + })); assert_eq!(Balances::free_balance(1), 1_000); // Others members should not receive any UDs with Alice claim assert_eq!(Balances::free_balance(2), 0); diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index cecb06be5088a2346dc7dd256479df2d11857756..4b7d0427887bc85146940e9d8be33f516533e325 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -173,7 +173,12 @@ mod benches { pub struct BaseCallFilter; impl Contains<RuntimeCall> for BaseCallFilter { fn contains(call: &RuntimeCall) -> bool { - !matches!(call, RuntimeCall::Session(_)) + // not allowed to run session calls directly + // not allowed to burn currency + !matches!( + call, + RuntimeCall::Session(_) | RuntimeCall::Balances(pallet_balances::Call::burn { .. }) + ) } } diff --git a/runtime/gdev/tests/integration_tests.rs b/runtime/gdev/tests/integration_tests.rs index a8b3cb47bb304485811570f2a50c14685ab7b5f5..911d2be7e54d1a0d68a24119dd30e52cdb04f5c7 100644 --- a/runtime/gdev/tests/integration_tests.rs +++ b/runtime/gdev/tests/integration_tests.rs @@ -166,9 +166,9 @@ fn test_total_issuance_vs_monetary_mass() { 6000 ); // Alice claims her UD - assert_ok!(UniversalDividend::claim_uds( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into() - )); + assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( + AccountKeyring::Alice.to_account_id() + ))); assert_eq!(Balances::total_issuance(), 4000); assert_eq!( pallet_universal_dividend::MonetaryMass::<Runtime>::get(), @@ -177,9 +177,9 @@ fn test_total_issuance_vs_monetary_mass() { // second UD creation run_to_block(21); // Bob claims his 2 UDs - assert_ok!(UniversalDividend::claim_uds( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into() - )); + assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( + AccountKeyring::Bob.to_account_id() + ))); assert_eq!(Balances::total_issuance(), 6000); assert_eq!( pallet_universal_dividend::MonetaryMass::<Runtime>::get(), @@ -200,7 +200,7 @@ fn test_identity_below_ed() { // a transfer below ED will lead to frozen token error assert_noop!( Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Bob.to_account_id()), 850 ), @@ -209,7 +209,7 @@ 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( - // frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + // RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), // MultiAddress::Id(AccountKeyring::Bob.to_account_id()), // 800 // )); @@ -337,29 +337,29 @@ fn test_validate_identity_when_claim() { run_to_block(1); // alice create identity for Eve assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), )); run_to_block(2); // eve confirms her identity assert_ok!(Identity::confirm_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), "Eeeeeveeeee".into(), )); run_to_block(3); // eve gets certified by bob and charlie assert_ok!(Certification::add_cert( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), 5 )); assert_ok!(Certification::add_cert( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), 5 )); // eve request distance evaluation for herself assert_ok!(Distance::request_distance_evaluation( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), )); // Pass 2nd evaluation period @@ -367,7 +367,7 @@ fn test_validate_identity_when_claim() { run_to_block(2 * eval_period); // simulate an evaluation published by smith Alice assert_ok!(Distance::force_update_evaluation( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), AccountKeyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], @@ -386,7 +386,7 @@ fn test_validate_identity_when_claim() { // the following call does not exist anymore // assert_noop!( // Membership::claim_membership( - // frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -417,7 +417,7 @@ fn test_identity_creation_workflow() { run_to_block(1); // alice create identity for Eve assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), )); assert_eq!( @@ -434,7 +434,7 @@ fn test_identity_creation_workflow() { run_to_block(2); // eve confirms her identity assert_ok!(Identity::confirm_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), "Eeeeeveeeee".into(), )); assert_eq!( @@ -451,17 +451,17 @@ fn test_identity_creation_workflow() { run_to_block(3); // eve gets certified by bob and charlie assert_ok!(Certification::add_cert( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), 5 )); assert_ok!(Certification::add_cert( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), 5 )); // charlie also request distance evaluation for eve // (could be done in batch) assert_ok!(Distance::request_distance_evaluation_for( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), 5 )); // then the evaluation is pending @@ -475,7 +475,7 @@ fn test_identity_creation_workflow() { run_to_block(2 * eval_period); // simulate evaluation published by smith Alice assert_ok!(Distance::force_update_evaluation( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), AccountKeyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], @@ -524,9 +524,9 @@ fn test_identity_creation_workflow() { members_count: 5, }, )); - assert_ok!(UniversalDividend::claim_uds( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), - )); + assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( + AccountKeyring::Eve.to_account_id() + ),)); System::assert_has_event(RuntimeEvent::UniversalDividend( pallet_universal_dividend::Event::UdsClaimed { count: (10 - first_eligible), @@ -555,7 +555,7 @@ fn test_can_not_issue_cert_when_membership_lost() { // Bob can not issue a certification assert_noop!( Certification::add_cert( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), 3, ), pallet_duniter_wot::Error::<gdev_runtime::Runtime>::IssuerNotMember @@ -614,23 +614,23 @@ fn test_membership_renewal() { .execute_with(|| { // can not renew membership immediately assert_noop!( - Distance::request_distance_evaluation( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - ), + Distance::request_distance_evaluation(RuntimeOrigin::signed( + AccountKeyring::Alice.to_account_id() + ),), pallet_duniter_wot::Error::<Runtime>::MembershipRenewalPeriodNotRespected, ); // but ok after waiting 10 blocks delay run_to_block(11); assert_ok!(Distance::request_distance_evaluation( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), )); // Pass 3rd evaluation period let eval_period: u32 = <Runtime as pallet_distance::Config>::EvaluationPeriod::get(); run_to_block(3 * eval_period); assert_ok!(Distance::force_update_evaluation( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), AccountKeyring::Alice.to_account_id(), pallet_distance::ComputationResult { distances: vec![Perbill::one()], @@ -650,9 +650,9 @@ fn test_membership_renewal() { // not possible to renew manually // can not ask renewal when period is not respected assert_noop!( - Distance::request_distance_evaluation( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - ), + Distance::request_distance_evaluation(RuntimeOrigin::signed( + AccountKeyring::Alice.to_account_id() + ),), pallet_duniter_wot::Error::<Runtime>::MembershipRenewalPeriodNotRespected, ); @@ -770,9 +770,9 @@ fn test_claim_ud_after_revoke() { ); assert_err!( - UniversalDividend::claim_uds( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into() - ), + UniversalDividend::claim_uds(RuntimeOrigin::signed( + AccountKeyring::Bob.to_account_id() + )), pallet_universal_dividend::Error::<Runtime>::AccountNotAllowedToClaimUds, ); @@ -833,14 +833,14 @@ fn test_ud_claimed_membership_on_and_off() { // alice claims back her membership through distance evaluation assert_ok!(Distance::force_valid_distance_status( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), 1, )); // it can not be done manually // because the call does not exist anymore // assert_noop!( // Membership::claim_membership( - // frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + // RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -864,9 +864,9 @@ 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( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into() - )); + assert_ok!(UniversalDividend::claim_uds(RuntimeOrigin::signed( + AccountKeyring::Alice.to_account_id() + ))); System::assert_has_event(RuntimeEvent::UniversalDividend( pallet_universal_dividend::Event::UdsClaimed { count: 1, @@ -919,7 +919,7 @@ fn test_smith_certification() { assert_noop!( SmithMembers::certify_smith( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), 2 ), pallet_smith_members::Error::<Runtime>::CertificationAlreadyExists @@ -927,7 +927,7 @@ fn test_smith_certification() { assert_noop!( SmithMembers::certify_smith( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), 4 ), pallet_smith_members::Error::<Runtime>::CertificationReceiverMustHaveBeenInvited @@ -966,17 +966,15 @@ fn test_smith_process() { // no more membership request assert_ok!(SmithMembers::invite_smith( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), 4 )); - assert_ok!(SmithMembers::accept_invitation( - frame_system::RawOrigin::Signed(dave).into(), - )); + assert_ok!(SmithMembers::accept_invitation(RuntimeOrigin::signed(dave),)); // Dave cannot (yet) set his session keys assert_err!( AuthorityMembers::set_session_keys( - frame_system::RawOrigin::Signed(AccountKeyring::Dave.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Dave.to_account_id()), dummy_session_keys.clone() ), pallet_authority_members::Error::<Runtime>::NotMember @@ -984,15 +982,15 @@ fn test_smith_process() { // Alice Bob and Charlie can certify Dave assert_ok!(SmithMembers::certify_smith( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), 4 )); assert_ok!(SmithMembers::certify_smith( - frame_system::RawOrigin::Signed(bob.clone()).into(), + RuntimeOrigin::signed(bob.clone()), 4 )); assert_ok!(SmithMembers::certify_smith( - frame_system::RawOrigin::Signed(charlie.clone()).into(), + RuntimeOrigin::signed(charlie.clone()), 4 )); @@ -1010,14 +1008,14 @@ fn test_smith_process() { // Dave can set his (dummy) session keys assert_ok!(AuthorityMembers::set_session_keys( - frame_system::RawOrigin::Signed(AccountKeyring::Dave.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Dave.to_account_id()), dummy_session_keys )); // Dave can go online - assert_ok!(AuthorityMembers::go_online( - frame_system::RawOrigin::Signed(AccountKeyring::Dave.to_account_id()).into(), - )); + assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( + AccountKeyring::Dave.to_account_id() + ),)); }) } @@ -1120,7 +1118,7 @@ fn test_create_new_account() { // Should be able to transfer 5 units to a new account assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 500 )); @@ -1148,7 +1146,7 @@ fn test_create_new_account() { // can remove an account using transfer assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), MultiAddress::Id(AccountKeyring::Alice.to_account_id()), 500 )); @@ -1177,26 +1175,26 @@ fn test_create_new_idty() { // Should be able to create an identity assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 200 )); assert_noop!( Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), ), pallet_identity::Error::<Runtime>::InsufficientBalance ); assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 200 )); assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), )); @@ -1222,7 +1220,7 @@ fn test_create_new_idty_without_founds() { // Should not be able to create an identity without founds assert_noop!( Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), ), pallet_identity::Error::<Runtime>::AccountNotExist @@ -1230,13 +1228,13 @@ fn test_create_new_idty_without_founds() { // Deposit some founds on the account assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 500 )); assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::Eve.to_account_id(), )); System::assert_has_event(RuntimeEvent::Identity( @@ -1276,38 +1274,38 @@ fn test_validate_new_idty_after_few_uds() { // Should be able to create an identity assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 200 )); assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::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( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::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( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), 5, )); // valid distance status should trigger identity validation assert_ok!(Distance::force_valid_distance_status( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), 5, )); // and it is not possible to call it manually // because the call does not exist anymore // assert_noop!( // Membership::claim_membership( - // frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -1341,34 +1339,34 @@ fn test_claim_memberhsip_after_few_uds() { // Should be able to create an identity assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), AccountKeyring::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( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::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( - frame_system::RawOrigin::Signed(AccountKeyring::Bob.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Bob.to_account_id()), 5, )); // eve membership should be able to be claimed through distance evaluation assert_ok!(Distance::force_valid_distance_status( - frame_system::RawOrigin::Root.into(), + RuntimeOrigin::root(), 5, )); // but not manually // because the call does not exist // assert_noop!( // Membership::claim_membership( - // frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + // RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), // ), // pallet_membership::Error::<Runtime>::AlreadyMember // ); @@ -1398,7 +1396,7 @@ fn test_oneshot_accounts() { run_to_block(6); assert_ok!(OneshotAccount::create_oneshot_account( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Eve.to_account_id()), 400 )); @@ -1409,7 +1407,7 @@ fn test_oneshot_accounts() { run_to_block(7); assert_ok!(OneshotAccount::consume_oneshot_account_with_remaining( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Oneshot(MultiAddress::Id( AccountKeyring::Ferdie.to_account_id() @@ -1425,7 +1423,7 @@ fn test_oneshot_accounts() { ); assert_noop!( OneshotAccount::consume_oneshot_account( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Oneshot(MultiAddress::Id( AccountKeyring::Ferdie.to_account_id() @@ -1441,7 +1439,7 @@ fn test_oneshot_accounts() { ); assert_ok!(OneshotAccount::consume_oneshot_account( - frame_system::RawOrigin::Signed(AccountKeyring::Ferdie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Ferdie.to_account_id()), 0, pallet_oneshot_account::Account::Normal(MultiAddress::Id( AccountKeyring::Alice.to_account_id() @@ -1453,7 +1451,7 @@ fn test_oneshot_accounts() { ); assert_noop!( OneshotAccount::consume_oneshot_account( - frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Eve.to_account_id()), 0, pallet_oneshot_account::Account::Normal(MultiAddress::Id( AccountKeyring::Alice.to_account_id() @@ -1480,7 +1478,7 @@ fn test_link_account() { // Ferdie's account cannot be linked to Alice identity because the account does not exist assert_noop!( Identity::link_account( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), ferdie.clone(), signature.into() ), @@ -1488,13 +1486,13 @@ fn test_link_account() { ); assert_ok!(Balances::transfer_allow_death( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), MultiAddress::Id(ferdie.clone()), 1_000 )); // Ferdie's account can be linked to Alice identity assert_ok!(Identity::link_account( - frame_system::RawOrigin::Signed(alice).into(), + RuntimeOrigin::signed(alice), ferdie, signature.into() )); @@ -1517,7 +1515,7 @@ fn test_change_owner_key_validator_online() { // As an online validator she cannot change key assert_noop!( Identity::change_owner_key( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), ferdie.clone(), signature.into() ), @@ -1558,7 +1556,7 @@ fn test_change_owner_key() { ); // Dave can change his owner key to Ferdie's assert_ok!(Identity::change_owner_key( - frame_system::RawOrigin::Signed(charlie.clone()).into(), + RuntimeOrigin::signed(charlie.clone()), ferdie.clone(), signature.into() )); @@ -1581,12 +1579,12 @@ 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( - frame_system::RawOrigin::Signed(AccountKeyring::Ferdie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Ferdie.to_account_id()), create_dummy_session_keys() )); - assert_ok!(AuthorityMembers::go_online( - frame_system::RawOrigin::Signed(AccountKeyring::Ferdie.to_account_id()).into() - )); + assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( + AccountKeyring::Ferdie.to_account_id() + ))); // Charlie is still an offline smith assert_eq!( @@ -1630,12 +1628,12 @@ fn test_smith_member_can_revoke_its_idty() { // Charlie goes online frame_system::Pallet::<Runtime>::inc_providers(&AccountKeyring::Charlie.to_account_id()); assert_ok!(AuthorityMembers::set_session_keys( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), create_dummy_session_keys() )); - assert_ok!(AuthorityMembers::go_online( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into() - )); + assert_ok!(AuthorityMembers::go_online(RuntimeOrigin::signed( + AccountKeyring::Charlie.to_account_id() + ))); run_to_block(25); @@ -1654,7 +1652,7 @@ fn test_smith_member_can_revoke_its_idty() { AccountKeyring::Charlie.sign(&(REVOCATION_PAYLOAD_PREFIX, revocation_payload).encode()); assert_ok!(Identity::revoke_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Charlie.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Charlie.to_account_id()), 3, AccountKeyring::Charlie.to_account_id(), signature.into() @@ -1720,9 +1718,9 @@ fn test_unlink_identity() { assert_eq!(Identity::identity_index_of(&alice_account), Some(1)); // Alice can unlink her identity from her account - assert_ok!(Account::unlink_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), - )); + assert_ok!(Account::unlink_identity(RuntimeOrigin::signed( + AccountKeyring::Alice.to_account_id() + ),)); // Alice account has been unlinked assert_eq!( @@ -1749,7 +1747,7 @@ fn test_new_account_linked() { ); // Alice creates identity for Eve assert_ok!(Identity::create_identity( - frame_system::RawOrigin::Signed(AccountKeyring::Alice.to_account_id()).into(), + RuntimeOrigin::signed(AccountKeyring::Alice.to_account_id()), eve_account.clone(), )); // then eve account should be linked to her identity @@ -1781,7 +1779,7 @@ fn test_killed_account() { Some(2) ); assert_ok!(Balances::transfer_all( - frame_system::RawOrigin::Signed(bob_account.clone()).into(), + RuntimeOrigin::signed(bob_account.clone()), sp_runtime::MultiAddress::Id(alice_account.clone()), false )); diff --git a/runtime/gdev/tests/xt_tests.rs b/runtime/gdev/tests/xt_tests.rs index 5bbb96acc988411a73cd0d421eee496a92ee703d..6fcc2060c37257f7f12b5d234a3e864e08bd999b 100644 --- a/runtime/gdev/tests/xt_tests.rs +++ b/runtime/gdev/tests/xt_tests.rs @@ -180,7 +180,7 @@ fn test_refund_reaped_linked_account() { // Ferdie's account can be linked to Alice identity assert_ok!(Identity::link_account( - frame_system::RawOrigin::Signed(alice.clone()).into(), + RuntimeOrigin::signed(alice.clone()), ferdie.clone(), signature.into() )); diff --git a/xtask/src/gen_doc.rs b/xtask/src/gen_doc.rs index 9fd9c9092c435587b6681dd797c6d9a23acdb40e..68d77c6117c24adb7ce14e6e552b189f467d3204 100644 --- a/xtask/src/gen_doc.rs +++ b/xtask/src/gen_doc.rs @@ -232,6 +232,7 @@ impl CallCategory { | "force_unreserve" | "force_adjust_total_issuance", ) => Self::Root, + ("Balances", "burn") => Self::Disabled, ("Sudo", _) => Self::Sudo, ("Treasury", "approve_proposal" | "reject_proposal") => Self::OtherOrigin, ("Utility", "dispatch_as" | "with_weight") => Self::Root,