Introduce BlockExecutionWeight and ExtrinsicBaseWeight (#1023)

* Update to changes in Substrate

* Fix trait

* Remove `TransactionBaseFee`

* add temporary values for extrinsic base weight and block execution weight

* Update Cargo.lock
This commit is contained in:
Shawn Tabrizi
2020-04-25 10:04:35 +02:00
committed by GitHub
parent 5733869389
commit 0a10e37c99
12 changed files with 262 additions and 249 deletions
+8 -7
View File
@@ -71,7 +71,6 @@ use frame_support::{
traits::{
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
},
weights::MINIMUM_WEIGHT,
};
use system::ensure_signed;
use sp_runtime::{ModuleId,
@@ -297,7 +296,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 = MINIMUM_WEIGHT]
#[weight = 0]
fn contribute(origin, #[compact] index: FundIndex, #[compact] value: BalanceOf<T>) {
let who = ensure_signed(origin)?;
@@ -356,7 +355,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 = MINIMUM_WEIGHT]
#[weight = 0]
fn fix_deploy_data(origin,
#[compact] index: FundIndex,
code_hash: T::Hash,
@@ -382,7 +381,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 = MINIMUM_WEIGHT]
#[weight = 0]
fn onboard(origin,
#[compact] index: FundIndex,
#[compact] para_id: ParaId
@@ -411,7 +410,7 @@ decl_module! {
}
/// Note that a successful fund has lost its parachain slot, and place it into retirement.
#[weight = MINIMUM_WEIGHT]
#[weight = 0]
fn begin_retirement(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?;
@@ -433,7 +432,7 @@ decl_module! {
}
/// Withdraw full balance of a contributor to an unsuccessful or off-boarded fund.
#[weight = MINIMUM_WEIGHT]
#[weight = 0]
fn withdraw(origin, #[compact] index: FundIndex) {
let who = ensure_signed(origin)?;
@@ -464,7 +463,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 = MINIMUM_WEIGHT]
#[weight = 0]
fn dissolve(origin, #[compact] index: FundIndex) {
let _ = ensure_signed(origin)?;
@@ -607,6 +606,8 @@ mod tests {
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();