Skip to content

Commit

Permalink
feat(utxorpc): add execution cost prices to parameter mapper (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricomiles authored Dec 12, 2024
1 parent e9b7ec2 commit e20ebb6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pallas-utxorpc/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ impl<C: LedgerContext> Mapper<C> {
max_value_size: params.max_value_size.into(),
collateral_percentage: params.collateral_percentage.into(),
max_collateral_inputs: params.max_collateral_inputs.into(),
prices: Some(u5c::ExPrices {
steps: Some(u5c::RationalNumber {
numerator: params.execution_costs.step_price.numerator as i32,
denominator: params.execution_costs.step_price.denominator as u32,
}),
memory: Some(u5c::RationalNumber {
numerator: params.execution_costs.mem_price.numerator as i32,
denominator: params.execution_costs.mem_price.denominator as u32,
}),
}),
max_execution_units_per_transaction: Some(u5c::ExUnits {
memory: params.max_tx_ex_units.mem,
steps: params.max_tx_ex_units.steps,
Expand Down Expand Up @@ -117,6 +127,16 @@ impl<C: LedgerContext> Mapper<C> {
max_value_size: params.max_value_size.into(),
collateral_percentage: params.collateral_percentage.into(),
max_collateral_inputs: params.max_collateral_inputs.into(),
prices: Some(u5c::ExPrices {
steps: Some(u5c::RationalNumber {
numerator: params.execution_costs.step_price.numerator as i32,
denominator: params.execution_costs.step_price.denominator as u32,
}),
memory: Some(u5c::RationalNumber {
numerator: params.execution_costs.mem_price.numerator as i32,
denominator: params.execution_costs.mem_price.denominator as u32,
}),
}),
max_execution_units_per_transaction: Some(u5c::ExUnits {
memory: params.max_tx_ex_units.mem,
steps: params.max_tx_ex_units.steps,
Expand Down Expand Up @@ -177,6 +197,16 @@ impl<C: LedgerContext> Mapper<C> {
max_value_size: params.max_value_size.into(),
collateral_percentage: params.collateral_percentage.into(),
max_collateral_inputs: params.max_collateral_inputs.into(),
prices: Some(u5c::ExPrices {
steps: Some(u5c::RationalNumber {
numerator: params.execution_costs.step_price.numerator as i32,
denominator: params.execution_costs.step_price.denominator as u32,
}),
memory: Some(u5c::RationalNumber {
numerator: params.execution_costs.mem_price.numerator as i32,
denominator: params.execution_costs.mem_price.denominator as u32,
}),
}),
max_execution_units_per_transaction: Some(u5c::ExUnits {
memory: params.max_tx_ex_units.mem,
steps: params.max_tx_ex_units.steps,
Expand Down

0 comments on commit e20ebb6

Please sign in to comment.