pub fn encode_set_gas_constants_script_function(
    sliding_nonce: u64,
    global_memory_per_byte_cost: u64,
    global_memory_per_byte_write_cost: u64,
    min_transaction_gas_units: u64,
    large_transaction_cutoff: u64,
    intrinsic_gas_per_byte: u64,
    maximum_number_of_gas_units: u64,
    min_price_per_gas_unit: u64,
    max_price_per_gas_unit: u64,
    max_transaction_size_in_bytes: u64,
    gas_unit_scaling_factor: u64,
    default_account_size: u64
) -> TransactionPayload
Expand description

Summary

Updates the gas constants stored on chain and used by the VM for gas metering. This transaction can only be sent from the Diem Root account.

Technical Description

Updates the on-chain config holding the DiemVMConfig and emits a DiemConfig::NewEpochEvent to trigger a reconfiguration of the system.

Parameters

NameTypeDescription
accountsignerSigner of the sending account. Must be the Diem Root account.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
global_memory_per_byte_costu64The new cost to read global memory per-byte to be used for gas metering.
global_memory_per_byte_write_costu64The new cost to write global memory per-byte to be used for gas metering.
min_transaction_gas_unitsu64The new flat minimum amount of gas required for any transaction.
large_transaction_cutoffu64The new size over which an additional charge will be assessed for each additional byte.
intrinsic_gas_per_byteu64The new number of units of gas that to be charged per-byte over the new large_transaction_cutoff.
maximum_number_of_gas_unitsu64The new maximum number of gas units that can be set in a transaction.
min_price_per_gas_unitu64The new minimum gas price that can be set for a transaction.
max_price_per_gas_unitu64The new maximum gas price that can be set for a transaction.
max_transaction_size_in_bytesu64The new maximum size of a transaction that can be processed.
gas_unit_scaling_factoru64The new scaling factor to use when scaling between external and internal gas units.
default_account_sizeu64The new default account size to use when assessing final costs for reads and writes to global storage.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::INVALID_ARGUMENTDiemVMConfig::EGAS_CONSTANT_INCONSISTENCYThe provided gas constants are inconsistent.
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTaccount is not the Diem Root account.