Repository: paritytech/substrate
File: frame/contracts/src/wasm/mod.rs (Rust)

Code before:

/// Contract code related data, such as:
///
/// - owner of the contract, i.e. account uploaded its code,
/// - storage deposit amount,
/// - reference count,
/// - determinism marker.
///
/// It is stored in a separate storage entry to avoid loading the code when not necessary.
#[derive(Clone, Encode, Decode, scale_info::TypeInfo, MaxEncodedLen)]
#[codec(mel_bound())]
#[scale_info(skip_type_params(T))]
pub struct CodeInfo<T: Config> {
	/// The account that has uploaded the contract code and hence is allowed to remove it.
	owner: AccountIdOf<T>,
	/// The amount of balance that was deposited by the owner in order to store it on-chain.
	#[codec(compact)]
	deposit: BalanceOf<T>,
	/// The number of instantiated contracts that use this as their code.
	#[codec(compact)]
	refcount: u64,
	/// Marks if the code might contain non-deterministic features and is therefore never allowed
	/// to be run on-chain. Specifically, such a code can never be instantiated into a contract
	/// and can just be used through a delegate call.
	determinism: Determinism,
	/// length of the code in bytes
	code_len: u32,
}

/// Defines the required determinism level of a wasm blob when either running or uploading code.
#[derive(
	Clone, Copy, Encode, Decode, scale_info::TypeInfo, MaxEncodedLen, RuntimeDebug, PartialEq, Eq,
)]
pub enum Determinism {
	/// The execution should be deterministic and hence no indeterministic instructions are
	/// allowed.
	///
	/// Dispatchables always use this mode in order to make on-chain execution deterministic.
	Enforced,
	/// Allow calling or uploading an indeterministic code.
	///
	/// This is only possible when calling into `pallet-contracts` directly via
	/// [`crate::Pallet::bare_call`].
	///
	/// # Note
	///
	/// **Never** use this mode for on-chain execution.
	Relaxed,
}

impl ExportedFunction {

Review comment (suggestion):
```suggestion
	/// length of the code in bytes.
```

Code after:

/// Contract code related data, such as:
///
/// - owner of the contract, i.e. account uploaded its code,
/// - storage deposit amount,
/// - reference count,
/// - determinism marker.
///
/// It is stored in a separate storage entry to avoid loading the code when not necessary.
#[derive(Clone, Encode, Decode, scale_info::TypeInfo, MaxEncodedLen)]
#[codec(mel_bound())]
#[scale_info(skip_type_params(T))]
pub struct CodeInfo<T: Config> {
	/// The account that has uploaded the contract code and hence is allowed to remove it.
	owner: AccountIdOf<T>,
	/// The amount of balance that was deposited by the owner in order to store it on-chain.
	#[codec(compact)]
	deposit: BalanceOf<T>,
	/// The number of instantiated contracts that use this as their code.
	#[codec(compact)]
	refcount: u64,
	/// Marks if the code might contain non-deterministic features and is therefore never allowed
	/// to be run on-chain. Specifically, such a code can never be instantiated into a contract
	/// and can just be used through a delegate call.
	determinism: Determinism,
	/// length of the code in bytes.
	code_len: u32,
}

/// Defines the required determinism level of a wasm blob when either running or uploading code.
#[derive(
	Clone, Copy, Encode, Decode, scale_info::TypeInfo, MaxEncodedLen, RuntimeDebug, PartialEq, Eq,
)]
pub enum Determinism {
	/// The execution should be deterministic and hence no indeterministic instructions are
	/// allowed.
	///
	/// Dispatchables always use this mode in order to make on-chain execution deterministic.
	Enforced,
	/// Allow calling or uploading an indeterministic code.
	///
	/// This is only possible when calling into `pallet-contracts` directly via
	/// [`crate::Pallet::bare_call`].
	///
	/// # Note
	///
	/// **Never** use this mode for on-chain execution.
	Relaxed,
}

impl ExportedFunction {