massa_deferred_calls/
config.rs

1use massa_models::{
2    amount::Amount,
3    config::{
4        DEFERRED_CALL_BASE_FEE_MAX_CHANGE_DENOMINATOR, DEFERRED_CALL_CST_GAS_COST,
5        DEFERRED_CALL_GLOBAL_OVERBOOKING_PENALTY, DEFERRED_CALL_MAX_ASYNC_GAS,
6        DEFERRED_CALL_MAX_FUTURE_SLOTS, DEFERRED_CALL_MAX_POOL_CHANGES, DEFERRED_CALL_MIN_GAS_COST,
7        DEFERRED_CALL_MIN_GAS_INCREMENT, DEFERRED_CALL_SLOT_OVERBOOKING_PENALTY,
8        LEDGER_COST_PER_BYTE, MAX_FUNCTION_NAME_LENGTH, MAX_PARAMETERS_SIZE, THREAD_COUNT,
9    },
10};
11use serde::Deserialize;
12
13#[derive(Debug, Clone, Copy, Deserialize)]
14pub struct DeferredCallsConfig {
15    /// thread count
16    pub thread_count: u8,
17    /// max function name length
18    pub max_function_name_length: u16,
19    /// Maximum size of deferred call future slots (1 week)
20    pub max_future_slots: u64,
21    /// base fee max max change denominator
22    pub base_fee_max_max_change_denominator: usize,
23    /// min gas increment (1 nanomassa)
24    pub min_gas_increment: u64,
25    /// min gas cost (10 nanomassa)
26    pub min_gas_cost: u64,
27    /// call gas cost
28    pub call_cst_gas_cost: u64,
29    /// global overbooking penalty
30    pub global_overbooking_penalty: Amount,
31    /// slot overbooking penalty
32    pub slot_overbooking_penalty: Amount,
33
34    /// max parameter size
35    pub max_parameter_size: u32,
36
37    pub max_pool_changes: u64,
38
39    pub max_gas: u64,
40
41    pub ledger_cost_per_byte: Amount,
42}
43
44impl Default for DeferredCallsConfig {
45    fn default() -> Self {
46        Self {
47            thread_count: THREAD_COUNT,
48            max_function_name_length: MAX_FUNCTION_NAME_LENGTH,
49            max_future_slots: DEFERRED_CALL_MAX_FUTURE_SLOTS,
50            max_parameter_size: MAX_PARAMETERS_SIZE,
51            max_pool_changes: DEFERRED_CALL_MAX_POOL_CHANGES,
52            max_gas: DEFERRED_CALL_MAX_ASYNC_GAS,
53            base_fee_max_max_change_denominator: DEFERRED_CALL_BASE_FEE_MAX_CHANGE_DENOMINATOR,
54            min_gas_increment: DEFERRED_CALL_MIN_GAS_INCREMENT,
55            min_gas_cost: DEFERRED_CALL_MIN_GAS_COST,
56            global_overbooking_penalty: DEFERRED_CALL_GLOBAL_OVERBOOKING_PENALTY,
57            slot_overbooking_penalty: DEFERRED_CALL_SLOT_OVERBOOKING_PENALTY,
58            call_cst_gas_cost: DEFERRED_CALL_CST_GAS_COST,
59            ledger_cost_per_byte: LEDGER_COST_PER_BYTE,
60        }
61    }
62}