From 31de7bf60f882ebac503c5cd6c576551cabe985f Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Fri, 11 Jun 2021 11:09:26 +0200 Subject: [PATCH 1/9] make all extrinsics public so they are available from outside --- frame/assets/src/lib.rs | 46 +++++++++++++------------- frame/atomic-swap/src/lib.rs | 6 ++-- frame/balances/src/lib.rs | 4 +-- frame/democracy/src/lib.rs | 48 ++++++++++++++-------------- frame/elections-phragmen/src/lib.rs | 12 +++---- frame/example/src/lib.rs | 4 +-- frame/grandpa/src/lib.rs | 2 +- frame/identity/src/lib.rs | 30 ++++++++--------- frame/indices/src/lib.rs | 10 +++--- frame/lottery/src/lib.rs | 8 ++--- frame/multisig/src/lib.rs | 8 ++--- frame/nicks/src/lib.rs | 8 ++--- frame/proxy/src/lib.rs | 20 ++++++------ frame/recovery/src/lib.rs | 18 +++++------ frame/scheduler/src/lib.rs | 12 +++---- frame/sudo/src/lib.rs | 8 ++--- frame/support/src/lib.rs | 2 +- frame/system/src/lib.rs | 14 ++++---- frame/timestamp/src/lib.rs | 2 +- frame/transaction-storage/src/lib.rs | 6 ++-- frame/uniques/src/lib.rs | 44 ++++++++++++------------- 21 files changed, 156 insertions(+), 156 deletions(-) diff --git a/frame/assets/src/lib.rs b/frame/assets/src/lib.rs index 333dbad836462..afcdb5b054d04 100644 --- a/frame/assets/src/lib.rs +++ b/frame/assets/src/lib.rs @@ -368,7 +368,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::create())] - pub(super) fn create( + pub fn create( origin: OriginFor, #[pallet::compact] id: T::AssetId, admin: ::Source, @@ -424,7 +424,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_create())] - pub(super) fn force_create( + pub fn force_create( origin: OriginFor, #[pallet::compact] id: T::AssetId, owner: ::Source, @@ -477,7 +477,7 @@ pub mod pallet { witness.sufficients, witness.approvals, ))] - pub(super) fn destroy( + pub fn destroy( origin: OriginFor, #[pallet::compact] id: T::AssetId, witness: DestroyWitness, @@ -528,7 +528,7 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`. #[pallet::weight(T::WeightInfo::mint())] - pub(super) fn mint( + pub fn mint( origin: OriginFor, #[pallet::compact] id: T::AssetId, beneficiary: ::Source, @@ -556,7 +556,7 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: Post-existence of `who`; Pre & post Zombie-status of `who`. #[pallet::weight(T::WeightInfo::burn())] - pub(super) fn burn( + pub fn burn( origin: OriginFor, #[pallet::compact] id: T::AssetId, who: ::Source, @@ -589,7 +589,7 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::weight(T::WeightInfo::transfer())] - pub(super) fn transfer( + pub fn transfer( origin: OriginFor, #[pallet::compact] id: T::AssetId, target: ::Source, @@ -625,7 +625,7 @@ pub mod pallet { /// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of /// `target`. #[pallet::weight(T::WeightInfo::transfer_keep_alive())] - pub(super) fn transfer_keep_alive( + pub fn transfer_keep_alive( origin: OriginFor, #[pallet::compact] id: T::AssetId, target: ::Source, @@ -662,7 +662,7 @@ pub mod pallet { /// Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of /// `dest`. #[pallet::weight(T::WeightInfo::force_transfer())] - pub(super) fn force_transfer( + pub fn force_transfer( origin: OriginFor, #[pallet::compact] id: T::AssetId, source: ::Source, @@ -692,7 +692,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::freeze())] - pub(super) fn freeze( + pub fn freeze( origin: OriginFor, #[pallet::compact] id: T::AssetId, who: ::Source @@ -724,7 +724,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::thaw())] - pub(super) fn thaw( + pub fn thaw( origin: OriginFor, #[pallet::compact] id: T::AssetId, @@ -756,7 +756,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::freeze_asset())] - pub(super) fn freeze_asset( + pub fn freeze_asset( origin: OriginFor, #[pallet::compact] id: T::AssetId ) -> DispatchResult { @@ -783,7 +783,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::thaw_asset())] - pub(super) fn thaw_asset( + pub fn thaw_asset( origin: OriginFor, #[pallet::compact] id: T::AssetId ) -> DispatchResult { @@ -811,7 +811,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::transfer_ownership())] - pub(super) fn transfer_ownership( + pub fn transfer_ownership( origin: OriginFor, #[pallet::compact] id: T::AssetId, owner: ::Source, @@ -852,7 +852,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_team())] - pub(super) fn set_team( + pub fn set_team( origin: OriginFor, #[pallet::compact] id: T::AssetId, issuer: ::Source, @@ -894,7 +894,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_metadata(name.len() as u32, symbol.len() as u32))] - pub(super) fn set_metadata( + pub fn set_metadata( origin: OriginFor, #[pallet::compact] id: T::AssetId, name: Vec, @@ -957,7 +957,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::clear_metadata())] - pub(super) fn clear_metadata( + pub fn clear_metadata( origin: OriginFor, #[pallet::compact] id: T::AssetId, ) -> DispatchResult { @@ -989,7 +989,7 @@ pub mod pallet { /// /// Weight: `O(N + S)` where N and S are the length of the name and symbol respectively. #[pallet::weight(T::WeightInfo::force_set_metadata(name.len() as u32, symbol.len() as u32))] - pub(super) fn force_set_metadata( + pub fn force_set_metadata( origin: OriginFor, #[pallet::compact] id: T::AssetId, name: Vec, @@ -1037,7 +1037,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_clear_metadata())] - pub(super) fn force_clear_metadata( + pub fn force_clear_metadata( origin: OriginFor, #[pallet::compact] id: T::AssetId, ) -> DispatchResult { @@ -1075,7 +1075,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_asset_status())] - pub(super) fn force_asset_status( + pub fn force_asset_status( origin: OriginFor, #[pallet::compact] id: T::AssetId, owner: ::Source, @@ -1125,7 +1125,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::approve_transfer())] - pub(super) fn approve_transfer( + pub fn approve_transfer( origin: OriginFor, #[pallet::compact] id: T::AssetId, delegate: ::Source, @@ -1164,7 +1164,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::cancel_approval())] - pub(super) fn cancel_approval( + pub fn cancel_approval( origin: OriginFor, #[pallet::compact] id: T::AssetId, delegate: ::Source, @@ -1192,7 +1192,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_cancel_approval())] - pub(super) fn force_cancel_approval( + pub fn force_cancel_approval( origin: OriginFor, #[pallet::compact] id: T::AssetId, owner: ::Source, @@ -1236,7 +1236,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::transfer_approved())] - pub(super) fn transfer_approved( + pub fn transfer_approved( origin: OriginFor, #[pallet::compact] id: T::AssetId, owner: ::Source, diff --git a/frame/atomic-swap/src/lib.rs b/frame/atomic-swap/src/lib.rs index afc74dd2a549e..4c19a61bb72f3 100644 --- a/frame/atomic-swap/src/lib.rs +++ b/frame/atomic-swap/src/lib.rs @@ -226,7 +226,7 @@ pub mod pallet { /// that the revealer uses a shorter duration than the counterparty, to prevent the /// situation where the revealer reveals the proof too late around the end block. #[pallet::weight(T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000))] - pub(crate) fn create_swap( + pub fn create_swap( origin: OriginFor, target: T::AccountId, hashed_proof: HashedProof, @@ -268,7 +268,7 @@ pub mod pallet { .saturating_add((proof.len() as Weight).saturating_mul(100)) .saturating_add(action.weight()) )] - pub(crate) fn claim_swap( + pub fn claim_swap( origin: OriginFor, proof: Vec, action: T::SwapAction, @@ -303,7 +303,7 @@ pub mod pallet { /// - `target`: Target of the original atomic swap. /// - `hashed_proof`: Hashed proof of the original atomic swap. #[pallet::weight(T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000))] - pub(crate) fn cancel_swap( + pub fn cancel_swap( origin: OriginFor, target: T::AccountId, hashed_proof: HashedProof, diff --git a/frame/balances/src/lib.rs b/frame/balances/src/lib.rs index 23c5cc97d0937..ad0abfd80654d 100644 --- a/frame/balances/src/lib.rs +++ b/frame/balances/src/lib.rs @@ -291,7 +291,7 @@ pub mod pallet { T::WeightInfo::set_balance_creating() // Creates a new account. .max(T::WeightInfo::set_balance_killing()) // Kills an existing account. )] - pub(super) fn set_balance( + pub fn set_balance( origin: OriginFor, who: ::Source, #[pallet::compact] new_free: T::Balance, @@ -1696,7 +1696,7 @@ impl, I: 'static> NamedReservableCurrency for Pallet< /// Is a no-op if value to be reserved is zero. fn reserve_named(id: &Self::ReserveIdentifier, who: &T::AccountId, value: Self::Balance) -> DispatchResult { if value.is_zero() { return Ok(()) } - + Reserves::::try_mutate(who, |reserves| -> DispatchResult { match reserves.binary_search_by_key(id, |data| data.id) { Ok(index) => { diff --git a/frame/democracy/src/lib.rs b/frame/democracy/src/lib.rs index 70b943bf00d54..6ebe917f56ae5 100644 --- a/frame/democracy/src/lib.rs +++ b/frame/democracy/src/lib.rs @@ -634,7 +634,7 @@ pub mod pallet { /// /// Weight: `O(p)` #[pallet::weight(T::WeightInfo::propose())] - pub(crate) fn propose( + pub fn propose( origin: OriginFor, proposal_hash: T::Hash, #[pallet::compact] value: BalanceOf, @@ -675,7 +675,7 @@ pub mod pallet { /// /// Weight: `O(S)` where S is the number of seconds a proposal already has. #[pallet::weight(T::WeightInfo::second(*seconds_upper_bound))] - pub(crate) fn second( + pub fn second( origin: OriginFor, #[pallet::compact] proposal: PropIndex, #[pallet::compact] seconds_upper_bound: u32, @@ -706,7 +706,7 @@ pub mod pallet { T::WeightInfo::vote_new(T::MaxVotes::get()) .max(T::WeightInfo::vote_existing(T::MaxVotes::get())) )] - pub(crate) fn vote( + pub fn vote( origin: OriginFor, #[pallet::compact] ref_index: ReferendumIndex, vote: AccountVote>, @@ -724,7 +724,7 @@ pub mod pallet { /// /// Weight: `O(1)`. #[pallet::weight((T::WeightInfo::emergency_cancel(), DispatchClass::Operational))] - pub(crate) fn emergency_cancel(origin: OriginFor, ref_index: ReferendumIndex) -> DispatchResult { + pub fn emergency_cancel(origin: OriginFor, ref_index: ReferendumIndex) -> DispatchResult { T::CancellationOrigin::ensure_origin(origin)?; let status = Self::referendum_status(ref_index)?; @@ -746,7 +746,7 @@ pub mod pallet { /// Weight: `O(V)` with V number of vetoers in the blacklist of proposal. /// Decoding vec of length V. Charged as maximum #[pallet::weight(T::WeightInfo::external_propose(MAX_VETOERS))] - pub(crate) fn external_propose(origin: OriginFor, proposal_hash: T::Hash) -> DispatchResult { + pub fn external_propose(origin: OriginFor, proposal_hash: T::Hash) -> DispatchResult { T::ExternalOrigin::ensure_origin(origin)?; ensure!(!>::exists(), Error::::DuplicateProposal); if let Some((until, _)) = >::get(proposal_hash) { @@ -771,7 +771,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::external_propose_majority())] - pub(crate) fn external_propose_majority( + pub fn external_propose_majority( origin: OriginFor, proposal_hash: T::Hash, ) -> DispatchResult { @@ -792,7 +792,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::external_propose_default())] - pub(crate) fn external_propose_default( + pub fn external_propose_default( origin: OriginFor, proposal_hash: T::Hash, ) -> DispatchResult { @@ -817,7 +817,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::fast_track())] - pub(crate) fn fast_track( + pub fn fast_track( origin: OriginFor, proposal_hash: T::Hash, voting_period: T::BlockNumber, @@ -864,7 +864,7 @@ pub mod pallet { /// /// Weight: `O(V + log(V))` where V is number of `existing vetoers` #[pallet::weight(T::WeightInfo::veto_external(MAX_VETOERS))] - pub(crate) fn veto_external(origin: OriginFor, proposal_hash: T::Hash) -> DispatchResult { + pub fn veto_external(origin: OriginFor, proposal_hash: T::Hash) -> DispatchResult { let who = T::VetoOrigin::ensure_origin(origin)?; if let Some((e_proposal_hash, _)) = >::get() { @@ -896,7 +896,7 @@ pub mod pallet { /// /// # Weight: `O(1)`. #[pallet::weight(T::WeightInfo::cancel_referendum())] - pub(crate) fn cancel_referendum( + pub fn cancel_referendum( origin: OriginFor, #[pallet::compact] ref_index: ReferendumIndex, ) -> DispatchResult { @@ -913,7 +913,7 @@ pub mod pallet { /// /// Weight: `O(D)` where `D` is the items in the dispatch queue. Weighted as `D = 10`. #[pallet::weight((T::WeightInfo::cancel_queued(10), DispatchClass::Operational))] - pub(crate) fn cancel_queued(origin: OriginFor, which: ReferendumIndex) -> DispatchResult { + pub fn cancel_queued(origin: OriginFor, which: ReferendumIndex) -> DispatchResult { ensure_root(origin)?; T::Scheduler::cancel_named((DEMOCRACY_ID, which).encode()) .map_err(|_| Error::::ProposalMissing)?; @@ -970,7 +970,7 @@ pub mod pallet { // NOTE: weight must cover an incorrect voting of origin with max votes, this is ensure // because a valid delegation cover decoding a direct voting with max votes. #[pallet::weight(T::WeightInfo::undelegate(T::MaxVotes::get().into()))] - pub(crate) fn undelegate(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn undelegate(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; let votes = Self::try_undelegate(who)?; Ok(Some(T::WeightInfo::undelegate(votes)).into()) @@ -982,7 +982,7 @@ pub mod pallet { /// /// Weight: `O(1)`. #[pallet::weight(T::WeightInfo::clear_public_proposals())] - pub(crate) fn clear_public_proposals(origin: OriginFor) -> DispatchResult { + pub fn clear_public_proposals(origin: OriginFor) -> DispatchResult { ensure_root(origin)?; >::kill(); Ok(()) @@ -999,7 +999,7 @@ pub mod pallet { /// /// Weight: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). #[pallet::weight(T::WeightInfo::note_preimage(encoded_proposal.len() as u32))] - pub(crate) fn note_preimage(origin: OriginFor, encoded_proposal: Vec) -> DispatchResult { + pub fn note_preimage(origin: OriginFor, encoded_proposal: Vec) -> DispatchResult { Self::note_preimage_inner(ensure_signed(origin)?, encoded_proposal)?; Ok(()) } @@ -1009,7 +1009,7 @@ pub mod pallet { T::WeightInfo::note_preimage(encoded_proposal.len() as u32), DispatchClass::Operational, ))] - pub(crate) fn note_preimage_operational( + pub fn note_preimage_operational( origin: OriginFor, encoded_proposal: Vec, ) -> DispatchResult { @@ -1031,7 +1031,7 @@ pub mod pallet { /// /// Weight: `O(E)` with E size of `encoded_proposal` (protected by a required deposit). #[pallet::weight(T::WeightInfo::note_imminent_preimage(encoded_proposal.len() as u32))] - pub(crate) fn note_imminent_preimage( + pub fn note_imminent_preimage( origin: OriginFor, encoded_proposal: Vec, ) -> DispatchResultWithPostInfo { @@ -1046,7 +1046,7 @@ pub mod pallet { T::WeightInfo::note_imminent_preimage(encoded_proposal.len() as u32), DispatchClass::Operational, ))] - pub(crate) fn note_imminent_preimage_operational( + pub fn note_imminent_preimage_operational( origin: OriginFor, encoded_proposal: Vec, ) -> DispatchResultWithPostInfo { @@ -1073,7 +1073,7 @@ pub mod pallet { /// /// Weight: `O(D)` where D is length of proposal. #[pallet::weight(T::WeightInfo::reap_preimage(*proposal_len_upper_bound))] - pub(crate) fn reap_preimage( + pub fn reap_preimage( origin: OriginFor, proposal_hash: T::Hash, #[pallet::compact] proposal_len_upper_bound: u32, @@ -1116,7 +1116,7 @@ pub mod pallet { T::WeightInfo::unlock_set(T::MaxVotes::get()) .max(T::WeightInfo::unlock_remove(T::MaxVotes::get())) )] - pub(crate) fn unlock(origin: OriginFor, target: T::AccountId) -> DispatchResult { + pub fn unlock(origin: OriginFor, target: T::AccountId) -> DispatchResult { ensure_signed(origin)?; Self::update_lock(&target); Ok(()) @@ -1150,7 +1150,7 @@ pub mod pallet { /// Weight: `O(R + log R)` where R is the number of referenda that `target` has voted on. /// Weight is calculated for the maximum number of vote. #[pallet::weight(T::WeightInfo::remove_vote(T::MaxVotes::get()))] - pub(crate) fn remove_vote(origin: OriginFor, index: ReferendumIndex) -> DispatchResult { + pub fn remove_vote(origin: OriginFor, index: ReferendumIndex) -> DispatchResult { let who = ensure_signed(origin)?; Self::try_remove_vote(&who, index, UnvoteScope::Any) } @@ -1171,7 +1171,7 @@ pub mod pallet { /// Weight: `O(R + log R)` where R is the number of referenda that `target` has voted on. /// Weight is calculated for the maximum number of vote. #[pallet::weight(T::WeightInfo::remove_other_vote(T::MaxVotes::get()))] - pub(crate) fn remove_other_vote( + pub fn remove_other_vote( origin: OriginFor, target: T::AccountId, index: ReferendumIndex, @@ -1184,7 +1184,7 @@ pub mod pallet { /// Enact a proposal from a referendum. For now we just make the weight be the maximum. #[pallet::weight(T::BlockWeights::get().max_block)] - pub(crate) fn enact_proposal( + pub fn enact_proposal( origin: OriginFor, proposal_hash: T::Hash, index: ReferendumIndex, @@ -1209,7 +1209,7 @@ pub mod pallet { /// Weight: `O(p)` (though as this is an high-privilege dispatch, we assume it has a /// reasonable value). #[pallet::weight((T::WeightInfo::blacklist(T::MaxProposals::get()), DispatchClass::Operational))] - pub(crate) fn blacklist(origin: OriginFor, + pub fn blacklist(origin: OriginFor, proposal_hash: T::Hash, maybe_ref_index: Option, ) -> DispatchResult { @@ -1257,7 +1257,7 @@ pub mod pallet { /// /// Weight: `O(p)` where `p = PublicProps::::decode_len()` #[pallet::weight(T::WeightInfo::cancel_proposal(T::MaxProposals::get()))] - pub(crate) fn cancel_proposal( + pub fn cancel_proposal( origin: OriginFor, #[pallet::compact] prop_index: PropIndex, ) -> DispatchResult { diff --git a/frame/elections-phragmen/src/lib.rs b/frame/elections-phragmen/src/lib.rs index 556c57eea5a10..8a1680633ef7b 100644 --- a/frame/elections-phragmen/src/lib.rs +++ b/frame/elections-phragmen/src/lib.rs @@ -286,7 +286,7 @@ pub mod pallet { .max(T::WeightInfo::vote_less(votes.len() as u32)) .max(T::WeightInfo::vote_equal(votes.len() as u32)) )] - pub(crate) fn vote( + pub fn vote( origin: OriginFor, votes: Vec, #[pallet::compact] value: BalanceOf, @@ -349,7 +349,7 @@ pub mod pallet { /// /// The dispatch origin of this call must be signed and be a voter. #[pallet::weight(T::WeightInfo::remove_voter())] - pub(crate) fn remove_voter(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn remove_voter(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; ensure!(Self::is_voter(&who), Error::::MustBeVoter); Self::do_remove_voter(&who); @@ -372,7 +372,7 @@ pub mod pallet { /// The number of current candidates must be provided as witness data. /// # #[pallet::weight(T::WeightInfo::submit_candidacy(*candidate_count))] - pub(crate) fn submit_candidacy( + pub fn submit_candidacy( origin: OriginFor, #[pallet::compact] candidate_count: u32, ) -> DispatchResultWithPostInfo { @@ -415,7 +415,7 @@ pub mod pallet { Renouncing::Member => T::WeightInfo::renounce_candidacy_members(), Renouncing::RunnerUp => T::WeightInfo::renounce_candidacy_runners_up(), })] - pub(crate) fn renounce_candidacy( + pub fn renounce_candidacy( origin: OriginFor, renouncing: Renouncing, ) -> DispatchResultWithPostInfo { @@ -476,7 +476,7 @@ pub mod pallet { } else { T::BlockWeights::get().max_block })] - pub(crate) fn remove_member( + pub fn remove_member( origin: OriginFor, who: ::Source, has_replacement: bool, @@ -516,7 +516,7 @@ pub mod pallet { /// The total number of voters and those that are defunct must be provided as witness data. /// # #[pallet::weight(T::WeightInfo::clean_defunct_voters(*_num_voters, *_num_defunct))] - pub(crate) fn clean_defunct_voters( + pub fn clean_defunct_voters( origin: OriginFor, _num_voters: u32, _num_defunct: u32, diff --git a/frame/example/src/lib.rs b/frame/example/src/lib.rs index fd1bc292ac8aa..f5014b75640ba 100644 --- a/frame/example/src/lib.rs +++ b/frame/example/src/lib.rs @@ -488,7 +488,7 @@ pub mod pallet { #[pallet::weight( ::WeightInfo::accumulate_dummy((*increase_by).saturated_into()) )] - pub(super) fn accumulate_dummy( + pub fn accumulate_dummy( origin: OriginFor, increase_by: T::Balance ) -> DispatchResult { @@ -533,7 +533,7 @@ pub mod pallet { // The weight for this extrinsic we use our own weight object `WeightForSetDummy` to determine // its weight #[pallet::weight(WeightForSetDummy::(>::from(100u32)))] - pub(super) fn set_dummy( + pub fn set_dummy( origin: OriginFor, #[pallet::compact] new_value: T::Balance, ) -> DispatchResult { diff --git a/frame/grandpa/src/lib.rs b/frame/grandpa/src/lib.rs index 952e0d646135b..28546018a978f 100644 --- a/frame/grandpa/src/lib.rs +++ b/frame/grandpa/src/lib.rs @@ -214,7 +214,7 @@ pub mod pallet { /// if the block author is defined it will be defined as the equivocation /// reporter. #[pallet::weight(T::WeightInfo::report_equivocation(key_owner_proof.validator_count()))] - pub(super) fn report_equivocation_unsigned( + pub fn report_equivocation_unsigned( origin: OriginFor, equivocation_proof: EquivocationProof, key_owner_proof: T::KeyOwnerProof, diff --git a/frame/identity/src/lib.rs b/frame/identity/src/lib.rs index 91b3f3a50fc48..b71b069ccb74f 100644 --- a/frame/identity/src/lib.rs +++ b/frame/identity/src/lib.rs @@ -549,7 +549,7 @@ pub mod pallet { /// - One event. /// # #[pallet::weight(T::WeightInfo::add_registrar(T::MaxRegistrars::get()))] - pub(super) fn add_registrar(origin: OriginFor, account: T::AccountId) -> DispatchResultWithPostInfo { + pub fn add_registrar(origin: OriginFor, account: T::AccountId) -> DispatchResultWithPostInfo { T::RegistrarOrigin::ensure_origin(origin)?; let (i, registrar_count) = >::try_mutate( @@ -590,7 +590,7 @@ pub mod pallet { T::MaxRegistrars::get().into(), // R T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn set_identity(origin: OriginFor, info: IdentityInfo) -> DispatchResultWithPostInfo { + pub fn set_identity(origin: OriginFor, info: IdentityInfo) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; let extra_fields = info.additional.len() as u32; ensure!(extra_fields <= T::MaxAdditionalFields::get(), Error::::TooManyFields); @@ -656,7 +656,7 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::set_subs_old(T::MaxSubAccounts::get()) // P: Assume max sub accounts removed. .saturating_add(T::WeightInfo::set_subs_new(subs.len() as u32)) // S: Assume all subs are new. )] - pub(super) fn set_subs(origin: OriginFor, subs: Vec<(T::AccountId, Data)>) -> DispatchResultWithPostInfo { + pub fn set_subs(origin: OriginFor, subs: Vec<(T::AccountId, Data)>) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; ensure!(>::contains_key(&sender), Error::::NotFound); ensure!(subs.len() <= T::MaxSubAccounts::get() as usize, Error::::TooManySubAccounts); @@ -719,7 +719,7 @@ pub mod pallet { T::MaxSubAccounts::get().into(), // S T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn clear_identity(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn clear_identity(origin: OriginFor) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; let (subs_deposit, sub_ids) = >::take(&sender); @@ -768,7 +768,7 @@ pub mod pallet { T::MaxRegistrars::get().into(), // R T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn request_judgement(origin: OriginFor, + pub fn request_judgement(origin: OriginFor, #[pallet::compact] reg_index: RegistrarIndex, #[pallet::compact] max_fee: BalanceOf, ) -> DispatchResultWithPostInfo { @@ -824,7 +824,7 @@ pub mod pallet { T::MaxRegistrars::get().into(), // R T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn cancel_request(origin: OriginFor, reg_index: RegistrarIndex) -> DispatchResultWithPostInfo { + pub fn cancel_request(origin: OriginFor, reg_index: RegistrarIndex) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; let mut id = >::get(&sender).ok_or(Error::::NoIdentity)?; @@ -864,7 +864,7 @@ pub mod pallet { /// - Benchmark: 7.315 + R * 0.329 µs (min squares analysis) /// # #[pallet::weight(T::WeightInfo::set_fee(T::MaxRegistrars::get()))] // R - pub(super) fn set_fee(origin: OriginFor, + pub fn set_fee(origin: OriginFor, #[pallet::compact] index: RegistrarIndex, #[pallet::compact] fee: BalanceOf, ) -> DispatchResultWithPostInfo { @@ -894,7 +894,7 @@ pub mod pallet { /// - Benchmark: 8.823 + R * 0.32 µs (min squares analysis) /// # #[pallet::weight(T::WeightInfo::set_account_id(T::MaxRegistrars::get()))] // R - pub(super) fn set_account_id(origin: OriginFor, + pub fn set_account_id(origin: OriginFor, #[pallet::compact] index: RegistrarIndex, new: T::AccountId, ) -> DispatchResultWithPostInfo { @@ -924,7 +924,7 @@ pub mod pallet { /// - Benchmark: 7.464 + R * 0.325 µs (min squares analysis) /// # #[pallet::weight(T::WeightInfo::set_fields(T::MaxRegistrars::get()))] // R - pub(super) fn set_fields(origin: OriginFor, + pub fn set_fields(origin: OriginFor, #[pallet::compact] index: RegistrarIndex, fields: IdentityFields, ) -> DispatchResultWithPostInfo { @@ -965,7 +965,7 @@ pub mod pallet { T::MaxRegistrars::get().into(), // R T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn provide_judgement(origin: OriginFor, + pub fn provide_judgement(origin: OriginFor, #[pallet::compact] reg_index: RegistrarIndex, target: ::Source, judgement: Judgement>, @@ -1026,7 +1026,7 @@ pub mod pallet { T::MaxSubAccounts::get().into(), // S T::MaxAdditionalFields::get().into(), // X ))] - pub(super) fn kill_identity( + pub fn kill_identity( origin: OriginFor, target: ::Source ) -> DispatchResultWithPostInfo { T::ForceOrigin::ensure_origin(origin)?; @@ -1060,7 +1060,7 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ and the sender must have a registered /// sub identity of `sub`. #[pallet::weight(T::WeightInfo::add_sub(T::MaxSubAccounts::get()))] - pub(super) fn add_sub(origin: OriginFor, sub: ::Source, data: Data) -> DispatchResult { + pub fn add_sub(origin: OriginFor, sub: ::Source, data: Data) -> DispatchResult { let sender = ensure_signed(origin)?; let sub = T::Lookup::lookup(sub)?; ensure!(IdentityOf::::contains_key(&sender), Error::::NoIdentity); @@ -1088,7 +1088,7 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ and the sender must have a registered /// sub identity of `sub`. #[pallet::weight(T::WeightInfo::rename_sub(T::MaxSubAccounts::get()))] - pub(super) fn rename_sub( + pub fn rename_sub( origin: OriginFor, sub: ::Source, data: Data ) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -1107,7 +1107,7 @@ pub mod pallet { /// The dispatch origin for this call must be _Signed_ and the sender must have a registered /// sub identity of `sub`. #[pallet::weight(T::WeightInfo::remove_sub(T::MaxSubAccounts::get()))] - pub(super) fn remove_sub(origin: OriginFor, sub: ::Source) -> DispatchResult { + pub fn remove_sub(origin: OriginFor, sub: ::Source) -> DispatchResult { let sender = ensure_signed(origin)?; ensure!(IdentityOf::::contains_key(&sender), Error::::NoIdentity); let sub = T::Lookup::lookup(sub)?; @@ -1136,7 +1136,7 @@ pub mod pallet { /// NOTE: This should not normally be used, but is provided in the case that the non- /// controller of an account is maliciously registered as a sub-account. #[pallet::weight(T::WeightInfo::quit_sub(T::MaxSubAccounts::get()))] - pub(super) fn quit_sub(origin: OriginFor) -> DispatchResult { + pub fn quit_sub(origin: OriginFor) -> DispatchResult { let sender = ensure_signed(origin)?; let (sup, _) = SuperOf::::take(&sender).ok_or(Error::::NotSub)?; SubsOf::::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| { diff --git a/frame/indices/src/lib.rs b/frame/indices/src/lib.rs index 1470e3abe8661..778173dbc971f 100644 --- a/frame/indices/src/lib.rs +++ b/frame/indices/src/lib.rs @@ -90,7 +90,7 @@ pub mod pallet { /// - DB Weight: 1 Read/Write (Accounts) /// # #[pallet::weight(T::WeightInfo::claim())] - pub(crate) fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + pub fn claim(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| { @@ -123,7 +123,7 @@ pub mod pallet { /// - Writes: Indices Accounts, System Account (recipient) /// # #[pallet::weight(T::WeightInfo::transfer())] - pub(crate) fn transfer( + pub fn transfer( origin: OriginFor, new: T::AccountId, index: T::AccountIndex, @@ -162,7 +162,7 @@ pub mod pallet { /// - DB Weight: 1 Read/Write (Accounts) /// # #[pallet::weight(T::WeightInfo::free())] - pub(crate) fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + pub fn free(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { @@ -198,7 +198,7 @@ pub mod pallet { /// - Writes: Indices Accounts, System Account (original owner) /// # #[pallet::weight(T::WeightInfo::force_transfer())] - pub(crate) fn force_transfer( + pub fn force_transfer( origin: OriginFor, new: T::AccountId, index: T::AccountIndex, @@ -234,7 +234,7 @@ pub mod pallet { /// - DB Weight: 1 Read/Write (Accounts) /// # #[pallet::weight(T::WeightInfo::freeze())] - pub(crate) fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { + pub fn freeze(origin: OriginFor, index: T::AccountIndex) -> DispatchResult { let who = ensure_signed(origin)?; Accounts::::try_mutate(index, |maybe_value| -> DispatchResult { diff --git a/frame/lottery/src/lib.rs b/frame/lottery/src/lib.rs index 5d6940c93b3ea..53cadbf02b940 100644 --- a/frame/lottery/src/lib.rs +++ b/frame/lottery/src/lib.rs @@ -286,7 +286,7 @@ pub mod pallet { T::WeightInfo::buy_ticket() .saturating_add(call.get_dispatch_info().weight) )] - pub(crate) fn buy_ticket(origin: OriginFor, call: Box<::Call>) -> DispatchResult { + pub fn buy_ticket(origin: OriginFor, call: Box<::Call>) -> DispatchResult { let caller = ensure_signed(origin.clone())?; call.clone().dispatch(origin).map_err(|e| e.error)?; @@ -301,7 +301,7 @@ pub mod pallet { /// /// This extrinsic must be called by the Manager origin. #[pallet::weight(T::WeightInfo::set_calls(calls.len() as u32))] - pub(crate) fn set_calls(origin: OriginFor, calls: Vec<::Call>) -> DispatchResult { + pub fn set_calls(origin: OriginFor, calls: Vec<::Call>) -> DispatchResult { T::ManagerOrigin::ensure_origin(origin)?; ensure!(calls.len() <= T::MaxCalls::get() as usize, Error::::TooManyCalls); if calls.is_empty() { @@ -325,7 +325,7 @@ pub mod pallet { /// * `delay`: How long after the lottery end we should wait before picking a winner. /// * `repeat`: If the lottery should repeat when completed. #[pallet::weight(T::WeightInfo::start_lottery())] - pub(crate) fn start_lottery( + pub fn start_lottery( origin: OriginFor, price: BalanceOf, length: T::BlockNumber, @@ -363,7 +363,7 @@ pub mod pallet { /// /// This extrinsic must be called by the `ManagerOrigin`. #[pallet::weight(T::WeightInfo::stop_repeat())] - pub(crate) fn stop_repeat(origin: OriginFor) -> DispatchResult { + pub fn stop_repeat(origin: OriginFor) -> DispatchResult { T::ManagerOrigin::ensure_origin(origin)?; Lottery::::mutate(|mut lottery| { if let Some(config) = &mut lottery { diff --git a/frame/multisig/src/lib.rs b/frame/multisig/src/lib.rs index bbb41e7a9287a..bc7ce7029a95b 100644 --- a/frame/multisig/src/lib.rs +++ b/frame/multisig/src/lib.rs @@ -245,7 +245,7 @@ pub mod pallet{ dispatch_info.class, ) })] - pub(super) fn as_multi_threshold_1( + pub fn as_multi_threshold_1( origin: OriginFor, other_signatories: Vec, call: Box<::Call>, @@ -335,7 +335,7 @@ pub mod pallet{ .max(T::WeightInfo::as_multi_complete(s, z)) .saturating_add(*max_weight) })] - pub(super) fn as_multi( + pub fn as_multi( origin: OriginFor, threshold: u16, other_signatories: Vec, @@ -392,7 +392,7 @@ pub mod pallet{ .max(T::WeightInfo::approve_as_multi_complete(s)) .saturating_add(*max_weight) })] - pub(super) fn approve_as_multi( + pub fn approve_as_multi( origin: OriginFor, threshold: u16, other_signatories: Vec, @@ -431,7 +431,7 @@ pub mod pallet{ /// - Write: Multisig Storage, [Caller Account], Refund Account, Calls /// # #[pallet::weight(T::WeightInfo::cancel_as_multi(other_signatories.len() as u32))] - pub(super) fn cancel_as_multi( + pub fn cancel_as_multi( origin: OriginFor, threshold: u16, other_signatories: Vec, diff --git a/frame/nicks/src/lib.rs b/frame/nicks/src/lib.rs index a76d4506f93bc..1e0ef90e0a3ac 100644 --- a/frame/nicks/src/lib.rs +++ b/frame/nicks/src/lib.rs @@ -138,7 +138,7 @@ pub mod pallet { /// - One event. /// # #[pallet::weight(50_000_000)] - pub(super) fn set_name(origin: OriginFor, name: Vec) -> DispatchResult { + pub fn set_name(origin: OriginFor, name: Vec) -> DispatchResult { let sender = ensure_signed(origin)?; ensure!(name.len() >= T::MinLength::get() as usize, Error::::TooShort); @@ -169,7 +169,7 @@ pub mod pallet { /// - One event. /// # #[pallet::weight(70_000_000)] - pub(super) fn clear_name(origin: OriginFor) -> DispatchResult { + pub fn clear_name(origin: OriginFor) -> DispatchResult { let sender = ensure_signed(origin)?; let deposit = >::take(&sender).ok_or(Error::::Unnamed)?.1; @@ -195,7 +195,7 @@ pub mod pallet { /// - One event. /// # #[pallet::weight(70_000_000)] - pub(super) fn kill_name( + pub fn kill_name( origin: OriginFor, target: ::Source ) -> DispatchResult { @@ -225,7 +225,7 @@ pub mod pallet { /// - One event. /// # #[pallet::weight(70_000_000)] - pub(super) fn force_name( + pub fn force_name( origin: OriginFor, target: ::Source, name: Vec diff --git a/frame/proxy/src/lib.rs b/frame/proxy/src/lib.rs index f308dbd28955f..6e78df2c7326d 100644 --- a/frame/proxy/src/lib.rs +++ b/frame/proxy/src/lib.rs @@ -183,7 +183,7 @@ pub mod pallet { .saturating_add(T::DbWeight::get().reads_writes(1, 1)), di.class) })] - pub(super) fn proxy( + pub fn proxy( origin: OriginFor, real: T::AccountId, force_proxy_type: Option, @@ -212,7 +212,7 @@ pub mod pallet { /// Weight is a function of the number of proxies the user has (P). /// # #[pallet::weight(T::WeightInfo::add_proxy(T::MaxProxies::get().into()))] - pub(super) fn add_proxy( + pub fn add_proxy( origin: OriginFor, delegate: T::AccountId, proxy_type: T::ProxyType, @@ -234,7 +234,7 @@ pub mod pallet { /// Weight is a function of the number of proxies the user has (P). /// # #[pallet::weight(T::WeightInfo::remove_proxy(T::MaxProxies::get().into()))] - pub(super) fn remove_proxy( + pub fn remove_proxy( origin: OriginFor, delegate: T::AccountId, proxy_type: T::ProxyType, @@ -255,7 +255,7 @@ pub mod pallet { /// Weight is a function of the number of proxies the user has (P). /// # #[pallet::weight(T::WeightInfo::remove_proxies(T::MaxProxies::get().into()))] - pub(super) fn remove_proxies(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn remove_proxies(origin: OriginFor) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; let (_, old_deposit) = Proxies::::take(&who); T::Currency::unreserve(&who, old_deposit); @@ -287,7 +287,7 @@ pub mod pallet { /// # /// TODO: Might be over counting 1 read #[pallet::weight(T::WeightInfo::anonymous(T::MaxProxies::get().into()))] - pub(super) fn anonymous( + pub fn anonymous( origin: OriginFor, proxy_type: T::ProxyType, delay: T::BlockNumber, @@ -337,7 +337,7 @@ pub mod pallet { /// Weight is a function of the number of proxies the user has (P). /// # #[pallet::weight(T::WeightInfo::kill_anonymous(T::MaxProxies::get().into()))] - pub(super) fn kill_anonymous( + pub fn kill_anonymous( origin: OriginFor, spawner: T::AccountId, proxy_type: T::ProxyType, @@ -379,7 +379,7 @@ pub mod pallet { /// - P: the number of proxies the user has. /// # #[pallet::weight(T::WeightInfo::announce(T::MaxPending::get(), T::MaxProxies::get().into()))] - pub(super) fn announce( + pub fn announce( origin: OriginFor, real: T::AccountId, call_hash: CallHashOf @@ -430,7 +430,7 @@ pub mod pallet { #[pallet::weight( T::WeightInfo::remove_announcement(T::MaxPending::get(), T::MaxProxies::get().into()) )] - pub(super) fn remove_announcement( + pub fn remove_announcement( origin: OriginFor, real: T::AccountId, call_hash: CallHashOf @@ -460,7 +460,7 @@ pub mod pallet { #[pallet::weight( T::WeightInfo::reject_announcement(T::MaxPending::get(), T::MaxProxies::get().into()) )] - pub(super) fn reject_announcement( + pub fn reject_announcement( origin: OriginFor, delegate: T::AccountId, call_hash: CallHashOf @@ -496,7 +496,7 @@ pub mod pallet { .saturating_add(T::DbWeight::get().reads_writes(1, 1)), di.class) })] - pub(super) fn proxy_announced( + pub fn proxy_announced( origin: OriginFor, delegate: T::AccountId, real: T::AccountId, diff --git a/frame/recovery/src/lib.rs b/frame/recovery/src/lib.rs index 7802f26d1d1fb..6f5c7ebcb6e4a 100644 --- a/frame/recovery/src/lib.rs +++ b/frame/recovery/src/lib.rs @@ -362,7 +362,7 @@ pub mod pallet { dispatch_info.class, ) })] - pub(crate) fn as_recovered( + pub fn as_recovered( origin: OriginFor, account: T::AccountId, call: Box<::Call> @@ -389,7 +389,7 @@ pub mod pallet { /// - One event /// # #[pallet::weight(30_000_000)] - pub(crate) fn set_recovered( + pub fn set_recovered( origin: OriginFor, lost: T::AccountId, rescuer: T::AccountId, @@ -429,7 +429,7 @@ pub mod pallet { /// Total Complexity: O(F + X) /// # #[pallet::weight(100_000_000)] - pub(crate) fn create_recovery( + pub fn create_recovery( origin: OriginFor, friends: Vec, threshold: u16, @@ -491,7 +491,7 @@ pub mod pallet { /// Total Complexity: O(F + X) /// # #[pallet::weight(100_000_000)] - pub(crate) fn initiate_recovery(origin: OriginFor, account: T::AccountId) -> DispatchResult { + pub fn initiate_recovery(origin: OriginFor, account: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; // Check that the account is recoverable ensure!(>::contains_key(&account), Error::::NotRecoverable); @@ -538,7 +538,7 @@ pub mod pallet { /// Total Complexity: O(F + logF + V + logV) /// # #[pallet::weight(100_000_000)] - pub(crate) fn vouch_recovery( + pub fn vouch_recovery( origin: OriginFor, lost: T::AccountId, rescuer: T::AccountId @@ -582,7 +582,7 @@ pub mod pallet { /// Total Complexity: O(F + V) /// # #[pallet::weight(100_000_000)] - pub(crate) fn claim_recovery(origin: OriginFor, account: T::AccountId) -> DispatchResult { + pub fn claim_recovery(origin: OriginFor, account: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; // Get the recovery configuration for the lost account let recovery_config = Self::recovery_config(&account).ok_or(Error::::NotRecoverable)?; @@ -628,7 +628,7 @@ pub mod pallet { /// Total Complexity: O(V + X) /// # #[pallet::weight(30_000_000)] - pub(crate) fn close_recovery(origin: OriginFor, rescuer: T::AccountId) -> DispatchResult { + pub fn close_recovery(origin: OriginFor, rescuer: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; // Take the active recovery process started by the rescuer for this account. let active_recovery = >::take(&who, &rescuer).ok_or(Error::::NotStarted)?; @@ -662,7 +662,7 @@ pub mod pallet { /// Total Complexity: O(F + X) /// # #[pallet::weight(30_000_000)] - pub(crate) fn remove_recovery(origin: OriginFor) -> DispatchResult { + pub fn remove_recovery(origin: OriginFor) -> DispatchResult { let who = ensure_signed(origin)?; // Check there are no active recoveries let mut active_recoveries = >::iter_prefix_values(&who); @@ -688,7 +688,7 @@ pub mod pallet { /// - One storage mutation to check account is recovered by `who`. O(1) /// # #[pallet::weight(30_000_000)] - pub(crate) fn cancel_recovered(origin: OriginFor, account: T::AccountId) -> DispatchResult { + pub fn cancel_recovered(origin: OriginFor, account: T::AccountId) -> DispatchResult { let who = ensure_signed(origin)?; // Check `who` is allowed to make a call on behalf of `account` ensure!(Self::proxy(&who) == Some(account), Error::::NotAllowed); diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 006ab5a0f2d75..950bbde8bc499 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -346,7 +346,7 @@ pub mod pallet { /// - Will use base weight of 25 which should be good for up to 30 scheduled calls /// # #[pallet::weight(::WeightInfo::schedule(T::MaxScheduledPerBlock::get()))] - pub(crate) fn schedule( + pub fn schedule( origin: OriginFor, when: T::BlockNumber, maybe_periodic: Option>, @@ -376,7 +376,7 @@ pub mod pallet { /// - Will use base weight of 100 which should be good for up to 30 scheduled calls /// # #[pallet::weight(::WeightInfo::cancel(T::MaxScheduledPerBlock::get()))] - pub(crate) fn cancel(origin: OriginFor, when: T::BlockNumber, index: u32) -> DispatchResult { + pub fn cancel(origin: OriginFor, when: T::BlockNumber, index: u32) -> DispatchResult { T::ScheduleOrigin::ensure_origin(origin.clone())?; let origin = ::Origin::from(origin); Self::do_cancel(Some(origin.caller().clone()), (when, index))?; @@ -394,7 +394,7 @@ pub mod pallet { /// - Will use base weight of 35 which should be good for more than 30 scheduled calls /// # #[pallet::weight(::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))] - pub(crate) fn schedule_named( + pub fn schedule_named( origin: OriginFor, id: Vec, when: T::BlockNumber, @@ -426,7 +426,7 @@ pub mod pallet { /// - Will use base weight of 100 which should be good for up to 30 scheduled calls /// # #[pallet::weight(::WeightInfo::cancel_named(T::MaxScheduledPerBlock::get()))] - pub(crate) fn cancel_named(origin: OriginFor, id: Vec) -> DispatchResult { + pub fn cancel_named(origin: OriginFor, id: Vec) -> DispatchResult { T::ScheduleOrigin::ensure_origin(origin.clone())?; let origin = ::Origin::from(origin); Self::do_cancel_named(Some(origin.caller().clone()), id)?; @@ -439,7 +439,7 @@ pub mod pallet { /// Same as [`schedule`]. /// # #[pallet::weight(::WeightInfo::schedule(T::MaxScheduledPerBlock::get()))] - pub(crate) fn schedule_after( + pub fn schedule_after( origin: OriginFor, after: T::BlockNumber, maybe_periodic: Option>, @@ -464,7 +464,7 @@ pub mod pallet { /// Same as [`schedule_named`]. /// # #[pallet::weight(::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))] - pub(crate) fn schedule_named_after( + pub fn schedule_named_after( origin: OriginFor, id: Vec, after: T::BlockNumber, diff --git a/frame/sudo/src/lib.rs b/frame/sudo/src/lib.rs index 51cc1df050709..6f70ddda99f64 100644 --- a/frame/sudo/src/lib.rs +++ b/frame/sudo/src/lib.rs @@ -144,7 +144,7 @@ pub mod pallet { let dispatch_info = call.get_dispatch_info(); (dispatch_info.weight.saturating_add(10_000), dispatch_info.class) })] - pub(crate) fn sudo( + pub fn sudo( origin: OriginFor, call: Box<::Call>, ) -> DispatchResultWithPostInfo { @@ -169,7 +169,7 @@ pub mod pallet { /// - The weight of this call is defined by the caller. /// # #[pallet::weight((*_weight, call.get_dispatch_info().class))] - pub(crate) fn sudo_unchecked_weight( + pub fn sudo_unchecked_weight( origin: OriginFor, call: Box<::Call>, _weight: Weight, @@ -194,7 +194,7 @@ pub mod pallet { /// - One DB change. /// # #[pallet::weight(0)] - pub(crate) fn set_key( + pub fn set_key( origin: OriginFor, new: ::Source, ) -> DispatchResultWithPostInfo { @@ -230,7 +230,7 @@ pub mod pallet { dispatch_info.class, ) })] - pub(crate) fn sudo_as( + pub fn sudo_as( origin: OriginFor, who: ::Source, call: Box<::Call> diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 4e830c26691e8..1d4d7e461834c 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -2071,7 +2071,7 @@ pub mod pallet_prelude { /// impl, I: 'static> Pallet { /// /// Doc comment put in metadata /// #[pallet::weight(0)] -/// fn toto(origin: OriginFor, #[pallet::compact] _foo: u32) -> DispatchResultWithPostInfo { +/// pub fn toto(origin: OriginFor, #[pallet::compact] _foo: u32) -> DispatchResultWithPostInfo { /// let _ = origin; /// unimplemented!(); /// } diff --git a/frame/system/src/lib.rs b/frame/system/src/lib.rs index f0597ea2fe0f3..e3a110f2e7e2c 100644 --- a/frame/system/src/lib.rs +++ b/frame/system/src/lib.rs @@ -301,7 +301,7 @@ pub mod pallet { // TODO: This should only be available for testing, rather than in general usage, but // that's not possible at present (since it's within the pallet macro). #[pallet::weight(*_ratio * T::BlockWeights::get().max_block)] - pub(crate) fn fill_block(origin: OriginFor, _ratio: Perbill) -> DispatchResultWithPostInfo { + pub fn fill_block(origin: OriginFor, _ratio: Perbill) -> DispatchResultWithPostInfo { ensure_root(origin)?; Ok(().into()) } @@ -312,7 +312,7 @@ pub mod pallet { /// - `O(1)` /// # #[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))] - pub(crate) fn remark(origin: OriginFor, _remark: Vec) -> DispatchResultWithPostInfo { + pub fn remark(origin: OriginFor, _remark: Vec) -> DispatchResultWithPostInfo { ensure_signed(origin)?; Ok(().into()) } @@ -326,7 +326,7 @@ pub mod pallet { /// - 1 write to HEAP_PAGES /// # #[pallet::weight((T::SystemWeightInfo::set_heap_pages(), DispatchClass::Operational))] - pub(crate) fn set_heap_pages(origin: OriginFor, pages: u64) -> DispatchResultWithPostInfo { + pub fn set_heap_pages(origin: OriginFor, pages: u64) -> DispatchResultWithPostInfo { ensure_root(origin)?; storage::unhashed::put_raw(well_known_keys::HEAP_PAGES, &pages.encode()); Ok(().into()) @@ -414,7 +414,7 @@ pub mod pallet { T::SystemWeightInfo::set_storage(items.len() as u32), DispatchClass::Operational, ))] - pub(crate) fn set_storage(origin: OriginFor, items: Vec) -> DispatchResultWithPostInfo { + pub fn set_storage(origin: OriginFor, items: Vec) -> DispatchResultWithPostInfo { ensure_root(origin)?; for i in &items { storage::unhashed::put_raw(&i.0, &i.1); @@ -434,7 +434,7 @@ pub mod pallet { T::SystemWeightInfo::kill_storage(keys.len() as u32), DispatchClass::Operational, ))] - pub(crate) fn kill_storage(origin: OriginFor, keys: Vec) -> DispatchResultWithPostInfo { + pub fn kill_storage(origin: OriginFor, keys: Vec) -> DispatchResultWithPostInfo { ensure_root(origin)?; for key in &keys { storage::unhashed::kill(&key); @@ -457,7 +457,7 @@ pub mod pallet { T::SystemWeightInfo::kill_prefix(_subkeys.saturating_add(1)), DispatchClass::Operational, ))] - pub(crate) fn kill_prefix( + pub fn kill_prefix( origin: OriginFor, prefix: Key, _subkeys: u32, @@ -474,7 +474,7 @@ pub mod pallet { /// - 1 event. /// # #[pallet::weight(T::SystemWeightInfo::remark_with_event(remark.len() as u32))] - pub(crate) fn remark_with_event(origin: OriginFor, remark: Vec) -> DispatchResultWithPostInfo { + pub fn remark_with_event(origin: OriginFor, remark: Vec) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; let hash = T::Hashing::hash(&remark[..]); Self::deposit_event(Event::Remarked(who, hash)); diff --git a/frame/timestamp/src/lib.rs b/frame/timestamp/src/lib.rs index 3315fadb1c1cc..f7dd7378d8ab5 100644 --- a/frame/timestamp/src/lib.rs +++ b/frame/timestamp/src/lib.rs @@ -184,7 +184,7 @@ pub mod pallet { T::WeightInfo::set(), DispatchClass::Mandatory ))] - pub(super) fn set(origin: OriginFor, #[pallet::compact] now: T::Moment) -> DispatchResult { + pub fn set(origin: OriginFor, #[pallet::compact] now: T::Moment) -> DispatchResult { ensure_none(origin)?; assert!(!DidUpdate::::exists(), "Timestamp must be updated only once in the block"); let prev = Self::now(); diff --git a/frame/transaction-storage/src/lib.rs b/frame/transaction-storage/src/lib.rs index ef824a8399f57..97dfd76fe6773 100644 --- a/frame/transaction-storage/src/lib.rs +++ b/frame/transaction-storage/src/lib.rs @@ -174,7 +174,7 @@ pub mod pallet { /// Additionally contains a DB write. /// # #[pallet::weight(T::WeightInfo::store(data.len() as u32))] - pub(super) fn store( + pub fn store( origin: OriginFor, data: Vec, ) -> DispatchResult { @@ -220,7 +220,7 @@ pub mod pallet { /// - Constant. /// # #[pallet::weight(T::WeightInfo::renew())] - pub(super) fn renew( + pub fn renew( origin: OriginFor, block: T::BlockNumber, index: u32, @@ -261,7 +261,7 @@ pub mod pallet { /// Here we assume a maximum of 100 probed transactions. /// # #[pallet::weight((T::WeightInfo::check_proof_max(), DispatchClass::Mandatory))] - pub(super) fn check_proof( + pub fn check_proof( origin: OriginFor, proof: TransactionStorageProof, ) -> DispatchResultWithPostInfo { diff --git a/frame/uniques/src/lib.rs b/frame/uniques/src/lib.rs index f4a0228de4a89..28518843c96fc 100644 --- a/frame/uniques/src/lib.rs +++ b/frame/uniques/src/lib.rs @@ -297,7 +297,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::create())] - pub(super) fn create( + pub fn create( origin: OriginFor, #[pallet::compact] class: T::ClassId, admin: ::Source, @@ -346,7 +346,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_create())] - pub(super) fn force_create( + pub fn force_create( origin: OriginFor, #[pallet::compact] class: T::ClassId, owner: ::Source, @@ -396,7 +396,7 @@ pub mod pallet { witness.instance_metadatas, witness.attributes, ))] - pub(super) fn destroy( + pub fn destroy( origin: OriginFor, #[pallet::compact] class: T::ClassId, witness: DestroyWitness, @@ -441,7 +441,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::mint())] - pub(super) fn mint( + pub fn mint( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -470,7 +470,7 @@ pub mod pallet { /// Weight: `O(1)` /// Modes: `check_owner.is_some()`. #[pallet::weight(T::WeightInfo::burn())] - pub(super) fn burn( + pub fn burn( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -503,7 +503,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::transfer())] - pub(super) fn transfer( + pub fn transfer( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -539,7 +539,7 @@ pub mod pallet { /// /// Weight: `O(instances.len())` #[pallet::weight(T::WeightInfo::redeposit(instances.len() as u32))] - pub(super) fn redeposit( + pub fn redeposit( origin: OriginFor, #[pallet::compact] class: T::ClassId, instances: Vec, @@ -595,7 +595,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::freeze())] - pub(super) fn freeze( + pub fn freeze( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -625,7 +625,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::thaw())] - pub(super) fn thaw( + pub fn thaw( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -654,7 +654,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::freeze_class())] - pub(super) fn freeze_class( + pub fn freeze_class( origin: OriginFor, #[pallet::compact] class: T::ClassId ) -> DispatchResult { @@ -681,7 +681,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::thaw_class())] - pub(super) fn thaw_class( + pub fn thaw_class( origin: OriginFor, #[pallet::compact] class: T::ClassId ) -> DispatchResult { @@ -709,7 +709,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::transfer_ownership())] - pub(super) fn transfer_ownership( + pub fn transfer_ownership( origin: OriginFor, #[pallet::compact] class: T::ClassId, owner: ::Source, @@ -751,7 +751,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_team())] - pub(super) fn set_team( + pub fn set_team( origin: OriginFor, #[pallet::compact] class: T::ClassId, issuer: ::Source, @@ -788,7 +788,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::approve_transfer())] - pub(super) fn approve_transfer( + pub fn approve_transfer( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -835,7 +835,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::cancel_approval())] - pub(super) fn cancel_approval( + pub fn cancel_approval( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -882,7 +882,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::force_asset_status())] - pub(super) fn force_asset_status( + pub fn force_asset_status( origin: OriginFor, #[pallet::compact] class: T::ClassId, owner: ::Source, @@ -927,7 +927,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_attribute())] - pub(super) fn set_attribute( + pub fn set_attribute( origin: OriginFor, #[pallet::compact] class: T::ClassId, maybe_instance: Option, @@ -992,7 +992,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::clear_attribute())] - pub(super) fn clear_attribute( + pub fn clear_attribute( origin: OriginFor, #[pallet::compact] class: T::ClassId, maybe_instance: Option, @@ -1041,7 +1041,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_metadata())] - pub(super) fn set_metadata( + pub fn set_metadata( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -1107,7 +1107,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::clear_metadata())] - pub(super) fn clear_metadata( + pub fn clear_metadata( origin: OriginFor, #[pallet::compact] class: T::ClassId, #[pallet::compact] instance: T::InstanceId, @@ -1156,7 +1156,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::set_class_metadata())] - pub(super) fn set_class_metadata( + pub fn set_class_metadata( origin: OriginFor, #[pallet::compact] class: T::ClassId, data: BoundedVec, @@ -1216,7 +1216,7 @@ pub mod pallet { /// /// Weight: `O(1)` #[pallet::weight(T::WeightInfo::clear_class_metadata())] - pub(super) fn clear_class_metadata( + pub fn clear_class_metadata( origin: OriginFor, #[pallet::compact] class: T::ClassId, ) -> DispatchResult { From 81a51b577b166cd414c69514421d38531ab82b1b Mon Sep 17 00:00:00 2001 From: thiolliere Date: Fri, 11 Jun 2021 17:20:28 +0200 Subject: [PATCH 2/9] Impl --- frame/authorship/src/lib.rs | 2 +- .../election-provider-multi-phase/src/lib.rs | 2 +- frame/grandpa/src/lib.rs | 4 +-- .../procedural/src/pallet/parse/call.rs | 12 +++++++ .../pallet_ui/call_argument_invalid_bound.rs | 2 +- .../call_argument_invalid_bound.stderr | 18 +++++----- .../call_argument_invalid_bound_2.rs | 2 +- .../call_argument_invalid_bound_2.stderr | 34 +++++++++---------- .../call_argument_invalid_bound_3.rs | 2 +- .../call_argument_invalid_bound_3.stderr | 18 +++++----- .../pallet_ui/call_invalid_origin_type.rs | 2 +- .../pallet_ui/call_invalid_origin_type.stderr | 12 +++---- .../tests/pallet_ui/call_invalid_return.rs | 2 +- .../pallet_ui/call_invalid_return.stderr | 6 ++-- .../test/tests/pallet_ui/call_invalid_vis.rs | 27 +++++++++++++++ .../tests/pallet_ui/call_invalid_vis.stderr | 5 +++ .../tests/pallet_ui/call_invalid_vis_2.rs | 27 +++++++++++++++ .../tests/pallet_ui/call_invalid_vis_2.stderr | 5 +++ .../tests/pallet_ui/call_missing_weight.rs | 2 +- .../pallet_ui/call_missing_weight.stderr | 6 ++-- .../test/tests/pallet_ui/call_no_origin.rs | 2 +- .../tests/pallet_ui/call_no_origin.stderr | 6 ++-- .../test/tests/pallet_ui/call_no_return.rs | 2 +- .../tests/pallet_ui/call_no_return.stderr | 6 ++-- 24 files changed, 141 insertions(+), 65 deletions(-) create mode 100644 frame/support/test/tests/pallet_ui/call_invalid_vis.rs create mode 100644 frame/support/test/tests/pallet_ui/call_invalid_vis.stderr create mode 100644 frame/support/test/tests/pallet_ui/call_invalid_vis_2.rs create mode 100644 frame/support/test/tests/pallet_ui/call_invalid_vis_2.stderr diff --git a/frame/authorship/src/lib.rs b/frame/authorship/src/lib.rs index b00f412808a1a..9b46a3fe11990 100644 --- a/frame/authorship/src/lib.rs +++ b/frame/authorship/src/lib.rs @@ -226,7 +226,7 @@ pub mod pallet { impl Pallet { /// Provide a set of uncles. #[pallet::weight((0, DispatchClass::Mandatory))] - fn set_uncles(origin: OriginFor, new_uncles: Vec) -> DispatchResult { + pub fn set_uncles(origin: OriginFor, new_uncles: Vec) -> DispatchResult { ensure_none(origin)?; ensure!(new_uncles.len() <= MAX_UNCLES, Error::::TooManyUncles); diff --git a/frame/election-provider-multi-phase/src/lib.rs b/frame/election-provider-multi-phase/src/lib.rs index a4ca89a417e0f..0254525ce819d 100644 --- a/frame/election-provider-multi-phase/src/lib.rs +++ b/frame/election-provider-multi-phase/src/lib.rs @@ -786,7 +786,7 @@ pub mod pallet { /// /// This check can be turned off by setting the value to `None`. #[pallet::weight(T::DbWeight::get().writes(1))] - fn set_minimum_untrusted_score( + pub fn set_minimum_untrusted_score( origin: OriginFor, maybe_next_score: Option, ) -> DispatchResult { diff --git a/frame/grandpa/src/lib.rs b/frame/grandpa/src/lib.rs index 28546018a978f..2d10e3c96b14d 100644 --- a/frame/grandpa/src/lib.rs +++ b/frame/grandpa/src/lib.rs @@ -190,7 +190,7 @@ pub mod pallet { /// against the extracted offender. If both are valid, the offence /// will be reported. #[pallet::weight(T::WeightInfo::report_equivocation(key_owner_proof.validator_count()))] - fn report_equivocation( + pub fn report_equivocation( origin: OriginFor, equivocation_proof: EquivocationProof, key_owner_proof: T::KeyOwnerProof, @@ -236,7 +236,7 @@ pub mod pallet { /// will start the new authority set using the given finalized block as base. /// Only callable by root. #[pallet::weight(T::WeightInfo::note_stalled())] - fn note_stalled( + pub fn note_stalled( origin: OriginFor, delay: T::BlockNumber, best_finalized_block_number: T::BlockNumber, diff --git a/frame/support/procedural/src/pallet/parse/call.rs b/frame/support/procedural/src/pallet/parse/call.rs index c2e6dce22539f..299b86cf6f84e 100644 --- a/frame/support/procedural/src/pallet/parse/call.rs +++ b/frame/support/procedural/src/pallet/parse/call.rs @@ -149,6 +149,18 @@ impl CallDef { let mut methods = vec![]; for impl_item in &mut item.items { if let syn::ImplItem::Method(method) = impl_item { + if !matches!(method.vis, syn::Visibility::Public(_)) { + let msg = "Invalid pallet::call, dispatchable function must be public: \ + `pub fn`"; + + let span = match method.vis { + syn::Visibility::Inherited => method.sig.span(), + _ => method.vis.span(), + }; + + return Err(syn::Error::new(span, msg)); + } + match method.sig.inputs.first() { None => { let msg = "Invalid pallet::call, must have at least origin arg"; diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs index 69d35344d5761..0f58187f73ebe 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.rs @@ -17,7 +17,7 @@ mod pallet { #[pallet::call] impl Pallet { #[pallet::weight(0)] - fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { Ok(().into()) } } diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr index 1eaf71be17104..ead05261b1938 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr @@ -1,8 +1,8 @@ error[E0369]: binary operation `==` cannot be applied to type `&::Bar` - --> $DIR/call_argument_invalid_bound.rs:20:37 + --> $DIR/call_argument_invalid_bound.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ | help: consider further restricting this bound | @@ -10,18 +10,18 @@ help: consider further restricting this bound | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `::Bar: Clone` is not satisfied - --> $DIR/call_argument_invalid_bound.rs:20:37 + --> $DIR/call_argument_invalid_bound.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ the trait `Clone` is not implemented for `::Bar` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ the trait `Clone` is not implemented for `::Bar` | = note: required by `clone` error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` - --> $DIR/call_argument_invalid_bound.rs:20:37 + --> $DIR/call_argument_invalid_bound.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `::Bar` = note: required because of the requirements on the impl of `std::fmt::Debug` for `&::Bar` diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs index 581c72a4240a0..da87046822eb7 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.rs @@ -17,7 +17,7 @@ mod pallet { #[pallet::call] impl Pallet { #[pallet::weight(0)] - fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { Ok(().into()) } } diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr index 1d0e96be9edb9..d6d033bc7bbbb 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr @@ -1,10 +1,10 @@ error[E0277]: the trait bound `::Bar: WrapperTypeDecode` is not satisfied - --> $DIR/call_argument_invalid_bound_2.rs:20:37 + --> $DIR/call_argument_invalid_bound_2.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ the trait `WrapperTypeDecode` is not implemented for `::Bar` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ the trait `WrapperTypeDecode` is not implemented for `::Bar` | - ::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18 + ::: /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18 | 277 | fn decode(input: &mut I) -> Result; | ----- required by this bound in `pallet::_::_parity_scale_codec::Decode::decode` @@ -12,12 +12,12 @@ error[E0277]: the trait bound `::Bar: WrapperTypeDecode` is = note: required because of the requirements on the impl of `Decode` for `::Bar` error[E0277]: the trait bound `::Bar: WrapperTypeEncode` is not satisfied - --> $DIR/call_argument_invalid_bound_2.rs:20:37 + --> $DIR/call_argument_invalid_bound_2.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ the trait `WrapperTypeEncode` is not implemented for `::Bar` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ the trait `WrapperTypeEncode` is not implemented for `::Bar` | - ::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21 + ::: /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21 | 216 | fn encode_to(&self, dest: &mut T) { | ------ required by this bound in `encode_to` @@ -25,10 +25,10 @@ error[E0277]: the trait bound `::Bar: WrapperTypeEncode` is = note: required because of the requirements on the impl of `pallet::_::_parity_scale_codec::Encode` for `::Bar` error[E0369]: binary operation `==` cannot be applied to type `&::Bar` - --> $DIR/call_argument_invalid_bound_2.rs:20:37 + --> $DIR/call_argument_invalid_bound_2.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ | help: consider further restricting this bound | @@ -36,18 +36,18 @@ help: consider further restricting this bound | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `::Bar: Clone` is not satisfied - --> $DIR/call_argument_invalid_bound_2.rs:20:37 + --> $DIR/call_argument_invalid_bound_2.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ the trait `Clone` is not implemented for `::Bar` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ the trait `Clone` is not implemented for `::Bar` | = note: required by `clone` error[E0277]: `::Bar` doesn't implement `std::fmt::Debug` - --> $DIR/call_argument_invalid_bound_2.rs:20:37 + --> $DIR/call_argument_invalid_bound_2.rs:20:41 | -20 | fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { - | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` +20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { + | ^ `::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | = help: the trait `std::fmt::Debug` is not implemented for `::Bar` = note: required because of the requirements on the impl of `std::fmt::Debug` for `&::Bar` diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs index 97f362551037d..4a6a781ff44a7 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.rs @@ -19,7 +19,7 @@ mod pallet { #[pallet::call] impl Pallet { #[pallet::weight(0)] - fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { + pub fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { Ok(().into()) } } diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr index 89cee573a2757..73c3069719ea2 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr @@ -1,24 +1,24 @@ error[E0369]: binary operation `==` cannot be applied to type `&Bar` - --> $DIR/call_argument_invalid_bound_3.rs:22:37 + --> $DIR/call_argument_invalid_bound_3.rs:22:41 | -22 | fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { - | ^^^ +22 | pub fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { + | ^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `&Bar` error[E0277]: the trait bound `Bar: Clone` is not satisfied - --> $DIR/call_argument_invalid_bound_3.rs:22:37 + --> $DIR/call_argument_invalid_bound_3.rs:22:41 | -22 | fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { - | ^^^ the trait `Clone` is not implemented for `Bar` +22 | pub fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { + | ^^^ the trait `Clone` is not implemented for `Bar` | = note: required by `clone` error[E0277]: `Bar` doesn't implement `std::fmt::Debug` - --> $DIR/call_argument_invalid_bound_3.rs:22:37 + --> $DIR/call_argument_invalid_bound_3.rs:22:41 | -22 | fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { - | ^^^ `Bar` cannot be formatted using `{:?}` +22 | pub fn foo(origin: OriginFor, bar: Bar) -> DispatchResultWithPostInfo { + | ^^^ `Bar` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Bar` = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug` diff --git a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs index edf953b5976c0..2502506fa6aa4 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs +++ b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.rs @@ -14,7 +14,7 @@ mod pallet { #[pallet::call] impl Pallet { - fn foo(origin: u8) {} + pub fn foo(origin: u8) {} } } diff --git a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.stderr b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.stderr index 855c59fd8d57d..f17cd9016a6e4 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_origin_type.stderr +++ b/frame/support/test/tests/pallet_ui/call_invalid_origin_type.stderr @@ -1,11 +1,11 @@ error: Invalid type: expected `OriginFor` - --> $DIR/call_invalid_origin_type.rs:17:18 + --> $DIR/call_invalid_origin_type.rs:17:22 | -17 | fn foo(origin: u8) {} - | ^^ +17 | pub fn foo(origin: u8) {} + | ^^ error: expected `OriginFor` - --> $DIR/call_invalid_origin_type.rs:17:18 + --> $DIR/call_invalid_origin_type.rs:17:22 | -17 | fn foo(origin: u8) {} - | ^^ +17 | pub fn foo(origin: u8) {} + | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_invalid_return.rs b/frame/support/test/tests/pallet_ui/call_invalid_return.rs index 477e7f3219de3..1ccdff5d07374 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_return.rs +++ b/frame/support/test/tests/pallet_ui/call_invalid_return.rs @@ -14,7 +14,7 @@ mod pallet { #[pallet::call] impl Pallet { - fn foo(origin: OriginFor) -> ::DispatchResult { todo!() } + pub fn foo(origin: OriginFor) -> ::DispatchResult { todo!() } } } diff --git a/frame/support/test/tests/pallet_ui/call_invalid_return.stderr b/frame/support/test/tests/pallet_ui/call_invalid_return.stderr index c79da3bbf78c3..6a851ed3fc283 100644 --- a/frame/support/test/tests/pallet_ui/call_invalid_return.stderr +++ b/frame/support/test/tests/pallet_ui/call_invalid_return.stderr @@ -1,5 +1,5 @@ error: expected `DispatchResultWithPostInfo` or `DispatchResult` - --> $DIR/call_invalid_return.rs:17:35 + --> $DIR/call_invalid_return.rs:17:39 | -17 | fn foo(origin: OriginFor) -> ::DispatchResult { todo!() } - | ^^ +17 | pub fn foo(origin: OriginFor) -> ::DispatchResult { todo!() } + | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_invalid_vis.rs b/frame/support/test/tests/pallet_ui/call_invalid_vis.rs new file mode 100644 index 0000000000000..fe1c5aee453d4 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_invalid_vis.rs @@ -0,0 +1,27 @@ +#[frame_support::pallet] +mod pallet { + use frame_support::pallet_prelude::{Hooks, DispatchResultWithPostInfo}; + use frame_system::pallet_prelude::{BlockNumberFor, OriginFor}; + + #[pallet::config] + pub trait Config: frame_system::Config { + type Bar: codec::Codec; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + fn foo(origin: OriginFor) -> DispatchResultWithPostInfo { + Ok(().into()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_invalid_vis.stderr b/frame/support/test/tests/pallet_ui/call_invalid_vis.stderr new file mode 100644 index 0000000000000..321828a1ae28e --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_invalid_vis.stderr @@ -0,0 +1,5 @@ +error: Invalid pallet::call, dispatchable function must be public: `pub fn` + --> $DIR/call_invalid_vis.rs:20:3 + | +20 | fn foo(origin: OriginFor) -> DispatchResultWithPostInfo { + | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_invalid_vis_2.rs b/frame/support/test/tests/pallet_ui/call_invalid_vis_2.rs new file mode 100644 index 0000000000000..fb25e9876dc8d --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_invalid_vis_2.rs @@ -0,0 +1,27 @@ +#[frame_support::pallet] +mod pallet { + use frame_support::pallet_prelude::{Hooks, DispatchResultWithPostInfo}; + use frame_system::pallet_prelude::{BlockNumberFor, OriginFor}; + + #[pallet::config] + pub trait Config: frame_system::Config { + type Bar: codec::Codec; + } + + #[pallet::pallet] + pub struct Pallet(core::marker::PhantomData); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet { + #[pallet::weight(0)] + pub(crate) fn foo(origin: OriginFor) -> DispatchResultWithPostInfo { + Ok(().into()) + } + } +} + +fn main() { +} diff --git a/frame/support/test/tests/pallet_ui/call_invalid_vis_2.stderr b/frame/support/test/tests/pallet_ui/call_invalid_vis_2.stderr new file mode 100644 index 0000000000000..7d3113474af73 --- /dev/null +++ b/frame/support/test/tests/pallet_ui/call_invalid_vis_2.stderr @@ -0,0 +1,5 @@ +error: Invalid pallet::call, dispatchable function must be public: `pub fn` + --> $DIR/call_invalid_vis_2.rs:20:3 + | +20 | pub(crate) fn foo(origin: OriginFor) -> DispatchResultWithPostInfo { + | ^^^ diff --git a/frame/support/test/tests/pallet_ui/call_missing_weight.rs b/frame/support/test/tests/pallet_ui/call_missing_weight.rs index 2ce607c53ac3a..4cdb85502b57f 100644 --- a/frame/support/test/tests/pallet_ui/call_missing_weight.rs +++ b/frame/support/test/tests/pallet_ui/call_missing_weight.rs @@ -14,7 +14,7 @@ mod pallet { #[pallet::call] impl Pallet { - fn foo(origin: OriginFor) -> DispatchResultWithPostInfo {} + pub fn foo(origin: OriginFor) -> DispatchResultWithPostInfo {} } } diff --git a/frame/support/test/tests/pallet_ui/call_missing_weight.stderr b/frame/support/test/tests/pallet_ui/call_missing_weight.stderr index 37386d7771a7a..ec45d478870c1 100644 --- a/frame/support/test/tests/pallet_ui/call_missing_weight.stderr +++ b/frame/support/test/tests/pallet_ui/call_missing_weight.stderr @@ -1,5 +1,5 @@ error: Invalid pallet::call, requires weight attribute i.e. `#[pallet::weight($expr)]` - --> $DIR/call_missing_weight.rs:17:3 + --> $DIR/call_missing_weight.rs:17:7 | -17 | fn foo(origin: OriginFor) -> DispatchResultWithPostInfo {} - | ^^ +17 | pub fn foo(origin: OriginFor) -> DispatchResultWithPostInfo {} + | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_no_origin.rs b/frame/support/test/tests/pallet_ui/call_no_origin.rs index 83d10b6b08b4f..231c75f43f4ad 100644 --- a/frame/support/test/tests/pallet_ui/call_no_origin.rs +++ b/frame/support/test/tests/pallet_ui/call_no_origin.rs @@ -14,7 +14,7 @@ mod pallet { #[pallet::call] impl Pallet { - fn foo() {} + pub fn foo() {} } } diff --git a/frame/support/test/tests/pallet_ui/call_no_origin.stderr b/frame/support/test/tests/pallet_ui/call_no_origin.stderr index 42afd02c42639..97574ea1b644c 100644 --- a/frame/support/test/tests/pallet_ui/call_no_origin.stderr +++ b/frame/support/test/tests/pallet_ui/call_no_origin.stderr @@ -1,5 +1,5 @@ error: Invalid pallet::call, must have at least origin arg - --> $DIR/call_no_origin.rs:17:3 + --> $DIR/call_no_origin.rs:17:7 | -17 | fn foo() {} - | ^^ +17 | pub fn foo() {} + | ^^ diff --git a/frame/support/test/tests/pallet_ui/call_no_return.rs b/frame/support/test/tests/pallet_ui/call_no_return.rs index a18c30f6d6d90..68a883c52c072 100644 --- a/frame/support/test/tests/pallet_ui/call_no_return.rs +++ b/frame/support/test/tests/pallet_ui/call_no_return.rs @@ -14,7 +14,7 @@ mod pallet { #[pallet::call] impl Pallet { - fn foo(origin: OriginFor) {} + pub fn foo(origin: OriginFor) {} } } diff --git a/frame/support/test/tests/pallet_ui/call_no_return.stderr b/frame/support/test/tests/pallet_ui/call_no_return.stderr index b16d401355c12..18ebbaff76d9d 100644 --- a/frame/support/test/tests/pallet_ui/call_no_return.stderr +++ b/frame/support/test/tests/pallet_ui/call_no_return.stderr @@ -1,5 +1,5 @@ error: Invalid pallet::call, require return type DispatchResultWithPostInfo - --> $DIR/call_no_return.rs:17:3 + --> $DIR/call_no_return.rs:17:7 | -17 | fn foo(origin: OriginFor) {} - | ^^ +17 | pub fn foo(origin: OriginFor) {} + | ^^ From c890aa8ddda81221b0ff88c5adacda5726abca7e Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 11 Jun 2021 17:58:02 +0100 Subject: [PATCH 3/9] fix --- frame/sudo/src/mock.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/sudo/src/mock.rs b/frame/sudo/src/mock.rs index 6b296c62fe6c7..92683f98fb64f 100644 --- a/frame/sudo/src/mock.rs +++ b/frame/sudo/src/mock.rs @@ -45,7 +45,7 @@ pub mod logger { #[pallet::call] impl Pallet { #[pallet::weight(*weight)] - pub(crate) fn privileged_i32_log( + pub fn privileged_i32_log( origin: OriginFor, i: i32, weight: Weight @@ -58,7 +58,7 @@ pub mod logger { } #[pallet::weight(*weight)] - pub(crate) fn non_privileged_log( + pub fn non_privileged_log( origin: OriginFor, i: i32, weight: Weight From 9ffdb5fae87676b11c6ee0ae5ff362358621e8d3 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 11 Jun 2021 18:19:44 +0100 Subject: [PATCH 4/9] more fix --- frame/scheduler/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 950bbde8bc499..a3520f3b21f7e 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -867,7 +867,7 @@ mod tests { #[pallet::call] impl Pallet where ::Origin: OriginTrait { #[pallet::weight(*weight)] - fn log(origin: OriginFor, i: u32, weight: Weight) -> DispatchResult { + pub fn log(origin: OriginFor, i: u32, weight: Weight) -> DispatchResult { Self::deposit_event(Event::Logged(i, weight)); LOG.with(|log| { log.borrow_mut().push((origin.caller().clone(), i)); @@ -876,7 +876,7 @@ mod tests { } #[pallet::weight(*weight)] - fn log_without_filter(origin: OriginFor, i: u32, weight: Weight) -> DispatchResult { + pub fn log_without_filter(origin: OriginFor, i: u32, weight: Weight) -> DispatchResult { Self::deposit_event(Event::Logged(i, weight)); LOG.with(|log| { log.borrow_mut().push((origin.caller().clone(), i)); From 8d3d83a0e3893bbb5f7a218e17d6ebcda0ba7585 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 11 Jun 2021 18:34:20 +0100 Subject: [PATCH 5/9] more pub --- frame/support/src/lib.rs | 4 ++-- frame/support/test/tests/pallet.rs | 4 ++-- frame/support/test/tests/pallet_compatibility.rs | 2 +- frame/support/test/tests/pallet_compatibility_instance.rs | 2 +- frame/support/test/tests/pallet_instance.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frame/support/src/lib.rs b/frame/support/src/lib.rs index 1d4d7e461834c..43891c158200e 100644 --- a/frame/support/src/lib.rs +++ b/frame/support/src/lib.rs @@ -1438,7 +1438,7 @@ pub mod pallet_prelude { /// impl Pallet { /// /// $some_doc /// #[pallet::weight($ExpressionResultingInWeight)] -/// $vis fn $fn_name( +/// pub fn $fn_name( /// origin: OriginFor, /// $some_arg: $some_type, /// // or with compact attribute: #[pallet::compact] $some_arg: $some_type, @@ -1897,7 +1897,7 @@ pub mod pallet_prelude { /// impl Pallet { /// /// Doc comment put in metadata /// #[pallet::weight(0)] // Defines weight for call (function parameters are in scope) -/// fn toto( +/// pub fn toto( /// origin: OriginFor, /// #[pallet::compact] _foo: u32, /// ) -> DispatchResultWithPostInfo { diff --git a/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index f7e04e9226874..b467bfa91f9f5 100644 --- a/frame/support/test/tests/pallet.rs +++ b/frame/support/test/tests/pallet.rs @@ -133,11 +133,11 @@ pub mod pallet { #[pallet::call] impl Pallet - where T::AccountId: From + From + SomeAssociation1 + where T::AccountId: From + From + SomeAssociation1 { /// Doc comment put in metadata #[pallet::weight(Weight::from(*_foo))] - fn foo( + pub fn foo( origin: OriginFor, #[pallet::compact] _foo: u32, _bar: u32, diff --git a/frame/support/test/tests/pallet_compatibility.rs b/frame/support/test/tests/pallet_compatibility.rs index 130014f1e9eb1..db01d15e5daa9 100644 --- a/frame/support/test/tests/pallet_compatibility.rs +++ b/frame/support/test/tests/pallet_compatibility.rs @@ -123,7 +123,7 @@ pub mod pallet { #[pallet::call] impl Pallet { #[pallet::weight(>::into(new_value.clone()))] - fn set_dummy( + pub fn set_dummy( origin: OriginFor, #[pallet::compact] new_value: T::Balance ) -> DispatchResultWithPostInfo { diff --git a/frame/support/test/tests/pallet_compatibility_instance.rs b/frame/support/test/tests/pallet_compatibility_instance.rs index d80d9ba3dff7d..63e71c8bf255c 100644 --- a/frame/support/test/tests/pallet_compatibility_instance.rs +++ b/frame/support/test/tests/pallet_compatibility_instance.rs @@ -113,7 +113,7 @@ pub mod pallet { #[pallet::call] impl, I: 'static> Pallet { #[pallet::weight(>::into(new_value.clone()))] - fn set_dummy( + pub fn set_dummy( origin: OriginFor, #[pallet::compact] new_value: T::Balance ) -> DispatchResultWithPostInfo { diff --git a/frame/support/test/tests/pallet_instance.rs b/frame/support/test/tests/pallet_instance.rs index 48ff166c5b226..f0b72da2c7fbf 100644 --- a/frame/support/test/tests/pallet_instance.rs +++ b/frame/support/test/tests/pallet_instance.rs @@ -81,7 +81,7 @@ pub mod pallet { impl, I: 'static> Pallet { /// Doc comment put in metadata #[pallet::weight(Weight::from(*_foo))] - fn foo(origin: OriginFor, #[pallet::compact] _foo: u32) -> DispatchResultWithPostInfo { + pub fn foo(origin: OriginFor, #[pallet::compact] _foo: u32) -> DispatchResultWithPostInfo { let _ = origin; Self::deposit_event(Event::Something(3)); Ok(().into()) @@ -90,7 +90,7 @@ pub mod pallet { /// Doc comment put in metadata #[pallet::weight(1)] #[frame_support::transactional] - fn foo_transactional( + pub fn foo_transactional( origin: OriginFor, #[pallet::compact] _foo: u32 ) -> DispatchResultWithPostInfo { From ba1633fc55ed767f07ceaea57945222cd86502b5 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 12 Jun 2021 00:40:29 +0100 Subject: [PATCH 6/9] few more --- frame/support/test/tests/pallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/support/test/tests/pallet.rs b/frame/support/test/tests/pallet.rs index b467bfa91f9f5..a79c25ae8f3e3 100644 --- a/frame/support/test/tests/pallet.rs +++ b/frame/support/test/tests/pallet.rs @@ -152,7 +152,7 @@ pub mod pallet { /// Doc comment put in metadata #[pallet::weight(1)] #[frame_support::transactional] - fn foo_transactional( + pub fn foo_transactional( _origin: OriginFor, #[pallet::compact] foo: u32, ) -> DispatchResultWithPostInfo { @@ -166,7 +166,7 @@ pub mod pallet { // Test for DispatchResult return type #[pallet::weight(1)] - fn foo_no_post_info( + pub fn foo_no_post_info( _origin: OriginFor, ) -> DispatchResult { Ok(()) From 2fc6de5fef92ba7193460bfa6cbc20d3d88bf85f Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 12 Jun 2021 01:37:30 +0100 Subject: [PATCH 7/9] merge fix --- frame/staking/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/staking/src/lib.rs b/frame/staking/src/lib.rs index 49660350ba916..0a22f31e6c3f5 100644 --- a/frame/staking/src/lib.rs +++ b/frame/staking/src/lib.rs @@ -1959,7 +1959,7 @@ pub mod pallet { /// Paying even a dead controller is cheaper weight-wise. We don't do any refunds here. /// # #[pallet::weight(T::WeightInfo::payout_stakers_alive_staked(T::MaxNominatorRewardedPerValidator::get()))] - pub(super) fn payout_stakers( + pub fn payout_stakers( origin: OriginFor, validator_stash: T::AccountId, era: EraIndex, From 920bca17885f0da6726d38c4b131c4e1a53e3e72 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 12 Jun 2021 02:14:17 +0100 Subject: [PATCH 8/9] fix ui test --- .../test/tests/pallet_ui/call_argument_invalid_bound_2.stderr | 4 ++-- .../test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr index d6d033bc7bbbb..2a3bbe1abf4cd 100644 --- a/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr +++ b/frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `::Bar: WrapperTypeDecode` is 20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { | ^ the trait `WrapperTypeDecode` is not implemented for `::Bar` | - ::: /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18 + ::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18 | 277 | fn decode(input: &mut I) -> Result; | ----- required by this bound in `pallet::_::_parity_scale_codec::Decode::decode` @@ -17,7 +17,7 @@ error[E0277]: the trait bound `::Bar: WrapperTypeEncode` is 20 | pub fn foo(origin: OriginFor, bar: T::Bar) -> DispatchResultWithPostInfo { | ^ the trait `WrapperTypeEncode` is not implemented for `::Bar` | - ::: /home/thiolliere/.cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21 + ::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21 | 216 | fn encode_to(&self, dest: &mut T) { | ------ required by this bound in `encode_to` diff --git a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 545520124bfee..6c92423c6a7fe 100644 --- a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -4,6 +4,6 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied 10 | #[pallet::generate_storage_info] | ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `NMapKey` - = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` + = note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key` + = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, Key, u32>` = note: required by `storage_info` From 86a54aa197aa592d72435ff5f52aa6e222ba0229 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Sat, 12 Jun 2021 02:54:40 +0100 Subject: [PATCH 9/9] fix ui test --- .../test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr index 6c92423c6a7fe..545520124bfee 100644 --- a/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr +++ b/frame/support/test/tests/pallet_ui/storage_info_unsatisfied_nmap.stderr @@ -4,6 +4,6 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied 10 | #[pallet::generate_storage_info] | ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar` | - = note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key` - = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, Key, u32>` + = note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `NMapKey` + = note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo, NMapKey, u32>` = note: required by `storage_info`