Unverified Commit 31a62f29 authored by Kian Paimani's avatar Kian Paimani Committed by GitHub
Browse files

Companion for substrate/5686 (#1008)

* Companion for substrate/5686

* Update substrate
parent a8e9240c
Pipeline #88959 passed with stages
in 21 minutes and 9 seconds
This diff is collapsed.
......@@ -25,7 +25,7 @@ use frame_support::{
decl_storage, decl_module, decl_error, ensure,
dispatch::DispatchResult,
traits::Get,
weights::{MINIMUM_WEIGHT, SimpleDispatchInfo},
weights::{MINIMUM_WEIGHT, DispatchClass},
};
use primitives::{Hash, parachain::{AttestedCandidate, AbridgedCandidateReceipt, Id as ParaId}};
......@@ -134,7 +134,7 @@ decl_module! {
type Error = Error<T>;
/// Provide candidate receipts for parachains, in ascending order by id.
#[weight = SimpleDispatchInfo::FixedMandatory(MINIMUM_WEIGHT)]
#[weight = (MINIMUM_WEIGHT, DispatchClass::Mandatory)]
fn more_attestations(origin, _more: MoreAttestations) -> DispatchResult {
ensure_none(origin)?;
ensure!(!DidUpdate::exists(), Error::<T>::TooManyAttestations);
......
......@@ -19,7 +19,6 @@
use sp_std::prelude::*;
use sp_io::{hashing::keccak_256, crypto::secp256k1_ecdsa_recover};
use frame_support::{decl_event, decl_storage, decl_module, decl_error};
use frame_support::weights::SimpleDispatchInfo;
use frame_support::traits::{Currency, Get, VestingSchedule};
use system::{ensure_root, ensure_none};
use codec::{Encode, Decode};
......@@ -184,7 +183,7 @@ decl_module! {
///
/// Total Complexity: O(1)
/// </weight>
#[weight = SimpleDispatchInfo::FixedNormal(1_000_000_000)]
#[weight = 1_000_000_000]
fn claim(origin, dest: T::AccountId, ethereum_signature: EcdsaSignature) {
ensure_none(origin)?;
......@@ -231,7 +230,7 @@ decl_module! {
///
/// Total Complexity: O(1)
/// </weight>
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
#[weight = 30_000_000]
fn mint_claim(origin,
who: EthereumAddress,
value: BalanceOf<T>,
......
......@@ -71,7 +71,7 @@ use frame_support::{
traits::{
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
},
weights::{MINIMUM_WEIGHT, SimpleDispatchInfo},
weights::MINIMUM_WEIGHT,
};
use system::ensure_signed;
use sp_runtime::{ModuleId,
......@@ -250,7 +250,7 @@ decl_module! {
fn deposit_event() = default;
/// Create a new crowdfunding campaign for a parachain slot deposit for the current auction.
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
#[weight = 100_000_000]
fn create(origin,
#[compact] cap: BalanceOf<T>,
#[compact] first_slot: T::BlockNumber,
......@@ -294,7 +294,7 @@ decl_module! {
/// 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 is unable to be purchased and the timeout expires.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn contribute(origin, #[compact] index: FundIndex, #[compact] value: BalanceOf<T>) {
let who = ensure_signed(origin)?;
......@@ -353,7 +353,7 @@ decl_module! {
/// - `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.
/// - `initial_head_data` is the parachain's initial head data.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn fix_deploy_data(origin,
#[compact] index: FundIndex,
code_hash: T::Hash,
......@@ -379,7 +379,7 @@ decl_module! {
///
/// - `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.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn onboard(origin,
#[compact] index: FundIndex,
#[compact] para_id: ParaId
......@@ -408,7 +408,7 @@ decl_module! {
}
/// Note that a successful fund has lost its parachain slot, and place it into retirement.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn begin_retirement(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?;
......@@ -430,7 +430,7 @@ decl_module! {
}
/// Withdraw full balance of a contributor to an unsuccessful or off-boarded fund.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn withdraw(origin, #[compact] index: FundIndex) {
let who = ensure_signed(origin)?;
......@@ -461,7 +461,7 @@ decl_module! {
/// 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
/// withdrawn into the treasury.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn dissolve(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?;
......
......@@ -35,8 +35,8 @@ use sp_staking::{
};
use frame_support::{
traits::KeyOwnerProofSystem,
dispatch::IsSubType,
weights::{SimpleDispatchInfo, Weight, MINIMUM_WEIGHT},
dispatch::{IsSubType},
weights::{DispatchClass, Weight, MINIMUM_WEIGHT},
};
use primitives::{
Balance,
......@@ -571,7 +571,7 @@ decl_module! {
}
/// Provide candidate receipts for parachains, in ascending order by id.
#[weight = SimpleDispatchInfo::FixedMandatory(1_000_000_000)]
#[weight = (1_000_000_000, DispatchClass::Mandatory)]
pub fn set_heads(origin, heads: Vec<AttestedCandidate>) -> DispatchResult {
ensure_none(origin)?;
ensure!(!<DidUpdate>::exists(), Error::<T>::TooManyHeadUpdates);
......@@ -651,7 +651,7 @@ decl_module! {
///
/// The weight is 0; in order to avoid DoS a `SignedExtension` validation
/// is implemented.
#[weight = SimpleDispatchInfo::FixedNormal(0)]
#[weight = 0]
pub fn report_double_vote(
origin,
report: DoubleVoteReport<
......
......@@ -31,7 +31,7 @@ use sp_runtime::{
use frame_support::{
decl_storage, decl_module, decl_event, decl_error, ensure,
dispatch::{DispatchResult, IsSubType}, traits::{Get, Currency, ReservableCurrency},
weights::{SimpleDispatchInfo, Weight, MINIMUM_WEIGHT},
weights::{DispatchClass, Weight, MINIMUM_WEIGHT},
};
use system::{self, ensure_root, ensure_signed};
use primitives::parachain::{
......@@ -264,7 +264,7 @@ decl_module! {
///
/// Unlike the `Registrar` trait function of the same name, this
/// checks the code and head data against size limits.
#[weight = SimpleDispatchInfo::FixedOperational(5_000_000_000)]
#[weight = (5_000_000_000, DispatchClass::Operational)]
pub fn register_para(origin,
#[compact] id: ParaId,
info: ParaInfo,
......@@ -289,7 +289,7 @@ decl_module! {
}
/// Deregister a parachain with given id
#[weight = SimpleDispatchInfo::FixedOperational(10_000_000)]
#[weight = (10_000_000, DispatchClass::Operational)]
pub fn deregister_para(origin, #[compact] id: ParaId) -> DispatchResult {
ensure_root(origin)?;
<Self as Registrar<T::AccountId>>::deregister_para(id)
......@@ -300,7 +300,7 @@ decl_module! {
/// - `count`: The number of parathreads.
///
/// Must be called from Root origin.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn set_thread_count(origin, count: u32) {
ensure_root(origin)?;
ThreadCount::put(count);
......@@ -314,7 +314,7 @@ decl_module! {
/// Unlike `register_para`, this function does check that the maximum code size
/// and head data size are respected, as parathread registration is an atomic
/// action.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn register_parathread(origin,
code: ValidationCode,
initial_head_data: HeadData,
......@@ -354,7 +354,7 @@ decl_module! {
/// 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
/// in any single block.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn select_parathread(origin,
#[compact] _id: ParaId,
_collator: CollatorId,
......@@ -371,7 +371,7 @@ decl_module! {
/// 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
/// governance intervention).
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn deregister_parathread(origin) {
let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?;
......@@ -395,7 +395,7 @@ decl_module! {
/// `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
/// and the auction deposit are switched.
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
#[weight = MINIMUM_WEIGHT]
fn swap(origin, #[compact] other: ParaId) {
let id = parachains::ensure_parachain(<T as Trait>::Origin::from(origin))?;
......
......@@ -26,7 +26,7 @@ use codec::{Encode, Decode, Codec};
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure, dispatch::DispatchResult,
traits::{Currency, ReservableCurrency, WithdrawReason, ExistenceRequirement, Get, Randomness},
weights::{MINIMUM_WEIGHT, SimpleDispatchInfo, Weight},
weights::{MINIMUM_WEIGHT, DispatchClass, Weight},
};
use primitives::parachain::{
SwapAux, PARACHAIN_INFO, Id as ParaId, ValidationCode, HeadData,
......@@ -309,7 +309,7 @@ decl_module! {
/// This can only happen when there isn't already an auction in progress and may only be
/// called by the root origin. Accepts the `duration` of this auction and the
/// `lease_period_index` of the initial lease period of the four that are to be auctioned.
#[weight = SimpleDispatchInfo::FixedOperational(100_000_000)]
#[weight = (100_000_000, DispatchClass::Operational)]
pub fn new_auction(origin,
#[compact] duration: T::BlockNumber,
#[compact] lease_period_index: LeasePeriodOf<T>
......@@ -344,7 +344,7 @@ decl_module! {
/// absolute lease period index value, not an auction-specific offset.
/// - `amount` is the amount to bid to be held as deposit for the parachain should the
/// bid win. This amount is held throughout the range.
#[weight = SimpleDispatchInfo::FixedNormal(500_000_000)]
#[weight = 500_000_000]
pub fn bid(origin,
#[compact] sub: SubId,
#[compact] auction_index: AuctionIndex,
......@@ -372,7 +372,7 @@ decl_module! {
/// absolute lease period index value, not an auction-specific offset.
/// - `amount` is the amount to bid to be held as deposit for the parachain should the
/// bid win. This amount is held throughout the range.
#[weight = SimpleDispatchInfo::FixedNormal(500_000_000)]
#[weight = 500_000_000]
fn bid_renew(origin,
#[compact] auction_index: AuctionIndex,
#[compact] first_slot: LeasePeriodOf<T>,
......@@ -391,7 +391,7 @@ decl_module! {
/// The origin *must* be a parachain account.
///
/// - `dest` is the destination account to receive the parachain's deposit.
#[weight = SimpleDispatchInfo::FixedNormal(1_000_000_000)]
#[weight = 1_000_000_000]
pub fn set_offboarding(origin, dest: <T::Lookup as StaticLookup>::Source) {
let who = ensure_signed(origin)?;
let dest = T::Lookup::lookup(dest)?;
......@@ -407,7 +407,7 @@ decl_module! {
/// - `para_id` is the parachain ID allotted to the winning bidder.
/// - `code_hash` is the hash of the parachain's Wasm validation function.
/// - `initial_head_data` is the parachain's initial head data.
#[weight = SimpleDispatchInfo::FixedNormal(500_000_000)]
#[weight = 500_000_000]
pub fn fix_deploy_data(origin,
#[compact] sub: SubId,
#[compact] para_id: ParaId,
......@@ -449,7 +449,7 @@ decl_module! {
/// - `_origin` is irrelevant.
/// - `para_id` is the parachain ID whose code will be elaborated.
/// - `code` is the preimage of the registered `code_hash` of `para_id`.
#[weight = SimpleDispatchInfo::FixedNormal(5_000_000_000)]
#[weight = 5_000_000_000]
pub fn elaborate_deploy_data(
_origin,
#[compact] para_id: ParaId,
......
......@@ -41,7 +41,7 @@ use sp_runtime::{
curve::PiecewiseLinear,
traits::{
BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup,
DispatchInfoOf, StaticLookup, Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
DispatchInfoOf, Extrinsic as ExtrinsicT, SaturatedConversion, Verify,
},
};
#[cfg(feature = "runtime-benchmarks")]
......
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