Struct sc_executor_wasmtime::Semantics[][src]

pub struct Semantics {
    pub fast_instance_reuse: bool,
    pub deterministic_stack_limit: Option<DeterministicStackLimit>,
    pub canonicalize_nans: bool,
}

Fields

fast_instance_reuse: bool

Enabling this will lead to some optimization shenanigans that make calling WasmInstance extermely fast.

Primarily this is achieved by not recreating the instance for each call and performing a bare minimum clean up: reapplying the data segments and restoring the values for global variables. The vast majority of the linear memory is not restored, meaning that effects of previous executions on the same WasmInstance can be observed there.

This is not a problem for a standard substrate runtime execution because it’s up to the runtime itself to make sure that it doesn’t involve any non-determinism.

Since this feature depends on instrumentation, it can be set only if runtime is instantiated using the runtime blob, e.g. using create_runtime.

deterministic_stack_limit: Option<DeterministicStackLimit>

Specifiying Some will enable deterministic stack height. That is, all executor invocations will reach stack overflow at the exactly same point across different wasmtime versions and architectures.

This is achieved by a combination of running an instrumentation pass on input code and configuring wasmtime accordingly.

Since this feature depends on instrumentation, it can be set only if runtime is instantiated using the runtime blob, e.g. using create_runtime.

canonicalize_nans: bool

Controls whether wasmtime should compile floating point in a way that doesn’t allow for non-determinism.

By default, the wasm spec allows some local non-determinism wrt. certain floating point operations. Specifically, those operations that are not defined to operate on bits (e.g. fneg) can produce NaN values. The exact bit pattern for those is not specified and may depend on the particular machine that executes wasmtime generated JITed machine code. That is a source of non-deterministic values.

The classical runtime environment for Substrate allowed it and punted this on the runtime developers. For PVFs, we want to ensure that execution is deterministic though. Therefore, for PVF execution this flag is meant to be turned on.

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 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.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

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.