|
1 |
| -use crate::rational_number::{ChameleonFraction, RationalNumber}; |
| 1 | +use crate::{ |
| 2 | + rational_number::{ChameleonFraction, RationalNumber}, |
| 3 | + BlockVersionData, Committee, Constitution, CostModel, DRepVotingThresholds, ExUnitPrices, |
| 4 | + ExUnits, PoolVotingThresholds, ProtocolConsts, |
| 5 | +}; |
2 | 6 | use chrono::{DateTime, Utc};
|
3 | 7 | use serde_with::serde_as;
|
4 | 8 |
|
| 9 | +#[derive(Debug, Default, PartialEq, Clone, serde::Serialize, serde::Deserialize)] |
| 10 | +pub struct ProtocolParams { |
| 11 | + pub byron: Option<ByronParams>, |
| 12 | + pub alonzo: Option<AlonzoParams>, |
| 13 | + pub shelley: Option<ShelleyParams>, |
| 14 | + pub babbage: Option<BabbageParams>, |
| 15 | + pub conway: Option<ConwayParams>, |
| 16 | +} |
| 17 | + |
5 | 18 | //
|
6 |
| -// Shelley protocol parameters |
| 19 | +// Byron protocol parameters |
7 | 20 | //
|
8 | 21 |
|
9 |
| -#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
10 |
| -#[serde(rename_all = "camelCase")] |
11 |
| -pub struct ProtocolVersion { |
12 |
| - pub minor: u64, |
13 |
| - pub major: u64, |
| 22 | +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] |
| 23 | +pub struct ByronParams { |
| 24 | + pub block_version_data: BlockVersionData, |
| 25 | + pub fts_seed: Option<Vec<u8>>, |
| 26 | + pub protocol_consts: ProtocolConsts, |
| 27 | + pub start_time: u64, |
14 | 28 | }
|
15 | 29 |
|
16 |
| -#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
17 |
| -#[serde(rename_all = "PascalCase")] |
18 |
| -pub enum NonceVariant { |
19 |
| - NeutralNonce, |
20 |
| - Nonce, |
21 |
| -} |
| 30 | +// |
| 31 | +// Alonzo protocol parameters |
| 32 | +// |
22 | 33 |
|
23 |
| -#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
24 |
| -#[serde(rename_all = "camelCase")] |
25 |
| -pub struct Nonce { |
26 |
| - pub tag: NonceVariant, |
27 |
| - pub hash: Option<Vec<u8>>, |
| 34 | +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] |
| 35 | +pub struct AlonzoParams { |
| 36 | + pub lovelace_per_utxo_word: u64, // Deprecated after transition to Babbage |
| 37 | + pub execution_prices: ExUnitPrices, |
| 38 | + pub max_tx_ex_units: ExUnits, |
| 39 | + pub max_block_ex_units: ExUnits, |
| 40 | + pub max_value_size: u32, |
| 41 | + pub collateral_percentage: u32, |
| 42 | + pub max_collateral_inputs: u32, |
| 43 | + pub plutus_v1_cost_model: Option<CostModel>, |
28 | 44 | }
|
29 | 45 |
|
| 46 | +// |
| 47 | +// Shelley protocol parameters |
| 48 | +// |
| 49 | + |
30 | 50 | #[serde_as]
|
31 | 51 | #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
32 | 52 | #[serde(rename_all = "camelCase")]
|
@@ -106,3 +126,54 @@ pub struct ShelleyParams {
|
106 | 126 | pub system_start: DateTime<Utc>,
|
107 | 127 | pub update_quorum: u32,
|
108 | 128 | }
|
| 129 | + |
| 130 | +// |
| 131 | +// Babbage protocol parameters |
| 132 | +// |
| 133 | + |
| 134 | +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] |
| 135 | +pub struct BabbageParams { |
| 136 | + pub coins_per_utxo_byte: u64, |
| 137 | + pub plutus_v2_cost_model: Option<CostModel>, |
| 138 | +} |
| 139 | + |
| 140 | +// |
| 141 | +// Conway protocol parameters |
| 142 | +// |
| 143 | + |
| 144 | +#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] |
| 145 | +pub struct ConwayParams { |
| 146 | + pub pool_voting_thresholds: PoolVotingThresholds, |
| 147 | + pub d_rep_voting_thresholds: DRepVotingThresholds, |
| 148 | + pub committee_min_size: u64, |
| 149 | + pub committee_max_term_length: u32, |
| 150 | + pub gov_action_lifetime: u32, |
| 151 | + pub gov_action_deposit: u64, |
| 152 | + pub d_rep_deposit: u64, |
| 153 | + pub d_rep_activity: u32, |
| 154 | + pub min_fee_ref_script_cost_per_byte: RationalNumber, |
| 155 | + pub plutus_v3_cost_model: CostModel, |
| 156 | + pub constitution: Constitution, |
| 157 | + pub committee: Committee, |
| 158 | +} |
| 159 | + |
| 160 | +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
| 161 | +#[serde(rename_all = "camelCase")] |
| 162 | +pub struct ProtocolVersion { |
| 163 | + pub minor: u64, |
| 164 | + pub major: u64, |
| 165 | +} |
| 166 | + |
| 167 | +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
| 168 | +#[serde(rename_all = "PascalCase")] |
| 169 | +pub enum NonceVariant { |
| 170 | + NeutralNonce, |
| 171 | + Nonce, |
| 172 | +} |
| 173 | + |
| 174 | +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] |
| 175 | +#[serde(rename_all = "camelCase")] |
| 176 | +pub struct Nonce { |
| 177 | + pub tag: NonceVariant, |
| 178 | + pub hash: Option<Vec<u8>>, |
| 179 | +} |
0 commit comments