Skip to content

Commit

Permalink
Add utxoCostPerByte parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jul 8, 2022
1 parent 7725ccd commit 4c1c6e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Cardano/CLI/Run/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ friendlyProtocolParametersUpdate
, protocolUpdateMaxTxExUnits
, protocolUpdateMaxValueSize
, protocolUpdatePrices
, protocolUpdateUTxOCostPerByte
} =
object . catMaybes $
[ protocolUpdateProtocolVersion <&> \(major, minor) ->
Expand Down Expand Up @@ -262,14 +263,16 @@ friendlyProtocolParametersUpdate
("monetary expansion" .=) . friendlyRational
, protocolUpdateTreasuryCut <&> ("treasury expansion" .=) . friendlyRational
, protocolUpdateUTxOCostPerWord <&>
("UTxO storage cost per unit" .=) . friendlyLovelace
("UTxO storage cost per word" .=) . friendlyLovelace
, protocolUpdateCollateralPercent <&>
("collateral inputs share" .=) . (<> "%") . textShow
, protocolUpdateMaxBlockExUnits <&> ("max block execution units" .=)
, protocolUpdateMaxCollateralInputs <&> ("max collateral inputs" .=)
, protocolUpdateMaxTxExUnits <&> ("max transaction execution units" .=)
, protocolUpdateMaxValueSize <&> ("max value size" .=)
, protocolUpdatePrices <&> ("execution prices" .=) . friendlyPrices
, protocolUpdateUTxOCostPerByte <&>
("UTxO storage cost per byte" .=) . friendlyLovelace
]

friendlyPrices :: ExecutionUnitPrices -> Aeson.Value
Expand Down
9 changes: 9 additions & 0 deletions src/Cardano/CLI/Shelley/Parsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2903,6 +2903,7 @@ pProtocolParametersUpdate =
<*> optional pMaxValueSize
<*> optional pCollateralPercent
<*> optional pMaxCollateralInputs
<*> optional pUTxOCostPerByte

pCostModels :: Parser FilePath
pCostModels =
Expand Down Expand Up @@ -3062,6 +3063,14 @@ pUTxOCostPerWord =
<> Opt.help "Cost in lovelace per unit of UTxO storage (from Alonzo era)."
)

pUTxOCostPerByte :: Parser Lovelace
pUTxOCostPerByte =
Opt.option (readerFromParsecParser parseLovelace)
( Opt.long "utxo-cost-per-byte"
<> Opt.metavar "LOVELACE"
<> Opt.help "Cost in lovelace per unit of UTxO storage (from Babbage era)."
)

pExecutionUnitPrices :: Parser ExecutionUnitPrices
pExecutionUnitPrices = ExecutionUnitPrices
<$> Opt.option readRational
Expand Down
2 changes: 1 addition & 1 deletion test/data/golden/alonzo/transaction-view.out
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ update proposal:
updates:
- genesis key hash: 1bafa294233a5a7ffbf539ae798da0943aa83d2a19398c2d0e5af114
update:
UTxO storage cost per unit: 194 Lovelace
UTxO storage cost per word: 194 Lovelace
collateral inputs share: 200%
execution prices:
memory: 196/197
Expand Down

0 comments on commit 4c1c6e2

Please sign in to comment.