1use std::sync::LazyLock;
16
17use pallas_primitives::conway::CostModels;
18
19use crate::{
20 DRepVotingThresholds, ExUnitPrices, ExUnits, GlobalParameters, PROTOCOL_VERSION_9, PoolVotingThresholds,
21 ProtocolParameters, RationalNumber, Slot,
22};
23
24pub static MAINNET_GLOBAL_PARAMETERS: LazyLock<GlobalParameters> = LazyLock::new(|| {
25 let consensus_security_param = 2160;
26 let active_slot_coeff_inverse = 20;
27 let epoch_length_scale_factor = 10;
28 let epoch_length = active_slot_coeff_inverse * epoch_length_scale_factor * consensus_security_param;
29 let system_start = 1506203091000; GlobalParameters {
31 consensus_security_param,
32 epoch_length_scale_factor,
33 active_slot_coeff_inverse,
34 max_lovelace_supply: 45_000_000_000_000_000,
35 slots_per_kes_period: 129_600,
36 max_kes_evolution: 62,
37 epoch_length,
38 stability_window: Slot::from((active_slot_coeff_inverse * consensus_security_param * 3) as u64),
39 randomness_stabilization_window: (4 * consensus_security_param * active_slot_coeff_inverse) as u64,
40 system_start,
41 }
42});
43
44pub static PREPROD_GLOBAL_PARAMETERS: LazyLock<GlobalParameters> = LazyLock::new(|| {
45 let consensus_security_param = 2160;
46 let active_slot_coeff_inverse = 20;
47 let epoch_length_scale_factor = 10;
48 let epoch_length = active_slot_coeff_inverse * epoch_length_scale_factor * consensus_security_param;
49 let system_start = 1654041600000; GlobalParameters {
51 consensus_security_param,
52 epoch_length_scale_factor,
53 active_slot_coeff_inverse,
54 max_lovelace_supply: 45_000_000_000_000_000,
55 slots_per_kes_period: 129_600,
56 max_kes_evolution: 62,
57 epoch_length,
58 stability_window: Slot::from((active_slot_coeff_inverse * consensus_security_param * 3) as u64),
59 randomness_stabilization_window: (4 * consensus_security_param * active_slot_coeff_inverse) as u64,
60 system_start,
61 }
62});
63
64pub static PREPROD_INITIAL_PROTOCOL_PARAMETERS: LazyLock<ProtocolParameters> = LazyLock::new(|| {
66 ProtocolParameters {
67 protocol_version: PROTOCOL_VERSION_9,
68 min_fee_a: 44,
69 min_fee_b: 155381,
70 max_block_body_size: 90112,
71 max_transaction_size: 16384,
72 max_block_header_size: 1100,
73 max_tx_ex_units: ExUnits { mem: 14_000_000, steps: 10_000_000_000 },
74 max_block_ex_units: ExUnits { mem: 62_000_000, steps: 20_000_000_000 },
75 max_value_size: 5000,
76 max_collateral_inputs: 3,
77 stake_credential_deposit: 2_000_000,
78 stake_pool_deposit: 500_000_000,
79 lovelace_per_utxo_byte: 4310,
80 prices: ExUnitPrices {
81 mem_price: RationalNumber { numerator: 577, denominator: 10_000 },
82 step_price: RationalNumber { numerator: 721, denominator: 10_000_000 },
83 },
84 min_fee_ref_script_lovelace_per_byte: RationalNumber { numerator: 15, denominator: 1 },
85 max_ref_script_size_per_tx: 200 * 1024,
88
89 max_ref_script_size_per_block: 1024 * 1024,
92
93 ref_script_cost_stride: 25600,
96
97 ref_script_cost_multiplier: RationalNumber { numerator: 12, denominator: 10 },
100 stake_pool_max_retirement_epoch: 18,
101 pledge_influence: RationalNumber { numerator: 3, denominator: 10 },
102 optimal_stake_pools_count: 500,
103 treasury_expansion_rate: RationalNumber { numerator: 2, denominator: 10 },
104 monetary_expansion_rate: RationalNumber { numerator: 3, denominator: 1_000 },
105 min_pool_cost: 340000000,
106 collateral_percentage: 150,
107 cost_models: CostModels {
108 plutus_v1: Some(vec![
109 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
110 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
111 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
112 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32,
113 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1,
114 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1, 90434,
115 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 270652, 22588, 4,
116 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32,
117 24588, 32, 20744, 32, 25933, 32, 24623, 32, 53384111, 14333, 10,
118 ]),
119 plutus_v2: Some(vec![
120 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
121 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
122 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
123 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32,
124 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1,
125 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1, 90434,
126 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 955506, 213312, 0, 2,
127 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498,
128 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10, 43574283,
129 26308, 10,
130 ]),
131 plutus_v3: Some(vec![
132 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
133 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
134 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 549, 57,
135 85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000,
136 60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1,
137 43285, 552, 1, 44749, 541, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848,
138 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900,
139 1716, 549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 955506, 213312,
140 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32,
141 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10,
142 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1, 52538055, 3756, 18,
143 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36,
144 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318,
145 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1, 100181, 726, 719, 0, 1,
146 100181, 726, 719, 0, 1, 100181, 726, 719, 0, 1, 107878, 680, 0, 1, 95336, 1, 281145, 18848, 0, 1,
147 180194, 159, 1, 1, 158519, 8942, 0, 1, 159378, 8813, 0, 1, 107490, 3298, 1, 106057, 655, 1, 1964219,
148 24520, 3,
149 ]),
150 },
151 pool_voting_thresholds: PoolVotingThresholds {
152 motion_no_confidence: RationalNumber { numerator: 51, denominator: 100 },
153 committee_normal: RationalNumber { numerator: 51, denominator: 100 },
154 committee_no_confidence: RationalNumber { numerator: 51, denominator: 100 },
155 hard_fork_initiation: RationalNumber { numerator: 51, denominator: 100 },
156 security_voting_threshold: RationalNumber { numerator: 51, denominator: 100 },
157 },
158 drep_voting_thresholds: DRepVotingThresholds {
159 motion_no_confidence: RationalNumber { numerator: 51, denominator: 100 },
160 committee_normal: RationalNumber { numerator: 67, denominator: 100 },
161 committee_no_confidence: RationalNumber { numerator: 67, denominator: 100 },
162 update_constitution: RationalNumber { numerator: 6, denominator: 10 },
163 hard_fork_initiation: RationalNumber { numerator: 75, denominator: 100 },
164 pp_network_group: RationalNumber { numerator: 6, denominator: 10 },
165 pp_economic_group: RationalNumber { numerator: 67, denominator: 100 },
166 pp_technical_group: RationalNumber { numerator: 67, denominator: 100 },
167 pp_governance_group: RationalNumber { numerator: 75, denominator: 100 },
168 treasury_withdrawal: RationalNumber { numerator: 67, denominator: 100 },
169 },
170 min_committee_size: 7,
171 max_committee_term_length: 146,
172 gov_action_lifetime: 6,
173 gov_action_deposit: 100_000_000_000,
174 drep_deposit: 500_000_000,
175 drep_expiry: 20,
176 }
177});
178
179pub static PREVIEW_GLOBAL_PARAMETERS: LazyLock<GlobalParameters> = LazyLock::new(|| {
180 let consensus_security_param = 432;
181 let active_slot_coeff_inverse = 20;
182 let epoch_length_scale_factor = 10;
183 let epoch_length = active_slot_coeff_inverse * epoch_length_scale_factor * consensus_security_param;
184 let stability_window = Slot::from((active_slot_coeff_inverse * consensus_security_param * 3) as u64);
185 let randomness_stabilization_window = (4 * consensus_security_param * active_slot_coeff_inverse) as u64;
186 let system_start = 1666656000000; GlobalParameters {
189 consensus_security_param,
190 epoch_length_scale_factor,
191 active_slot_coeff_inverse,
192 max_lovelace_supply: 45_000_000_000_000_000,
193 slots_per_kes_period: 129_600,
194 max_kes_evolution: 62,
195 epoch_length,
196 stability_window,
197 randomness_stabilization_window,
198 system_start,
199 }
200});
201
202pub static PREVIEW_INITIAL_PROTOCOL_PARAMETERS: LazyLock<ProtocolParameters> = LazyLock::new(|| {
204 ProtocolParameters {
205 protocol_version: PROTOCOL_VERSION_9,
206 min_fee_a: 44,
207 min_fee_b: 155381,
208 max_block_body_size: 65536,
209 max_transaction_size: 16384,
210 max_block_header_size: 1100,
211 max_tx_ex_units: ExUnits { mem: 10_000_000, steps: 10_000_000_000 },
212 max_block_ex_units: ExUnits { mem: 50_000_000, steps: 40_000_000_000 },
213 max_value_size: 5000,
214 max_collateral_inputs: 3,
215 stake_credential_deposit: 2_000_000,
216 stake_pool_deposit: 500_000_000,
217 lovelace_per_utxo_byte: 4310,
218 prices: ExUnitPrices {
219 mem_price: RationalNumber { numerator: 577, denominator: 10_000 },
220 step_price: RationalNumber { numerator: 721, denominator: 10_000_000 },
221 },
222 min_fee_ref_script_lovelace_per_byte: RationalNumber { numerator: 15, denominator: 1 },
223 max_ref_script_size_per_tx: 200 * 1024,
226
227 max_ref_script_size_per_block: 1024 * 1024,
230
231 ref_script_cost_stride: 25600,
234
235 ref_script_cost_multiplier: RationalNumber { numerator: 12, denominator: 10 },
238 stake_pool_max_retirement_epoch: 18,
239 pledge_influence: RationalNumber { numerator: 3, denominator: 10 },
240 optimal_stake_pools_count: 500,
241 treasury_expansion_rate: RationalNumber { numerator: 2, denominator: 10 },
242 monetary_expansion_rate: RationalNumber { numerator: 3, denominator: 1_000 },
243 min_pool_cost: 340000000,
244 collateral_percentage: 150,
245 cost_models: CostModels {
246 plutus_v1: Some(vec![
247 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
248 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
249 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
250 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32,
251 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1,
252 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1, 90434,
253 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 270652, 22588, 4,
254 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32,
255 24588, 32, 20744, 32, 25933, 32, 24623, 32, 53384111, 14333, 10,
256 ]),
257 plutus_v2: Some(vec![
258 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
259 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
260 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 228465, 122, 0, 1, 1, 1000, 42921, 4,
261 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32,
262 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1,
263 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 228465, 122, 0, 1, 1, 90434,
264 519, 0, 1, 74433, 32, 85848, 228465, 122, 0, 1, 1, 85848, 228465, 122, 0, 1, 1, 955506, 213312, 0, 2,
265 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498,
266 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10, 43574283,
267 26308, 10,
268 ]),
269 plutus_v3: Some(vec![
270 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000,
271 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32,
272 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 549, 57,
273 85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000,
274 60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1,
275 43285, 552, 1, 44749, 541, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848,
276 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900,
277 1716, 549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 955506, 213312,
278 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32,
279 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10,
280 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1, 52538055, 3756, 18,
281 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36,
282 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318,
283 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1,
284 ]),
285 },
286 pool_voting_thresholds: PoolVotingThresholds {
287 motion_no_confidence: RationalNumber { numerator: 51, denominator: 100 },
288 committee_normal: RationalNumber { numerator: 51, denominator: 100 },
289 committee_no_confidence: RationalNumber { numerator: 51, denominator: 100 },
290 hard_fork_initiation: RationalNumber { numerator: 51, denominator: 100 },
291 security_voting_threshold: RationalNumber { numerator: 51, denominator: 100 },
292 },
293 drep_voting_thresholds: DRepVotingThresholds {
294 motion_no_confidence: RationalNumber { numerator: 67, denominator: 100 },
295 committee_normal: RationalNumber { numerator: 67, denominator: 100 },
296 committee_no_confidence: RationalNumber { numerator: 67, denominator: 100 },
297 update_constitution: RationalNumber { numerator: 75, denominator: 100 },
298 hard_fork_initiation: RationalNumber { numerator: 75, denominator: 100 },
299 pp_network_group: RationalNumber { numerator: 67, denominator: 100 },
300 pp_economic_group: RationalNumber { numerator: 67, denominator: 100 },
301 pp_technical_group: RationalNumber { numerator: 67, denominator: 100 },
302 pp_governance_group: RationalNumber { numerator: 75, denominator: 100 },
303 treasury_withdrawal: RationalNumber { numerator: 67, denominator: 100 },
304 },
305 min_committee_size: 0,
306 max_committee_term_length: 365,
307 gov_action_lifetime: 30,
308 gov_action_deposit: 100_000_000_000,
309 drep_deposit: 500_000_000,
310 drep_expiry: 20,
311 }
312});
313
314pub static TESTNET_GLOBAL_PARAMETERS: LazyLock<GlobalParameters> = LazyLock::new(|| {
315 let consensus_security_param = 432;
316 let active_slot_coeff_inverse = 20;
317 let epoch_length_scale_factor = 10;
318 let epoch_length = active_slot_coeff_inverse * epoch_length_scale_factor * consensus_security_param;
319 let system_start = 1666656000000; GlobalParameters {
322 consensus_security_param,
323 epoch_length_scale_factor,
324 active_slot_coeff_inverse,
325 max_lovelace_supply: 45_000_000_000_000_000,
326 slots_per_kes_period: 129_600,
327 max_kes_evolution: 62,
328 epoch_length,
329 stability_window: Slot::from((active_slot_coeff_inverse * consensus_security_param * 2) as u64),
330 randomness_stabilization_window: (4 * consensus_security_param * active_slot_coeff_inverse) as u64,
331 system_start,
332 }
333});