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 /// read-only execution request queue length
27 pub readonly_queue_length: usize,
28 /// maximum time a queued read-only request may wait behind slot execution
29 /// before the execution worker serves it, even if slot work is still pending
30 pub readonly_starvation_timeout: MassaTime,
31 /// maximum number of SC output events kept in cache
32 pub max_final_events: usize,
33 /// maximum available gas for asynchronous messages execution
34 pub max_async_gas: u64,
35 /// constant cost for async messages
36 pub async_msg_cst_gas_cost: u64,
37 /// maximum gas per block
38 pub max_gas_per_block: u64,
39 /// number of threads
40 pub thread_count: u8,
41 /// price of a roll inside the network
42 pub roll_price: Amount,
43 /// extra lag to add on the execution cursor to improve performance
44 pub cursor_delay: MassaTime,
45 /// genesis timestamp
46 pub genesis_timestamp: MassaTime,
47 /// period duration
48 pub t0: MassaTime,
49 /// block creation reward
50 pub block_reward: Amount,
51 /// operation validity period
52 pub operation_validity_period: u64,
53 /// endorsement count
54 pub endorsement_count: u64,
55 /// periods per cycle
56 pub periods_per_cycle: u64,
57 /// duration of the statistics time window
58 pub stats_time_window_duration: MassaTime,
59 /// Max miss ratio for auto roll sell
60 pub max_miss_ratio: Ratio<u64>,
61 /// Max function length in call sc
62 pub max_function_length: u16,
63 /// Max parameter length in call sc
64 pub max_parameter_length: u32,
65 /// Max size of a datastore key
66 pub max_datastore_key_length: u8,
67 /// Max bytecode size
68 pub max_bytecode_size: u64,
69 /// Max datastore value size
70 pub max_datastore_value_size: u64,
71 /// Storage cost constants
72 pub storage_costs_constants: StorageCostsConstants,
73 /// Max gas for read only executions
74 pub max_read_only_gas: u64,
75 /// Gas costs
76 pub gas_costs: GasCosts,
77 /// Gas used by a transaction, a roll buy or a roll sell)
78 pub base_operation_gas_cost: u64,
79 /// last start period, used to attach to the correct execution slot if the network has restarted
80 pub last_start_period: u64,
81 /// Path to the hard drive cache storage
82 pub hd_cache_path: PathBuf,
83 /// Maximum number of entries we want to keep in the LRU cache
84 pub lru_cache_size: u32,
85 /// Maximum number of entries we want to keep in the HD cache
86 pub hd_cache_size: usize,
87 /// Amount of entries removed when `hd_cache_size` is reached
88 pub snip_amount: usize,
89 /// Number of roll to remove per denunciation
90 pub roll_count_to_slash_on_denunciation: u64,
91 /// Denunciation expire delta
92 pub denunciation_expire_periods: u64,
93 /// whether slot execution outputs broadcast is enabled
94 pub broadcast_enabled: bool,
95 /// slot execution outputs channel capacity
96 pub broadcast_slot_execution_output_channel_capacity: usize,
97 /// max size of event data, in bytes
98 pub max_event_size_v0: usize,
99 /// max size of event data, in bytes
100 pub max_event_size: usize,
101 /// chain id
102 pub chain_id: u64,
103 /// whether slot execution traces broadcast is enabled
104 pub broadcast_traces_enabled: bool,
105 /// slot execution traces channel capacity
106 pub broadcast_slot_execution_traces_channel_capacity: usize,
107 /// Max execution traces slot to keep in trace history cache
108 pub max_execution_traces_slot_limit: usize,
109 /// Where to dump blocks
110 pub block_dump_folder_path: PathBuf,
111 /// Max recursive calls depth in SC
112 /// Used to limit the recursion_counter value in the context, to avoid stack overflow issues.
113 pub max_recursive_calls_depth: u16,
114 /// Runtime condom middleware limits
115 pub condom_limits: CondomLimits,
116 /// deferred calls config
117 pub deferred_calls_config: DeferredCallsConfig,
118 /// Maximum number of event that an operation can emit
119 pub max_event_per_operation: usize,
120 /// Path to the hard drive event cache storage
121 pub event_cache_path: PathBuf,
122 /// Maximum number of entries we want to keep in the Event cache
123 pub event_cache_size: usize,
124 /// Amount of entries removed when `event_cache_size` is reached
125 pub event_snip_amount: usize,
126 /// slot execution info channel capacity
127 pub broadcast_slot_execution_info_channel_capacity: usize,
128}