Unverified Commit 970e22b2 authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

Manadatory Weight (#931)

* upsub

* Revert branch change

* Fix some

* Fix build
parent 035d1a58
Pipeline #84928 passed with stages
in 20 minutes and 52 seconds
...@@ -131,6 +131,7 @@ decl_module! { ...@@ -131,6 +131,7 @@ decl_module! {
type Error = Error<T>; type Error = Error<T>;
/// Provide candidate receipts for parachains, in ascending order by id. /// Provide candidate receipts for parachains, in ascending order by id.
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
fn more_attestations(origin, _more: MoreAttestations) -> DispatchResult { fn more_attestations(origin, _more: MoreAttestations) -> DispatchResult {
ensure_none(origin)?; ensure_none(origin)?;
ensure!(!DidUpdate::exists(), Error::<T>::TooManyAttestations); ensure!(!DidUpdate::exists(), Error::<T>::TooManyAttestations);
......
...@@ -294,6 +294,7 @@ decl_module! { ...@@ -294,6 +294,7 @@ decl_module! {
/// Contribute to a crowd sale. This will transfer some balance over to fund a parachain /// Contribute to a crowd sale. This will transfer some balance over to fund a parachain
/// slot. It will be withdrawable in two instances: the parachain becomes retired; or the /// slot. It will be withdrawable in two instances: the parachain becomes retired; or the
/// slot is unable to be purchased and the timeout expires. /// slot is unable to be purchased and the timeout expires.
#[weight = SimpleDispatchInfo::default()]
fn contribute(origin, #[compact] index: FundIndex, #[compact] value: BalanceOf<T>) { fn contribute(origin, #[compact] index: FundIndex, #[compact] value: BalanceOf<T>) {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
...@@ -352,6 +353,7 @@ decl_module! { ...@@ -352,6 +353,7 @@ decl_module! {
/// - `index` is the fund index that `origin` owns and whose deploy data will be set. /// - `index` is the fund index that `origin` owns and whose deploy data will be set.
/// - `code_hash` is the hash of the parachain's Wasm validation function. /// - `code_hash` is the hash of the parachain's Wasm validation function.
/// - `initial_head_data` is the parachain's initial head data. /// - `initial_head_data` is the parachain's initial head data.
#[weight = SimpleDispatchInfo::default()]
fn fix_deploy_data(origin, fn fix_deploy_data(origin,
#[compact] index: FundIndex, #[compact] index: FundIndex,
code_hash: T::Hash, code_hash: T::Hash,
...@@ -377,6 +379,7 @@ decl_module! { ...@@ -377,6 +379,7 @@ decl_module! {
/// ///
/// - `index` is the fund index that `origin` owns and whose deploy data will be set. /// - `index` is the fund index that `origin` owns and whose deploy data will be set.
/// - `para_id` is the parachain index that this fund won. /// - `para_id` is the parachain index that this fund won.
#[weight = SimpleDispatchInfo::default()]
fn onboard(origin, fn onboard(origin,
#[compact] index: FundIndex, #[compact] index: FundIndex,
#[compact] para_id: ParaId #[compact] para_id: ParaId
...@@ -405,6 +408,7 @@ decl_module! { ...@@ -405,6 +408,7 @@ decl_module! {
} }
/// Note that a successful fund has lost its parachain slot, and place it into retirement. /// Note that a successful fund has lost its parachain slot, and place it into retirement.
#[weight = SimpleDispatchInfo::default()]
fn begin_retirement(origin, #[compact] index: FundIndex) { fn begin_retirement(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?; let _ = ensure_signed(origin)?;
...@@ -426,6 +430,7 @@ decl_module! { ...@@ -426,6 +430,7 @@ decl_module! {
} }
/// Withdraw full balance of a contributor to an unsuccessful or off-boarded fund. /// Withdraw full balance of a contributor to an unsuccessful or off-boarded fund.
#[weight = SimpleDispatchInfo::default()]
fn withdraw(origin, #[compact] index: FundIndex) { fn withdraw(origin, #[compact] index: FundIndex) {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
...@@ -456,6 +461,7 @@ decl_module! { ...@@ -456,6 +461,7 @@ decl_module! {
/// Remove a fund after either: it was unsuccessful and it timed out; or it was successful /// Remove a fund after either: it was unsuccessful and it timed out; or it was successful
/// but it has been retired from its parachain slot. This places any deposits that were not /// but it has been retired from its parachain slot. This places any deposits that were not
/// withdrawn into the treasury. /// withdrawn into the treasury.
#[weight = SimpleDispatchInfo::default()]
fn dissolve(origin, #[compact] index: FundIndex) { fn dissolve(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?; let _ = ensure_signed(origin)?;
......
...@@ -293,6 +293,7 @@ decl_module! { ...@@ -293,6 +293,7 @@ decl_module! {
/// - `count`: The number of parathreads. /// - `count`: The number of parathreads.
/// ///
/// Must be called from Root origin. /// Must be called from Root origin.
#[weight = SimpleDispatchInfo::default()]
fn set_thread_count(origin, count: u32) { fn set_thread_count(origin, count: u32) {
ensure_root(origin)?; ensure_root(origin)?;
ThreadCount::put(count); ThreadCount::put(count);
...@@ -306,6 +307,7 @@ decl_module! { ...@@ -306,6 +307,7 @@ decl_module! {
/// Unlike `register_para`, this function does check that the maximum code size /// Unlike `register_para`, this function does check that the maximum code size
/// and head data size are respected, as parathread registration is an atomic /// and head data size are respected, as parathread registration is an atomic
/// action. /// action.
#[weight = SimpleDispatchInfo::default()]
fn register_parathread(origin, fn register_parathread(origin,
code: Vec<u8>, code: Vec<u8>,
initial_head_data: Vec<u8>, initial_head_data: Vec<u8>,
...@@ -345,6 +347,7 @@ decl_module! { ...@@ -345,6 +347,7 @@ decl_module! {
/// This is a kind of special transaction that should be heavily prioritized in the /// This is a kind of special transaction that should be heavily prioritized in the
/// transaction pool according to the `value`; only `ThreadCount` of them may be presented /// transaction pool according to the `value`; only `ThreadCount` of them may be presented
/// in any single block. /// in any single block.
#[weight = SimpleDispatchInfo::default()]
fn select_parathread(origin, fn select_parathread(origin,
#[compact] _id: ParaId, #[compact] _id: ParaId,
_collator: CollatorId, _collator: CollatorId,
...@@ -361,6 +364,7 @@ decl_module! { ...@@ -361,6 +364,7 @@ decl_module! {
/// Ensure that before calling this that any funds you want emptied from the parathread's /// Ensure that before calling this that any funds you want emptied from the parathread's
/// account is moved out; after this it will be impossible to retrieve them (without /// account is moved out; after this it will be impossible to retrieve them (without
/// governance intervention). /// governance intervention).
#[weight = SimpleDispatchInfo::default()]
fn deregister_parathread(origin) { fn deregister_parathread(origin) {
let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?; let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?;
...@@ -384,6 +388,7 @@ decl_module! { ...@@ -384,6 +388,7 @@ decl_module! {
/// `ParaId` to be a long-term identifier of a notional "parachain". However, their /// `ParaId` to be a long-term identifier of a notional "parachain". However, their
/// scheduling info (i.e. whether they're a parathread or parachain), auction information /// scheduling info (i.e. whether they're a parathread or parachain), auction information
/// and the auction deposit are switched. /// and the auction deposit are switched.
#[weight = SimpleDispatchInfo::default()]
fn swap(origin, #[compact] other: ParaId) { fn swap(origin, #[compact] other: ParaId) {
let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?; let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment