Skip to content

Commit

Permalink
fix(applying): add missing Conway pparams variant (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega authored Aug 25, 2024
1 parent 2d89f3d commit f32d3e4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pallas-applying/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ pub fn validate(metx: &MultiEraTx, utxos: &UTxOs, env: &Environment) -> Validati
),
_ => Err(TxAndProtParamsDiffer),
},
MultiEraProtocolParameters::Conway(_) => {
todo!("conway phase-1 validation not yet implemented");
}
}
}
41 changes: 41 additions & 0 deletions pallas-applying/src/utils/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ use pallas_primitives::{
babbage::CostMdls as BabbageCostMdls,
};

#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum MultiEraProtocolParameters {
Byron(ByronProtParams),
Shelley(ShelleyProtParams),
Alonzo(AlonzoProtParams),
Babbage(BabbageProtParams),
Conway(ConwayProtParams),
}

impl MultiEraProtocolParameters {
Expand All @@ -35,6 +37,10 @@ impl MultiEraProtocolParameters {
protocol_version: (x, ..),
..
}) => *x as usize,
MultiEraProtocolParameters::Conway(ConwayProtParams {
protocol_version: (x, ..),
..
}) => *x as usize,
}
}
}
Expand Down Expand Up @@ -136,6 +142,41 @@ pub struct BabbageProtParams {
pub extra_entropy: Nonce,
}

#[derive(Debug, Clone)]
pub struct ConwayProtParams {
pub minfee_a: u32,
pub minfee_b: u32,
pub max_block_body_size: u32,
pub max_transaction_size: u32,
pub max_block_header_size: u32,
pub key_deposit: Coin,
pub pool_deposit: Coin,
pub desired_number_of_stake_pools: u32,
pub protocol_version: ProtocolVersion,
pub min_pool_cost: Coin,
pub ada_per_utxo_byte: Coin,
pub cost_models_for_script_languages: BabbageCostMdls,
pub execution_costs: ExUnitPrices,
pub max_tx_ex_units: ExUnits,
pub max_block_ex_units: ExUnits,
pub max_value_size: u32,
pub collateral_percentage: u32,
pub max_collateral_inputs: u32,
pub expansion_rate: UnitInterval,
pub treasury_growth_rate: UnitInterval,
pub maximum_epoch: u32,
pub pool_pledge_influence: RationalNumber,
pub pool_voting_thresholds: pallas_primitives::conway::PoolVotingThresholds,
pub drep_voting_thresholds: pallas_primitives::conway::DRepVotingThresholds,
pub min_committee_size: u64,
pub committee_term_limit: u32,
pub governance_action_validity_period: u32,
pub governance_action_deposit: Coin,
pub drep_deposit: Coin,
pub drep_inactivity_period: u32,
pub minfee_refscript_cost_per_byte: UnitInterval,
}

#[derive(Debug)]
pub struct Environment {
pub prot_params: MultiEraProtocolParameters,
Expand Down

0 comments on commit f32d3e4

Please sign in to comment.