massa_execution_exports/
settings.rs

1// Copyright (c) 2022 MASSA LABS <info@massa.net>
2
3//! This module provides the structures used to provide configuration parameters to the Execution system
4
5use massa_deferred_calls::config::DeferredCallsConfig;
6use massa_models::amount::Amount;
7use massa_sc_runtime::{CondomLimits, GasCosts};
8use massa_time::MassaTime;
9use num::rational::Ratio;
10use std::path::PathBuf;
11
12/// Storage cost constants
13#[derive(Debug, Clone, Copy)]
14pub struct StorageCostsConstants {
15    /// Cost per byte in ledger
16    pub ledger_cost_per_byte: Amount,
17    /// Ledger entry base cost
18    pub ledger_entry_base_cost: Amount,
19    /// Ledger entry datastore base cost
20    pub ledger_entry_datastore_base_cost: Amount,
21}
22
23/// Execution module configuration
24#[derive(Debug, Clone)]
25pub struct ExecutionConfig {
26    /// capacity of each of the two read-only request queues: the one requests are
27    /// admitted into, and the execution worker's own queue it moves them to at each
28    /// loop. Up to twice this many requests can be waiting in total.
29    pub readonly_queue_length: usize,
30    /// maximum time a queued read-only request may wait behind slot execution
31    /// before the execution worker serves it, even if slot work is still pending
32    pub readonly_starvation_timeout: MassaTime,
33    /// maximum time a read-only request may wait in the queue before its execution
34    /// starts: past it, the request is answered with a timeout error instead
35    pub readonly_queue_timeout: MassaTime,
36    /// maximum number of SC output events kept in cache
37    pub max_final_events: usize,
38    /// maximum available gas for asynchronous messages execution
39    pub max_async_gas: u64,
40    /// constant cost for async messages
41    pub async_msg_cst_gas_cost: u64,
42    /// maximum gas per block
43    pub max_gas_per_block: u64,
44    /// number of threads
45    pub thread_count: u8,
46    /// price of a roll inside the network
47    pub roll_price: Amount,
48    /// extra lag to add on the execution cursor to improve performance
49    pub cursor_delay: MassaTime,
50    /// genesis timestamp
51    pub genesis_timestamp: MassaTime,
52    /// period duration
53    pub t0: MassaTime,
54    /// block creation reward
55    pub block_reward: Amount,
56    /// operation validity period
57    pub operation_validity_period: u64,
58    /// endorsement count
59    pub endorsement_count: u64,
60    /// periods per cycle
61    pub periods_per_cycle: u64,
62    /// duration of the statistics time window
63    pub stats_time_window_duration: MassaTime,
64    /// Max miss ratio for auto roll sell
65    pub max_miss_ratio: Ratio<u64>,
66    /// Max function length in call sc
67    pub max_function_length: u16,
68    /// Max parameter length in call sc
69    pub max_parameter_length: u32,
70    /// Max size of a datastore key
71    pub max_datastore_key_length: u8,
72    /// Max bytecode size
73    pub max_bytecode_size: u64,
74    /// Max datastore value size
75    pub max_datastore_value_size: u64,
76    /// Storage cost constants
77    pub storage_costs_constants: StorageCostsConstants,
78    /// Max gas for read only executions
79    pub max_read_only_gas: u64,
80    /// Gas costs
81    pub gas_costs: GasCosts,
82    /// Gas used by a transaction, a roll buy or a roll sell)
83    pub base_operation_gas_cost: u64,
84    /// last start period, used to attach to the correct execution slot if the network has restarted
85    pub last_start_period: u64,
86    /// Path to the hard drive cache storage
87    pub hd_cache_path: PathBuf,
88    /// Maximum number of entries we want to keep in the LRU cache
89    pub lru_cache_size: u32,
90    /// Maximum number of entries we want to keep in the HD cache
91    pub hd_cache_size: usize,
92    /// Amount of entries removed when `hd_cache_size` is reached
93    pub snip_amount: usize,
94    /// Number of roll to remove per denunciation
95    pub roll_count_to_slash_on_denunciation: u64,
96    /// Denunciation expire delta
97    pub denunciation_expire_periods: u64,
98    /// whether slot execution outputs broadcast is enabled
99    pub broadcast_enabled: bool,
100    /// slot execution outputs channel capacity
101    pub broadcast_slot_execution_output_channel_capacity: usize,
102    /// max size of event data, in bytes
103    pub max_event_size_v0: usize,
104    /// max size of event data, in bytes
105    pub max_event_size: usize,
106    /// chain id
107    pub chain_id: u64,
108    /// whether slot execution traces broadcast is enabled
109    pub broadcast_traces_enabled: bool,
110    /// slot execution traces channel capacity
111    pub broadcast_slot_execution_traces_channel_capacity: usize,
112    /// Max execution traces slot to keep in trace history cache
113    pub max_execution_traces_slot_limit: usize,
114    /// Where to dump blocks
115    pub block_dump_folder_path: PathBuf,
116    /// Max recursive calls depth in SC
117    /// Used to limit the recursion_counter value in the context, to avoid stack overflow issues.
118    pub max_recursive_calls_depth: u16,
119    /// Runtime condom middleware limits
120    pub condom_limits: CondomLimits,
121    /// deferred calls config
122    pub deferred_calls_config: DeferredCallsConfig,
123    /// Maximum number of event that an operation can emit
124    pub max_event_per_operation: usize,
125    /// Path to the hard drive event cache storage
126    pub event_cache_path: PathBuf,
127    /// Maximum number of entries we want to keep in the Event cache
128    pub event_cache_size: usize,
129    /// Amount of entries removed when `event_cache_size` is reached
130    pub event_snip_amount: usize,
131    /// slot execution info channel capacity
132    pub broadcast_slot_execution_info_channel_capacity: usize,
133}