Struct pallet_contracts::InstructionWeights[][src]

pub struct InstructionWeights<T: Config> {
Show fields pub version: u32, pub i64const: u32, pub i64load: u32, pub i64store: u32, pub select: u32, pub if: u32, pub br: u32, pub br_if: u32, pub br_table: u32, pub br_table_per_entry: u32, pub call: u32, pub call_indirect: u32, pub call_indirect_per_param: u32, pub local_get: u32, pub local_set: u32, pub local_tee: u32, pub global_get: u32, pub global_set: u32, pub memory_current: u32, pub memory_grow: u32, pub i64clz: u32, pub i64ctz: u32, pub i64popcnt: u32, pub i64eqz: u32, pub i64extendsi32: u32, pub i64extendui32: u32, pub i32wrapi64: u32, pub i64eq: u32, pub i64ne: u32, pub i64lts: u32, pub i64ltu: u32, pub i64gts: u32, pub i64gtu: u32, pub i64les: u32, pub i64leu: u32, pub i64ges: u32, pub i64geu: u32, pub i64add: u32, pub i64sub: u32, pub i64mul: u32, pub i64divs: u32, pub i64divu: u32, pub i64rems: u32, pub i64remu: u32, pub i64and: u32, pub i64or: u32, pub i64xor: u32, pub i64shl: u32, pub i64shrs: u32, pub i64shru: u32, pub i64rotl: u32, pub i64rotr: u32, pub _phantom: PhantomData<T>,
}
Expand description

Describes the weight for all categories of supported wasm instructions.

There there is one field for each wasm instruction that describes the weight to execute one instruction of that name. There are a few execptions:

  1. If there is a i64 and a i32 variant of an instruction we use the weight of the former for both.
  2. The following instructions are free of charge because they merely structure the wasm module and cannot be spammed without making the module invalid (and rejected): End, Unreachable, Return, Else
  3. The following instructions cannot be benchmarked because they are removed by any real world execution engine as a preprocessing step and therefore don’t yield a meaningful benchmark result. However, in contrast to the instructions mentioned in 2. they can be spammed. We price them with the same weight as the “default” instruction (i64.const): Block, Loop, Nop
  4. We price both i64.const and drop as InstructionWeights.i64const / 2. The reason for that is that we cannot benchmark either of them on its own but we need their individual values to derive (by subtraction) the weight of all other instructions that use them as supporting instructions. Supporting means mainly pushing arguments and dropping return values in order to maintain a valid module.

Fields

version: u32

Version of the instruction weights.

Note

Should be incremented whenever any instruction weight is changed. The reason is that changes to instruction weights require a re-instrumentation in order to apply the changes to an already deployed code. The re-instrumentation is triggered by comparing the version of the current schedule with the version the code was instrumented with. Changes usually happen when pallet_contracts is re-benchmarked.

Changes to other parts of the schedule should not increment the version in order to avoid unnecessary re-instrumentations.

i64const: u32i64load: u32i64store: u32select: u32if: u32br: u32br_if: u32br_table: u32br_table_per_entry: u32call: u32call_indirect: u32call_indirect_per_param: u32local_get: u32local_set: u32local_tee: u32global_get: u32global_set: u32memory_current: u32memory_grow: u32i64clz: u32i64ctz: u32i64popcnt: u32i64eqz: u32i64extendsi32: u32i64extendui32: u32i32wrapi64: u32i64eq: u32i64ne: u32i64lts: u32i64ltu: u32i64gts: u32i64gtu: u32i64les: u32i64leu: u32i64ges: u32i64geu: u32i64add: u32i64sub: u32i64mul: u32i64divs: u32i64divu: u32i64rems: u32i64remu: u32i64and: u32i64or: u32i64xor: u32i64shl: u32i64shrs: u32i64shru: u32i64rotl: u32i64rotr: u32_phantom: PhantomData<T>

The type parameter is used in the default implementation.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempt to deserialise the value from input.

Attempt to skip the encoded value from input. Read more

Returns the fixed encoded size of the type. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Convert self to a slice and append it to the destination.

If possible give a hint of expected size of the encoding. Read more

Convert self to an owned vector.

Convert self to a slice and then invoke the given closure with it.

Calculates the encoded size. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

True iff no bits are set.

Return the value of Self that is clear.

Decode Self and consume all of the given input data. Read more

Decode Self and consume all of the given input data. Read more

Decode Self with the given maximum recursion depth. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Cast reference.

Cast reference.

Cast mutable reference.

Cast mutable reference.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Return an encoding of Self prepended by given slice.

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.