dusk-vm 1.7.0

The VM to run smart contracts on the Dusk network
Documentation
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) DUSK NETWORK. All rights reserved.

/// Configuration for the execution of a transaction.
#[derive(Debug, Clone)]
pub struct Config {
    /// The amount of gas points charged for each byte in a contract-deployment
    /// bytecode.
    pub gas_per_deploy_byte: u64,
    /// The amount of gas points charged for each blob in a transaction.
    pub gas_per_blob: u64,
    /// The minimum gas points charged for a contract deployment.
    pub min_deploy_points: u64,
    /// The minimum gas price set for a contract deployment
    pub min_deploy_gas_price: u64,
    /// Enable the public sender metadata in the transaction.
    ///
    /// This field may be deprecated after the feature rollout.
    pub with_public_sender: bool,

    /// Enable the blob processing by the VM
    pub with_blob: bool,

    /// Disable deployment of Wasm64 contracts
    pub disable_wasm64: bool,

    /// Disable deployment of Wasm32 contracts
    pub disable_wasm32: bool,

    /// Disable calls to 3rd party contracts
    pub disable_3rd_party: bool,

    /// Disable Phoenix transactions and Phoenix-related transfer functions.
    pub disable_phoenix: bool,

    /// Enable WebAssembly reference-types in deployed contract bytecode.
    pub with_reference_types: bool,

    /// Enforce phoenix fee refund stealth address matches change note
    pub phoenix_refund_check: bool,

    /// Enforce the Boreas deploy gas rule that compares deploy charge against
    /// remaining gas only.
    pub deploy_remaining_gas_check: bool,

    /// Charge gas consumed by the contract's `init` function during
    /// deployment.
    pub charge_init_gas: bool,

    /// Enforce that Phoenix withdrawal replay tokens carry exactly the same
    /// number of nullifiers as the encapsulating transaction.
    pub withdrawal_nullifier_check: bool,
}

impl Default for Config {
    fn default() -> Self {
        Self::DEFAULT
    }
}

impl Config {
    /// Create a config with all values to default
    pub const DEFAULT: Config = Config {
        gas_per_deploy_byte: 0,
        gas_per_blob: 0,
        min_deploy_points: 0,
        min_deploy_gas_price: 0,
        with_public_sender: false,
        with_blob: false,
        disable_wasm64: false,
        disable_wasm32: false,
        disable_3rd_party: false,
        disable_phoenix: false,
        with_reference_types: false,
        phoenix_refund_check: false,
        deploy_remaining_gas_check: false,
        charge_init_gas: false,
        withdrawal_nullifier_check: false,
    };
}