Introduce BlockExecutionWeight and ExtrinsicBaseWeight (#5722)

* Introduce `BlockExectionWeight` and `ExtrinsicBaseWeight`

* Add new traits everywhere

* Missed one update

* fix tests

* Update `check_weight` logic

* introduce `max_extrinsic_weight` function

* fix + add tests

* format nits

* remove println

* make test a bit more clear

* Remove minimum weight

* newlines left over from find/replace

* Fix test, improve clarity

* Fix executor tests

* Extrinsic base weight same as old `MINIMUM_WEIGHT`

* fix example test

* Expose constants

* Add test for full block with operational and normal

* Initiate test environment with `BlockExecutionWeight` weight

* format nit

* Update frame/system/src/lib.rs

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Replace `TransactionBaseFee` with `ExtrinsicBaseWeight` (#5761)

* Replace `TransactionBaseFee` with `ExtrinsicBaseFee`

* Fix stuff

* Fix and make tests better

* Forgot to update this test

* Fix priority number in test

* Remove minimum weight from merge

* Fix weight in contracts

* remove `TransactionBaseFee` from contract tests

* Let `register_extra_weight_unchecked` go past `MaximumBlockWeight`

* address feedback

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-04-25 07:59:54 +02:00
committed by GitHub
parent 3793fbf9cc
commit 8a33c297b4
74 changed files with 518 additions and 301 deletions
+6 -4
View File
@@ -619,7 +619,7 @@ decl_module! {
/// - One balance reserve operation.
/// - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).
/// - One event.
/// - Benchmarks:
/// - Benchmarks:
/// - 136.6 + R * 0.62 + X * 2.62 µs (min squares analysis)
/// - 146.2 + R * 0.372 + X * 2.98 µs (min squares analysis)
/// # </weight>
@@ -684,7 +684,7 @@ decl_module! {
/// - One storage read (codec complexity `O(P)`).
/// - One storage write (codec complexity `O(S)`).
/// - One storage-exists (`IdentityOf::contains_key`).
/// - Benchmarks:
/// - Benchmarks:
/// - 115.2 + P * 5.11 + S * 6.67 µs (min squares analysis)
/// - 121 + P * 4.852 + S * 7.111 µs (min squares analysis)
/// # </weight>
@@ -748,7 +748,7 @@ decl_module! {
/// - One balance-unreserve operation.
/// - `2` storage reads and `S + 2` storage deletions.
/// - One event.
/// - Benchmarks:
/// - Benchmarks:
/// - 152.3 + R * 0.306 + S * 4.967 + X * 1.697 µs (min squares analysis)
/// - 139.5 + R * 0.466 + S * 5.304 + X * 1.895 µs (min squares analysis)
/// # </weight>
@@ -1167,6 +1167,8 @@ mod tests {
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
@@ -1271,7 +1273,7 @@ mod tests {
}
let last_registrar = MaxRegistrars::get() as u64 + 1;
assert_noop!(
Identity::add_registrar(Origin::signed(1), last_registrar),
Identity::add_registrar(Origin::signed(1), last_registrar),
Error::<Test>::TooManyRegistrars
);
});