Trait dock_runtime::common::signatures::ForSigType
source · pub trait ForSigType: Sized {
// Required method
fn for_sig_type<R>(
&self,
for_sr25519: impl FnOnce() -> R,
for_ed25519: impl FnOnce() -> R,
for_secp256k1: impl FnOnce() -> R
) -> Option<R>;
// Provided methods
fn weight_for_sig_type<T>(
&self,
for_sr25519: impl FnOnce() -> Weight,
for_ed25519: impl FnOnce() -> Weight,
for_secp256k1: impl FnOnce() -> Weight
) -> Weight
where T: Config { ... }
fn count_sig_types(
auths: impl IntoIterator<Item = impl Borrow<Self>>
) -> SigTypes<u64> { ... }
fn auth_weight(
auths: impl IntoIterator<Item = impl Borrow<Self>>,
db_weights: RuntimeDbWeight
) -> Weight { ... }
}
Required Methods§
fn for_sig_type<R>( &self, for_sr25519: impl FnOnce() -> R, for_ed25519: impl FnOnce() -> R, for_secp256k1: impl FnOnce() -> R ) -> Option<R>
Provided Methods§
fn weight_for_sig_type<T>( &self, for_sr25519: impl FnOnce() -> Weight, for_ed25519: impl FnOnce() -> Weight, for_secp256k1: impl FnOnce() -> Weight ) -> Weightwhere T: Config,
sourcefn count_sig_types(
auths: impl IntoIterator<Item = impl Borrow<Self>>
) -> SigTypes<u64>
fn count_sig_types( auths: impl IntoIterator<Item = impl Borrow<Self>> ) -> SigTypes<u64>
Return counts of different signature types in given SignatureWithNonce
as 3-Tuple as (no. of Sr22519 sigs,
no. of Ed25519 Sigs, no. of Secp256k1 sigs). Useful for weight calculation and thus the return
type is in Weight
but realistically, it should fit in a u8
sourcefn auth_weight(
auths: impl IntoIterator<Item = impl Borrow<Self>>,
db_weights: RuntimeDbWeight
) -> Weight
fn auth_weight( auths: impl IntoIterator<Item = impl Borrow<Self>>, db_weights: RuntimeDbWeight ) -> Weight
Computes weight of the given SignatureWithNonce
. Considers the no. and types of signatures and no. of reads. Disregards
message size as messages are hashed giving the same output size and hashing itself is very cheap.
The extrinsic using it might decide to consider adding some weight proportional to the message size.