Struct cfx_vm_types::Spec

source ·
pub struct Spec {
Show 79 fields pub exceptional_failed_code_deposit: bool, pub stack_limit: usize, pub max_depth: usize, pub tier_step_gas: [usize; 8], pub exp_gas: usize, pub exp_byte_gas: usize, pub sha3_gas: usize, pub sha3_word_gas: usize, pub sload_gas: usize, pub sstore_set_gas: usize, pub sstore_reset_gas: usize, pub sstore_refund_gas: usize, pub tload_gas: usize, pub tstore_gas: usize, pub jumpdest_gas: usize, pub log_gas: usize, pub log_data_gas: usize, pub log_topic_gas: usize, pub create_gas: usize, pub call_gas: usize, pub call_stipend: usize, pub call_value_transfer_gas: usize, pub call_new_account_gas: usize, pub suicide_refund_gas: usize, pub memory_gas: usize, pub quad_coeff_div: usize, pub create_data_gas: usize, pub create_data_limit: usize, pub tx_gas: usize, pub tx_create_gas: usize, pub tx_data_zero_gas: usize, pub tx_data_non_zero_gas: usize, pub copy_gas: usize, pub extcodesize_gas: usize, pub extcodecopy_base_gas: usize, pub balance_gas: usize, pub extcodehash_gas: usize, pub suicide_gas: usize, pub retire_gas: usize, pub eip1820_gas: usize, pub access_list_storage_key_gas: usize, pub access_list_address_gas: usize, pub suicide_to_new_account_cost: usize, pub sub_gas_cap_divisor: Option<usize>, pub no_empty: bool, pub kill_empty: bool, pub blockhash_gas: usize, pub kill_dust: CleanDustMode, pub keep_unsigned_nonce: bool, pub wasm: Option<WasmCosts>, pub evm_gas_ratio: usize, pub cip43_init: bool, pub cip43_contract: bool, pub cip62: bool, pub cip64: bool, pub cip71: bool, pub cip78a: bool, pub cip78b: bool, pub cip90: bool, pub cip94: bool, pub cip94_activation_block_number: u64, pub params_dao_vote_period: u64, pub cip97: bool, pub cip98: bool, pub cip105: bool, pub cip_sigma_fix: bool, pub cip107: bool, pub cip118: bool, pub cip119: bool, pub cip131: bool, pub cip132: bool, pub cip133_b: BlockNumber, pub cip133_e: BlockHeight, pub cip133_core: bool, pub cip137: bool, pub cip1559: bool, pub cancun_opcodes: bool, pub cip144: bool, pub cip145: bool,
}
Expand description

Definition of the cost spec and other parameterisations for the VM.

Fields§

§exceptional_failed_code_deposit: bool

Does it support exceptional failed code deposit

§stack_limit: usize

VM stack limit

§max_depth: usize

Max number of nested calls/creates

§tier_step_gas: [usize; 8]

Gas prices for instructions in all tiers

§exp_gas: usize

Gas price for EXP opcode

§exp_byte_gas: usize

Additional gas for EXP opcode for each byte of exponent

§sha3_gas: usize

Gas price for SHA3 opcode

§sha3_word_gas: usize

Additional gas for SHA3 opcode for each word of hashed memory

§sload_gas: usize

Gas price for loading from storage

§sstore_set_gas: usize

Gas price for setting new value to storage (storage==0, new!=0)

§sstore_reset_gas: usize

Gas price for altering value in storage

§sstore_refund_gas: usize

Gas refund for SSTORE clearing (when storage!=0, new==0)

§tload_gas: usize

Gas price for TLOAD

§tstore_gas: usize

Gas price for TSTORE

§jumpdest_gas: usize

Gas price for JUMPDEST opcode

§log_gas: usize

Gas price for LOG*

§log_data_gas: usize

Additional gas for data in LOG*

§log_topic_gas: usize

Additional gas for each topic in LOG*

§create_gas: usize

Gas price for CREATE opcode

§call_gas: usize

Gas price for *CALL* opcodes

§call_stipend: usize

Stipend for transfer for CALL|CALLCODE opcode when value>0

§call_value_transfer_gas: usize

Additional gas required for value transfer (CALL|CALLCODE)

§call_new_account_gas: usize

Additional gas for creating new account (CALL|CALLCODE)

§suicide_refund_gas: usize

Refund for SUICIDE

§memory_gas: usize

Gas for used memory

