-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagate protocol parameters conversion errors #5197
Propagate protocol parameters conversion errors #5197
Conversation
0000b3a
to
8bfcb7f
Compare
8bfcb7f
to
456e729
Compare
08833df
to
ddceb63
Compare
cardano-api/src/Cardano/Api/Fees.hs
Outdated
bpparams = bundleProtocolParams era' pparams | ||
|
||
bpparams'e :: Either TxBodyErrorAutoBalance (BundledProtocolParameters era) | ||
bpparams'e = first (TxBodyError . TxBodyProtocolParamsConversionError) $ bundleProtocolParams era' pparams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using special characters (in this case the apostrophe) in variable names make them harder to read and understand. I was actually confused at first as I thought '
was some kind of operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a one way of encoding that the variable in scope is similar to the other one, but it's wrapped in Either
. I've changed to prefix e
to match the convention how we mark Maybe
s.
@@ -3736,20 +3741,20 @@ makeShelleyTransactionBody era@ShelleyBasedEraMary | |||
txMintValue | |||
} = do | |||
|
|||
validateTxBodyContent era txbodycontent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you have introduced a lot of unnecessary diffs by changing the indent which makes this PR harder to review because there are now semantic and non-semantic changes. Please undo the indent changes. I know the formatting in cardano-api does not adhere to the style document but if we want to change that, it's best to do that in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, indentation restored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to view by adding ?w=1
to the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I never knew that
ba26b3b
to
c1f8734
Compare
c1f8734
to
b78ed2c
Compare
Conflicts |
343caaf
to
cbc5714
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cbc5714
to
e7c17c7
Compare
e7c17c7
to
8db0d36
Compare
Where was the call to |
toLedgerPParamsUpdate :: ShelleyBasedEra era | ||
-> ProtocolParametersUpdate | ||
-> Ledger.PParamsUpdate (ShelleyLedgerEra era) | ||
toLedgerPParamsUpdate sbe = either error id . toLedgerPParamsUpdateEither sbe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh found it!
toLedgerPParams | ||
:: ShelleyBasedEra era | ||
-> ProtocolParameters | ||
-> Ledger.PParams (ShelleyLedgerEra era) | ||
toLedgerPParams era = either error id . toLedgerPParamsEither era |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, there's two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge once John is happy.
2e9e99a
to
d04f655
Compare
492eef8
to
5bb7148
Compare
b705d40
to
246af1b
Compare
246af1b
to
fa73b87
Compare
fa73b87
to
ce6891b
Compare
Description
This PR introduces an error sum type: ProtocolParametersConversionError and propagation of this type allowing for printing and handling of conversion errors, without using
error
, as it was previously.This PR is blocked by a release of the following change in
cardano-api
: IntersectMBO/cardano-api#1closes #5092
Checklist
See Runnings tests for more details
CHANGELOG.md
for affected package.cabal
files are updatedhlint
. See.github/workflows/check-hlint.yml
to get thehlint
versionstylish-haskell
. See.github/workflows/stylish-haskell.yml
to get thestylish-haskell
versionghc-8.10.7
andghc-9.2.7