Weight v1.5: Opaque Struct (#12138)

* initial idea

* update frame_support

* update a bunch more

* add ord

* adjust RuntimeDbWeight

* frame_system builds

* re-export

* frame_support tests pass

* frame_executive compile

* frame_executive builds

* frame_system tests passing

* pallet-utility tests pass

* fix a bunch of pallets

* more

* phragmen

* state-trie-migration

* scheduler and referenda

* pallet-election-provider-multi-phase

* aura

* staking

* more

* babe

* balances

* bunch more

* sudo

* transaction-payment

* asset-tx-payment

* last pallets

* fix alliance merge

* fix node template runtime

* fix pallet-contracts cc @athei

* fix node runtime

* fix compile on runtime-benchmarks feature

* comment

* fix frame-support-test

* fix more tests

* weight regex

* frame system works

* fix a bunch

* more

* more

* more

* more

* more

* more fixes

* update templates

* fix contracts benchmarks

* Update lib.rs

* Update lib.rs

* fix ui

* make scalar saturating mul const

* more const functions

* scalar div

* refactor using constant functions

* move impl

* fix overhead template

* use compactas

* Update lib.rs
This commit is contained in:
Shawn Tabrizi
2022-08-31 12:26:13 +01:00
committed by GitHub
parent 299f4ba541
commit 30951822ba
187 changed files with 5932 additions and 4930 deletions
+36 -15
View File
@@ -224,7 +224,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
System::initialize(&1, &[0u8; 32].into(), &Default::default());
System::note_finished_initialize();
let pre_info = DispatchInfo { weight: 1000, ..Default::default() };
let pre_info = DispatchInfo { weight: Weight::from_ref_time(1000), ..Default::default() };
System::note_applied_extrinsic(&Ok(Some(300).into()), pre_info);
System::note_applied_extrinsic(&Ok(Some(1000).into()), pre_info);
System::note_applied_extrinsic(
@@ -236,7 +236,10 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
System::note_applied_extrinsic(&Ok(Pays::No.into()), pre_info);
System::note_applied_extrinsic(&Ok((Some(2_500_000), Pays::No).into()), pre_info);
System::note_applied_extrinsic(&Ok((Some(500), Pays::No).into()), pre_info);
System::note_applied_extrinsic(&Err(DispatchError::BadOrigin.with_weight(999)), pre_info);
System::note_applied_extrinsic(
&Err(DispatchError::BadOrigin.with_weight(Weight::from_ref_time(999))),
pre_info,
);
System::note_applied_extrinsic(
&Err(DispatchErrorWithPostInfo {
@@ -247,14 +250,20 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
);
System::note_applied_extrinsic(
&Err(DispatchErrorWithPostInfo {
post_info: PostDispatchInfo { actual_weight: Some(800), pays_fee: Pays::Yes },
post_info: PostDispatchInfo {
actual_weight: Some(Weight::from_ref_time(800)),
pays_fee: Pays::Yes,
},
error: DispatchError::BadOrigin,
}),
pre_info,
);
System::note_applied_extrinsic(
&Err(DispatchErrorWithPostInfo {
post_info: PostDispatchInfo { actual_weight: Some(800), pays_fee: Pays::No },
post_info: PostDispatchInfo {
actual_weight: Some(Weight::from_ref_time(800)),
pays_fee: Pays::No,
},
error: DispatchError::BadOrigin,
}),
pre_info,
@@ -266,7 +275,10 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
EventRecord {
phase: Phase::ApplyExtrinsic(0),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: 300, ..Default::default() },
dispatch_info: DispatchInfo {
weight: Weight::from_ref_time(300),
..Default::default()
},
}
.into(),
topics: vec![]
@@ -274,7 +286,10 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
EventRecord {
phase: Phase::ApplyExtrinsic(1),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: 1000, ..Default::default() },
dispatch_info: DispatchInfo {
weight: Weight::from_ref_time(1000),
..Default::default()
},
}
.into(),
topics: vec![]
@@ -282,7 +297,10 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
EventRecord {
phase: Phase::ApplyExtrinsic(2),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo { weight: 1000, ..Default::default() },
dispatch_info: DispatchInfo {
weight: Weight::from_ref_time(1000),
..Default::default()
},
}
.into(),
topics: vec![]
@@ -291,7 +309,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
phase: Phase::ApplyExtrinsic(3),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: 1000,
weight: Weight::from_ref_time(1000),
pays_fee: Pays::Yes,
..Default::default()
},
@@ -303,7 +321,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
phase: Phase::ApplyExtrinsic(4),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: 1000,
weight: Weight::from_ref_time(1000),
pays_fee: Pays::No,
..Default::default()
},
@@ -315,7 +333,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
phase: Phase::ApplyExtrinsic(5),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: 1000,
weight: Weight::from_ref_time(1000),
pays_fee: Pays::No,
..Default::default()
},
@@ -327,7 +345,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
phase: Phase::ApplyExtrinsic(6),
event: SysEvent::ExtrinsicSuccess {
dispatch_info: DispatchInfo {
weight: 500,
weight: Weight::from_ref_time(500),
pays_fee: Pays::No,
..Default::default()
},
@@ -339,7 +357,10 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
phase: Phase::ApplyExtrinsic(7),
event: SysEvent::ExtrinsicFailed {
dispatch_error: DispatchError::BadOrigin.into(),
dispatch_info: DispatchInfo { weight: 999, ..Default::default() },
dispatch_info: DispatchInfo {
weight: Weight::from_ref_time(999),
..Default::default()
},
}
.into(),
topics: vec![]
@@ -349,7 +370,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
event: SysEvent::ExtrinsicFailed {
dispatch_error: DispatchError::BadOrigin.into(),
dispatch_info: DispatchInfo {
weight: 1000,
weight: Weight::from_ref_time(1000),
pays_fee: Pays::Yes,
..Default::default()
},
@@ -362,7 +383,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
event: SysEvent::ExtrinsicFailed {
dispatch_error: DispatchError::BadOrigin.into(),
dispatch_info: DispatchInfo {
weight: 800,
weight: Weight::from_ref_time(800),
pays_fee: Pays::Yes,
..Default::default()
},
@@ -375,7 +396,7 @@ fn deposit_event_uses_actual_weight_and_pays_fee() {
event: SysEvent::ExtrinsicFailed {
dispatch_error: DispatchError::BadOrigin.into(),
dispatch_info: DispatchInfo {
weight: 800,
weight: Weight::from_ref_time(800),
pays_fee: Pays::No,
..Default::default()
},