mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 13:17:56 +00:00
Per-transaction weight for srml (#2799)
* debug checkpoint. * new * Worked. * Worked and weight propagated to executive. * Works with some tests. * Cleanup debug prints. * More cleanup. * Undo more logs. * Undo a few more. * Fix build. * Allow len to be used in weight calculation. * Remove noop function from dispath. * Cleanup. * Unify traits. * Update docs and nits. * line width * Update core/sr-primitives/src/weights.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update core/sr-primitives/src/weights.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update core/sr-primitives/src/weights.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Update core/sr-primitives/src/weights.rs Co-Authored-By: Amar Singh <asinghchrony@protonmail.com> * Update srml/example/src/lib.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Final cleanup. * Fix build.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
//! stage.
|
||||
|
||||
use crate::traits::{self, Member, SimpleArithmetic, MaybeDisplay};
|
||||
use crate::weights::{Weighable, Weight};
|
||||
|
||||
/// Definition of something that the external world might want to say; its
|
||||
/// existence implies that it has been checked and is good, particularly with
|
||||
@@ -32,8 +33,7 @@ pub struct CheckedExtrinsic<AccountId, Index, Call> {
|
||||
pub function: Call,
|
||||
}
|
||||
|
||||
impl<AccountId, Index, Call> traits::Applyable
|
||||
for CheckedExtrinsic<AccountId, Index, Call>
|
||||
impl<AccountId, Index, Call> traits::Applyable for CheckedExtrinsic<AccountId, Index, Call>
|
||||
where
|
||||
AccountId: Member + MaybeDisplay,
|
||||
Index: Member + MaybeDisplay + SimpleArithmetic,
|
||||
@@ -55,3 +55,12 @@ where
|
||||
(self.function, self.signed.map(|x| x.0))
|
||||
}
|
||||
}
|
||||
|
||||
impl<AccountId, Index, Call> Weighable for CheckedExtrinsic<AccountId, Index, Call>
|
||||
where
|
||||
Call: Weighable,
|
||||
{
|
||||
fn weight(&self, len: usize) -> Weight {
|
||||
self.function.weight(len)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user