Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 17f7ff8

Browse files
KiChjangshawntabrizikianenigma
authored andcommitted
Create sp-weights crate to store weight primitives (#12219)
* Create sp-weights crate to store weight primitives * Fix templates * Fix templates * Fixes * Fixes * cargo fmt * Fixes * Fixes * Use deprecated type alias instead of deprecated unit types * Use deprecated subtraits instead of deprecated hollow new traits * Fixes * Allow deprecation in macro expansion * Add missing where clause during call macro expansion * cargo fmt * Fixes * cargo fmt * Fixes * Fixes * Fixes * Fixes * Move FRAME-specific weight files back to frame_support * Fixes * Update frame/support/src/dispatch.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/support/src/dispatch.rs Co-authored-by: Kian Paimani <[email protected]> * Update frame/support/src/dispatch.rs Co-authored-by: Kian Paimani <[email protected]> * Add missing header * Rewrite module docs * Fixes * Fixes * Fixes * Fixes * cargo fmt Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
1 parent 32cec32 commit 17f7ff8

File tree

69 files changed

+1328
-1237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1328
-1237
lines changed

Cargo.lock

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ members = [
213213
"primitives/version",
214214
"primitives/version/proc-macro",
215215
"primitives/wasm-interface",
216+
"primitives/weights",
216217
"test-utils/client",
217218
"test-utils/derive",
218219
"test-utils/runtime",

bin/node/executor/tests/basic.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
use codec::{Decode, Encode, Joiner};
1919
use frame_support::{
20+
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo},
2021
traits::Currency,
21-
weights::{DispatchClass, DispatchInfo, GetDispatchInfo, Weight},
22+
weights::Weight,
2223
};
2324
use frame_system::{self, AccountInfo, EventRecord, Phase};
2425
use sp_core::{storage::well_known_keys, traits::Externalities};

bin/node/executor/tests/fees.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

1818
use codec::{Encode, Joiner};
1919
use frame_support::{
20+
dispatch::GetDispatchInfo,
2021
traits::Currency,
21-
weights::{constants::ExtrinsicBaseWeight, GetDispatchInfo, IdentityFee, WeightToFee},
22+
weights::{constants::ExtrinsicBaseWeight, IdentityFee, WeightToFee},
2223
};
2324
use kitchensink_runtime::{
2425
constants::{currency::*, time::SLOT_DURATION},

bin/node/runtime/src/impls.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ mod multiplier_tests {
129129
AdjustmentVariable, MinimumMultiplier, Runtime, RuntimeBlockWeights as BlockWeights,
130130
System, TargetBlockFullness, TransactionPayment,
131131
};
132-
use frame_support::weights::{DispatchClass, Weight, WeightToFee};
132+
use frame_support::{
133+
dispatch::DispatchClass,
134+
weights::{Weight, WeightToFee},
135+
};
133136

134137
fn max_normal() -> Weight {
135138
BlockWeights::get()

bin/node/runtime/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use frame_election_provider_support::{
2828
};
2929
use frame_support::{
3030
construct_runtime,
31+
dispatch::DispatchClass,
3132
pallet_prelude::Get,
3233
parameter_types,
3334
traits::{
@@ -37,7 +38,7 @@ use frame_support::{
3738
},
3839
weights::{
3940
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
40-
ConstantMultiplier, DispatchClass, IdentityFee, Weight,
41+
ConstantMultiplier, IdentityFee, Weight,
4142
},
4243
PalletId, RuntimeDebug,
4344
};

frame/babe/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323

2424
use codec::{Decode, Encode};
2525
use frame_support::{
26-
dispatch::DispatchResultWithPostInfo,
26+
dispatch::{DispatchResultWithPostInfo, Pays},
2727
ensure,
2828
traits::{
2929
ConstU32, DisabledValidators, FindAuthor, Get, KeyOwnerProofSystem, OnTimestampSet,
3030
OneSessionHandler,
3131
},
32-
weights::{Pays, Weight},
32+
weights::Weight,
3333
BoundedVec, WeakBoundedVec,
3434
};
3535
use sp_application_crypto::ByteArray;

frame/babe/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
use super::{Call, *};
2121
use frame_support::{
2222
assert_err, assert_noop, assert_ok,
23+
dispatch::{GetDispatchInfo, Pays},
2324
traits::{Currency, EstimateNextSessionRotation, OnFinalize},
24-
weights::{GetDispatchInfo, Pays},
2525
};
2626
use mock::*;
2727
use pallet_session::ShouldEndSession;

frame/balances/src/tests_composite.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
use crate::{self as pallet_balances, decl_tests, Config, Pallet};
2323
use frame_support::{
24+
dispatch::DispatchInfo,
2425
parameter_types,
2526
traits::{ConstU32, ConstU64, ConstU8},
26-
weights::{DispatchInfo, IdentityFee, Weight},
27+
weights::{IdentityFee, Weight},
2728
};
2829
use pallet_transaction_payment::CurrencyAdapter;
2930
use sp_core::H256;

frame/balances/src/tests_local.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
use crate::{self as pallet_balances, decl_tests, Config, Pallet};
2323
use frame_support::{
24+
dispatch::DispatchInfo,
2425
parameter_types,
2526
traits::{ConstU32, ConstU64, ConstU8, StorageMapShim},
26-
weights::{DispatchInfo, IdentityFee, Weight},
27+
weights::{IdentityFee, Weight},
2728
};
2829
use pallet_transaction_payment::CurrencyAdapter;
2930
use sp_core::H256;

0 commit comments

Comments
 (0)