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 7, 2022
1 parent 0cd6878 commit 2343b86
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 47 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger
tag: 0913292b13963ae4b60136eddb8d18b137f96a21
--sha256: 19rrnvvplvg8v989bcv6vpjwvblfa0m65izxkcp8dclf0a914qq3
tag: 65292694de72f137e6b90c5f361ae7646b48775f
--sha256: 05m1c7v8a2797675gkagpzl6bcjnj7w6lnx5x7hf90847ap88b05
subdir:
eras/alonzo/impl
eras/alonzo/test-suite
Expand Down
2 changes: 2 additions & 0 deletions cardano-api/gen/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ genProtocolParameters =
<*> Gen.maybe genNat
<*> Gen.maybe genNat
<*> Gen.maybe genNat
<*> Gen.maybe genLovelace

genProtocolParametersUpdate :: Gen ProtocolParametersUpdate
genProtocolParametersUpdate = do
Expand Down Expand Up @@ -795,6 +796,7 @@ genProtocolParametersUpdate = do
protocolUpdateMaxValueSize <- Gen.maybe genNat
protocolUpdateCollateralPercent <- Gen.maybe genNat
protocolUpdateMaxCollateralInputs <- Gen.maybe genNat
protocolUpdateUTxOCostPerByte <- Gen.maybe genLovelace
pure ProtocolParametersUpdate{..}


Expand Down
11 changes: 11 additions & 0 deletions cardano-api/src/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,10 @@ data TxBodyErrorAutoBalance =
-- word parameter, for eras that use this parameter.
| TxBodyErrorMissingParamCostPerWord

-- | The 'ProtocolParameters' must provide the value for the cost per
-- byte parameter, for eras that use this parameter.
| TxBodyErrorMissingParamCostPerByte

-- | The transaction validity interval is too far into the future.
-- See 'TransactionValidityIntervalError' for details.
| TxBodyErrorValidityInterval TransactionValidityError
Expand Down Expand Up @@ -859,6 +863,9 @@ instance Error TxBodyErrorAutoBalance where
displayError TxBodyErrorMissingParamCostPerWord =
"The utxoCostPerWord protocol parameter is required but missing"

displayError TxBodyErrorMissingParamCostPerByte =
"The utxoCostPerByte protocol parameter is required but missing"

displayError (TxBodyErrorValidityInterval err) =
displayError err

Expand Down Expand Up @@ -1260,6 +1267,7 @@ calculateMinimumUTxO era txout@(TxOut _ v _ _) pparams' =
data MinimumUTxOError =
PParamsMinUTxOMissing
| PParamsUTxOCostPerWordMissing
| PParamsUTxOCostPerByteMissing
deriving Show

instance Error MinimumUTxOError where
Expand All @@ -1269,3 +1277,6 @@ instance Error MinimumUTxOError where
displayError PParamsUTxOCostPerWordMissing =
"\"utxoCostPerWord\" field not present in protocol parameters when \
\trying to calculate minimum UTxO value."
displayError PParamsUTxOCostPerByteMissing =
"\"utxoCostPerByte\" field not present in protocol parameters when \
\trying to calculate minimum UTxO value."
Loading

0 comments on commit 2343b86

Please sign in to comment.