§quad_coeff_div: usize

Coefficient used to convert memory size to gas price for memory

§create_data_gas: usize

Cost for contract length when executing CREATE

§create_data_limit: usize

Maximum code size when creating a contract.

§tx_gas: usize

Transaction cost

§tx_create_gas: usize

CREATE transaction cost

§tx_data_zero_gas: usize

Additional cost for empty data transaction

§tx_data_non_zero_gas: usize

Aditional cost for non-empty data transaction

§copy_gas: usize

Gas price for copying memory

§extcodesize_gas: usize

Price of EXTCODESIZE

§extcodecopy_base_gas: usize

Base price of EXTCODECOPY

§balance_gas: usize

Price of BALANCE

§extcodehash_gas: usize

Price of EXTCODEHASH

§suicide_gas: usize

Price of SUICIDE

§retire_gas: usize

Price for retiring PoS node.

§eip1820_gas: usize

Price for deploying Eip-1820 contract.

§access_list_storage_key_gas: usize§access_list_address_gas: usize§suicide_to_new_account_cost: usize

Amount of additional gas to pay when SUICIDE credits a non-existant account

§sub_gas_cap_divisor: Option<usize>

If Some(x): let limit = GAS * (x - 1) / x; let CALL’s gas = min(requested, limit); let CREATE’s gas = limit; If None: let CALL’s gas = (requested > GAS ? [OOG] : GAS); let CREATE’s gas = GAS;

§no_empty: bool

Don’t ever make empty accounts; contracts start with nonce=1. Also, don’t charge 25k when sending/suicide zero-value.

§kill_empty: bool

Kill empty accounts if touched.

§blockhash_gas: usize

Blockhash instruction gas cost.

§kill_dust: CleanDustMode

Kill basic accounts below this balance if touched.

§keep_unsigned_nonce: bool

VM execution does not increase null signed address nonce if this field is true.

§wasm: Option<WasmCosts>

Wasm extra specs, if wasm activated

§evm_gas_ratio: usize

The magnification of gas storage occupying related operaions.

§cip43_init: bool

CIP-43: Introduce Finality via Voting Among Staked

§cip43_contract: bool§cip62: bool

CIP-62: Enable EC-related builtin contract

§cip64: bool

CIP-64: Get current epoch number through internal contract

§cip71: bool

CIP-71: Disable anti-reentrancy

§cip78a: bool

CIP-78: Correct is_sponsored fields in receipt

§cip78b: bool

CIP-78: Correct is_sponsored fields in receipt

§cip90: bool

CIP-90: A Space that Fully EVM Compatible

§cip94: bool

CIP-94: On-chain Parameter DAO Vote

§cip94_activation_block_number: u64§params_dao_vote_period: u64§cip97: bool

CIP-97: Remove staking list

§cip98: bool

CIP-98: Fix espace bug

§cip105: bool

CIP-105: Minimal DAO votes requirement based on PoS votes.

§cip_sigma_fix: bool§cip107: bool

CIP-107: Reduce storage collateral refund.

§cip118: bool

CIP-118: Query Unused Storage Points in Internal Contract

§cip119: bool

CIP-119: PUSH0 instruction

§cip131: bool

CIP-131: Retain Whitelist on Contract Deletion

§cip132: bool

CIP-132: Fix Static Context Check for Internal Contracts

§cip133_b: BlockNumber

CIP-133: Enhanced Block Hash Query

§cip133_e: BlockHeight§cip133_core: bool§cip137: bool

CIP-137: Base Fee Sharing in CIP-1559

§cip1559: bool§cancun_opcodes: bool

CIP-141: Disable Subroutine Opcodes CIP-142: Transient Storage Opcodes CIP-143: MCOPY (0x5e) Opcode for Efficient Memory Copy

§cip144: bool

CIP-144: Point Evaluation Precompile from EIP-4844

§cip145: bool

CIP-145: Fix Receipts upon NotEnoughBalance Error

Implementations§

source§

impl Spec

source

pub const fn genesis_spec() -> Spec

The spec when Conflux launches the mainnet. It should never changed since the mainnet has launched.

source

pub fn wasm(&self) -> &WasmCosts

Returns wasm spec

May panic if there is no wasm spec

source

pub fn is_valid_address(&self, address: &Address) -> bool

Trait Implementations§

source§

impl Clone for Spec

source§

fn clone(&self) -> Spec

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Spec

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnwindSafe for Spec

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V