referrerpolicy=no-referrer-when-downgrade

Trait DefaultConfig

Source
pub trait DefaultConfig: DefaultConfig {
Show 24 associated items type Time: Time<Moment: Into<U256>>; type RuntimeEvent; type RuntimeCall; type RuntimeOrigin; type RuntimeHoldReason; type WeightInfo: WeightInfo; type Precompiles; type FindAuthor: FindAuthor<Self::AccountId>; type DepositPerByte; type DepositPerItem; type DepositPerChildTrieItem; type CodeHashLockupDepositPercent: Get<Perbill>; type UnsafeUnstableInterface: Get<bool>; type AllowEVMBytecode: Get<bool>; type UploadOrigin; type InstantiateOrigin; type RuntimeMemory: Get<u32>; type PVFMemory: Get<u32>; type ChainId: Get<u64>; type NativeToEthRatio: Get<u32>; type FeeInfo; type MaxEthExtrinsicWeight: Get<FixedU128>; type DebugEnabled: Get<bool>; type GasScale;
}
Expand description

Based on Config. Auto-generated by #[pallet::config(with_default)]. Can be used in tandem with #[register_default_config] and #[derive_impl] to derive test config traits based on existing pallet config traits in a safe and developer-friendly way.

See here for more information and caveats about the auto-generated DefaultConfig trait and how it is generated.

Required Associated Types§

Source

type Time: Time<Moment: Into<U256>>

The time implementation used to supply timestamps to contracts through seal_now.

Source

type RuntimeEvent

The overarching event type.

Source

type RuntimeCall

The overarching call type.

Source

type RuntimeOrigin

The overarching origin type.

Source

type RuntimeHoldReason

Overarching hold reason.

Source

type WeightInfo: WeightInfo

Describes the weights of the dispatchables of this module and is also used to construct a default cost schedule.

Source

type Precompiles

Type that allows the runtime authors to add new host functions for a contract to call.

Pass in a tuple of types that implement precompiles::Precompile.

Source

type FindAuthor: FindAuthor<Self::AccountId>

Find the author of the current block.

Source

type DepositPerByte

The amount of balance a caller has to pay for each byte of storage.

§Note

It is safe to change this value on a live chain as all refunds are pro rata.

Source

type DepositPerItem

The amount of balance a caller has to pay for each storage item.

§Note

It is safe to change this value on a live chain as all refunds are pro rata.

Source

type DepositPerChildTrieItem

The amount of balance a caller has to pay for each child trie storage item.

Those are the items created by a contract. In Solidity each value is a single storage item. This is why we need to set a lower value here than for the main trie items. Otherwise the storage deposit is too high.

§Note

It is safe to change this value on a live chain as all refunds are pro rata.

Source

type CodeHashLockupDepositPercent: Get<Perbill>

The percentage of the storage deposit that should be held for using a code hash. Instantiating a contract, protects the code from being removed. In order to prevent abuse these actions are protected with a percentage of the code deposit.

Source

type UnsafeUnstableInterface: Get<bool>

Make contract callable functions marked as #[unstable] available.

Contracts that use #[unstable] functions won’t be able to be uploaded unless this is set to true. This is only meant for testnets and dev nodes in order to experiment with new features.

§Warning

Do not set to true on productions chains.

Source

type AllowEVMBytecode: Get<bool>

Allow EVM bytecode to be uploaded and instantiated.

Source

type UploadOrigin

Origin allowed to upload code.

By default, it is safe to set this to EnsureSigned, allowing anyone to upload contract code.

Source

type InstantiateOrigin

Origin allowed to instantiate code.

§Note

This is not enforced when a contract instantiates another contract. The Self::UploadOrigin should make sure that no code is deployed that does unwanted instantiations.

By default, it is safe to set this to EnsureSigned, allowing anyone to instantiate contract code.

Source

type RuntimeMemory: Get<u32>

The amount of memory in bytes that parachain nodes a lot to the runtime.

This is used in Pallet::integrity_test to make sure that the runtime has enough memory to support this pallet if set to the correct value.

Source

type PVFMemory: Get<u32>

The amount of memory in bytes that relay chain validators a lot to the PoV.

This is used in Pallet::integrity_test to make sure that the runtime has enough memory to support this pallet if set to the correct value.

This value is usually higher than Self::RuntimeMemory to account for the fact that validators have to hold all storage items in PvF memory.

Source

type ChainId: Get<u64>

The EIP-155 chain ID.

This is a unique identifier assigned to each blockchain network, preventing replay attacks.

Source

type NativeToEthRatio: Get<u32>

The ratio between the decimal representation of the native token and the ETH token.

Source

type FeeInfo

Set to crate::evm::fees::Info for a production runtime.

For mock runtimes that do not need to interact with any eth compat functionality the default value of () will suffice.

Source

type MaxEthExtrinsicWeight: Get<FixedU128>

The fraction the maximum extrinsic weight eth_transact extrinsics are capped to.

This is not a security measure but a requirement due to how we map gas to (Weight, StorageDeposit). The mapping might derive a Weight that is too large to fit into an extrinsic. In this case we cap it to the limit specified here.

eth_transact transactions that use more weight than specified will fail with an out of gas error during execution. Larger fractions will allow more transactions to run. Smaller values waste less block space: Choose as small as possible and as large as necessary.

Default: 0.5.

Source

type DebugEnabled: Get<bool>

Allows debug-mode configuration, such as enabling unlimited contract size.

Source

type GasScale

This determines the relative scale of our gas price and gas estimates.

By default, the gas price (in wei) is FeeInfo::next_fee_multiplier() multiplied by NativeToEthRatio. GasScale allows to scale this value: the actual gas price is the default gas price multiplied by GasScale.

As a consequence, gas cost (gas estimates and actual gas usage during transaction) is scaled down by the same factor. Thus, the total transaction cost is not affected by GasScale – apart from rounding differences: the transaction cost is always a multiple of the gas price and is derived by rounded up, so that with higher GasScales this can lead to higher gas cost as the rounding difference would be larger.

The main purpose of changing the GasScale is to tune the gas cost so that it is closer to standard EVM gas cost and contracts will not run out of gas when tools or code assume hard coded gas limits.

Requirement: GasScale must not be 0

Implementors§