Struct noble_contracts::Limits[][src]

pub struct Limits {
    pub event_topics: u32,
    pub stack_height: u32,
    pub globals: u32,
    pub parameters: u32,
    pub memory_pages: u32,
    pub table_size: u32,
    pub br_table_size: u32,
    pub subject_len: u32,
    pub code_size: u32,
}

Describes the upper limits on various metrics.

Fields

event_topics: u32

The maximum number of topics supported by an event.

stack_height: u32

Maximum allowed stack height in number of elements.

See https://wiki.tetcoin.org/WebAssembly-StackHeight to find out how the stack fabric cost is calculated. Each element can be of one of the wasm value types. This means the maximum size per element is 64bit.

globals: u32

Maximum number of globals a module is allowed to declare.

Globals are not limited through the stack_height as locals are. Neither does the linear memory limit memory_pages applies to them.

parameters: u32

Maximum numbers of parameters a function can have.

Those need to be limited to prevent a potentially exploitable interaction with the stack height instrumentation: The costs of executing the stack height instrumentation for an indirectly called function scales linearly with the amount of parameters of this function. Because the stack height instrumentation itself is is not weight metered its costs must be static (via this limit) and included in the costs of the instructions that cause them (call, call_indirect).

memory_pages: u32

Maximum number of memory pages allowed for a contract.

table_size: u32

Maximum number of elements allowed in a table.

Currently, the only type of element that is allowed in a table is funcref.

br_table_size: u32

Maximum number of elements that can appear as immediate value to the br_table instruction.

subject_len: u32

The maximum length of a subject in bytes used for PRNG generation.

code_size: u32

The maximum length of a contract code in bytes. This limit applies to the uninstrumented and pristine form of the code as supplied to put_code.

Implementations

impl Limits[src]

pub fn max_memory_size(&self) -> u32[src]

The maximum memory size in bytes that a contract can occupy.

Trait Implementations

impl Clone for Limits[src]

impl Debug for Limits[src]

impl Decode for Limits[src]

impl Default for Limits[src]

impl<'de> Deserialize<'de> for Limits[src]

impl Encode for Limits[src]

impl EncodeLike<Limits> for Limits[src]

impl Eq for Limits[src]

impl PartialEq<Limits> for Limits[src]

impl Serialize for Limits[src]

impl StructuralEq for Limits[src]

impl StructuralPartialEq for Limits[src]

Auto Trait Implementations

impl RefUnwindSafe for Limits

impl Send for Limits

impl Sync for Limits

impl Unpin for Limits

impl UnwindSafe for Limits

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> Clear for T where
    T: Default + Eq + PartialEq<T>, 
[src]

impl<S> Codec for S where
    S: Decode + Encode
[src]

impl<T> DecodeAll for T where
    T: Decode
[src]

impl<T> DecodeLimit for T where
    T: Decode
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> DynClone for T where
    T: Clone
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T, Global>> for T where
    T: Encode
[src]

impl<'a, T> EncodeLike<Cow<'a, T>> for T where
    T: ToOwned + Encode
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<S> FullCodec for S where
    S: Decode + FullEncode
[src]

impl<S> FullEncode for S where
    S: Encode + EncodeLike<S>, 
[src]

impl<T> Hashable for T where
    T: Codec
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IsType<T> for T[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> KeyedVec for T where
    T: Codec
[src]

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeDebug for T where
    T: Debug

impl<T> MaybeRefUnwindSafe for T where
    T: RefUnwindSafe

impl<T> MaybeSerialize for T where
    T: Serialize
[src]

impl<T> MaybeSerializeDeserialize for T where
    T: DeserializeOwned + Serialize
[src]

impl<T> Member for T where
    T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone
[src]

impl<T> Parameter for T where
    T: Codec + EncodeLike<T> + Clone + Eq + Debug
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatedConversion for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,