Struct cfx_vm_types::Spec

source ·
pub struct Spec {
Show 89 fields 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 cold_sload_gas: usize, pub sstore_set_gas: usize, pub sstore_reset_gas: usize, pub sstore_refund_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 init_code_data_limit: usize, pub init_code_word_gas: usize, pub tx_gas: usize, pub tx_create_gas: usize, pub tx_data_zero_gas: usize, pub tx_data_non_zero_gas: usize, pub tx_data_floor_zero_gas: usize, pub tx_data_floor_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 cold_account_access_cost: usize, pub warm_access_gas: usize, pub suicide_to_new_account_cost: usize, pub sub_gas_cap_divisor: Option<usize>, pub blockhash_gas: usize, pub evm_gas_ratio: usize, pub per_auth_base_cost: usize, pub per_empty_account_cost: 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, pub cip150: bool, pub cip151: bool, pub cip152: bool, pub cip154: bool, pub cip7702: bool, pub cip645: CIP645Spec, pub eip2935: bool, pub eip7623: bool, pub align_evm: bool, pub cip_c2_fix: bool,
}
Expand description

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

Fields§

§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

§cold_sload_gas: usize

Gas price for loading from storage. Code sload gas after CIP-645f: EIP-2929

§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)

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

§init_code_data_limit: usize

Maximum init code size (CIP-645i: EIP-3860)

§init_code_word_gas: usize

Init code word size (CIP-645i: EIP-3860)

§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

§tx_data_floor_zero_gas: usize

Floor gas cost from empty data transaction (EIP-7623)

§tx_data_floor_non_zero_gas: usize

Floor gas cost from non-empty data transaction (EIP-7623)

§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§cold_account_access_cost: usize§warm_access_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;

§blockhash_gas: usize

Blockhash instruction gas cost.

§evm_gas_ratio: usize

The magnification of gas storage occupying related operaions.

§per_auth_base_cost: usize

PER_AUTH_BASE_COST in CIP-7702

§per_empty_account_cost: usize

PER_EMPTY_ACCOUNT_COST in CIP-7702

§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

CIP-1559: Fee Market Change for Conflux

§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

§cip150: bool

CIP-150: Reject New Contract Code Starting with the 0xEF byte

§cip151: bool

CIP-151: SELFDESTRUCT only in Same Transaction

§cip152: bool

CIP-152: Reject Transactions from Senders with Deployed Code

§cip154: bool

CIP-154: Fix Inconsistent Implementation of TLOAD

§cip7702: bool

CIP-7702: Set Code for EOA

§cip645: CIP645Spec

CIP-645: Align Conflux Gas Pricing with EVM

§eip2935: bool

EIP-2935: Serve historical block hashes from state

§eip7623: bool

EIP-7623: Increase calldata cost

§align_evm: bool§cip_c2_fix: bool

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 sload_gas(&self) -> usize

source

pub fn overwrite_gas_plan_by_cip(&mut self)

source

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

source

pub const fn to_consensus_spec(&self) -> ConsensusGasSpec

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 Freeze for Spec

§

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