dusk_vm/execute/config.rs
1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4//
5// Copyright (c) DUSK NETWORK. All rights reserved.
6
7/// Configuration for the execution of a transaction.
8#[derive(Debug, Clone)]
9pub struct Config {
10 /// The amount of gas points charged for each byte in a contract-deployment
11 /// bytecode.
12 pub gas_per_deploy_byte: u64,
13 /// The amount of gas points charged for each blob in a transaction.
14 pub gas_per_blob: u64,
15 /// The minimum gas points charged for a contract deployment.
16 pub min_deploy_points: u64,
17 /// The minimum gas price set for a contract deployment
18 pub min_deploy_gas_price: u64,
19 /// Enable the public sender metadata in the transaction.
20 ///
21 /// This field may be deprecated after the feature rollout.
22 pub with_public_sender: bool,
23
24 /// Enable the blob processing by the VM
25 pub with_blob: bool,
26
27 /// Disable deployment of Wasm64 contracts
28 pub disable_wasm64: bool,
29
30 /// Disable deployment of Wasm32 contracts
31 pub disable_wasm32: bool,
32
33 /// Disable calls to 3rd party contracts
34 pub disable_3rd_party: bool,
35
36 /// Disable Phoenix transactions and Phoenix-related transfer functions.
37 pub disable_phoenix: bool,
38
39 /// Enable WebAssembly reference-types in deployed contract bytecode.
40 pub with_reference_types: bool,
41
42 /// Enforce phoenix fee refund stealth address matches change note
43 pub phoenix_refund_check: bool,
44
45 /// Enforce the Boreas deploy gas rule that compares deploy charge against
46 /// remaining gas only.
47 pub deploy_remaining_gas_check: bool,
48
49 /// Charge gas consumed by the contract's `init` function during
50 /// deployment.
51 pub charge_init_gas: bool,
52
53 /// Enforce that Phoenix withdrawal replay tokens carry exactly the same
54 /// number of nullifiers as the encapsulating transaction.
55 pub withdrawal_nullifier_check: bool,
56}
57
58impl Default for Config {
59 fn default() -> Self {
60 Self::DEFAULT
61 }
62}
63
64impl Config {
65 /// Create a config with all values to default
66 pub const DEFAULT: Config = Config {
67 gas_per_deploy_byte: 0,
68 gas_per_blob: 0,
69 min_deploy_points: 0,
70 min_deploy_gas_price: 0,
71 with_public_sender: false,
72 with_blob: false,
73 disable_wasm64: false,
74 disable_wasm32: false,
75 disable_3rd_party: false,
76 disable_phoenix: false,
77 with_reference_types: false,
78 phoenix_refund_check: false,
79 deploy_remaining_gas_check: false,
80 charge_init_gas: false,
81 withdrawal_nullifier_check: false,
82 };
83}