-
Notifications
You must be signed in to change notification settings - Fork 23
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
evaluateTransactionExecutionUnitsShelley: return logs #555
evaluateTransactionExecutionUnitsShelley: return logs #555
Conversation
0e3e5cf
to
8baad9b
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.
You're right, it looks like evalTxExUnits
just uses evalTxExUnitsWithLogs
anyway.
I just wrote a stylistic suggestion.
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.
Nice 👍 . I agree with @palas's comment.
@@ -631,11 +631,11 @@ evaluateTransactionExecutionUnitsShelley :: forall era. () | |||
-> UTxO era | |||
-> L.Tx (ShelleyLedgerEra era) | |||
-> Either (TransactionValidityError era) | |||
(Map ScriptWitnessIndex (Either ScriptExecutionError ExecutionUnits)) | |||
(Map ScriptWitnessIndex (Either ScriptExecutionError ([Text.Text], ExecutionUnits))) |
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.
A type annotation isn't strictly necessary but it wouldn't hurt here.
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.
@Jimbo4350> do you mean something like:
type TransactionExecutionUnits = Map ScriptWitnessIndex (Either ScriptExecutionError ([Text], ExecutionUnits))
and using TransactionExecutionUnits
in evaluateTransactionExecutionUnits
?
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.
For [Text.Text]
. The rest of the signature is fine.
8baad9b
to
e881c2d
Compare
@@ -618,7 +619,7 @@ evaluateTransactionExecutionUnits :: forall era. () | |||
-> UTxO era | |||
-> TxBody era | |||
-> Either (TransactionValidityError era) | |||
(Map ScriptWitnessIndex (Either ScriptExecutionError ExecutionUnits)) | |||
(Map ScriptWitnessIndex (Either ScriptExecutionError ([Text], ExecutionUnits))) |
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.
A type synonym for [Text]
would aid in readability
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.
@Jimbo4350> added type synonym EvalTxExecutionUnitsLog
.
b3fc10b
to
854347a
Compare
(Either (L.TransactionScriptFailure (ShelleyLedgerEra era)) Alonzo.ExUnits) | ||
-> Map ScriptWitnessIndex (Either ScriptExecutionError ExecutionUnits) | ||
(Either (L.TransactionScriptFailure (ShelleyLedgerEra era)) ([Text.Text], Alonzo.ExUnits)) | ||
-> Map ScriptWitnessIndex (Either ScriptExecutionError ([Text.Text], ExecutionUnits)) |
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.
Here as well.
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.
Done 👍
fromLedgerScriptExUnitsMap aOnwards exmap = | ||
Map.fromList | ||
[ (toScriptIndex aOnwards rdmrptr, | ||
bimap (fromAlonzoScriptExecutionError aOnwards) fromAlonzoExUnits exunitsOrFailure) | ||
bimap (fromAlonzoScriptExecutionError aOnwards) (second fromAlonzoExUnits) exunitsOrFailure) |
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.
You can actually use fmap
here instead of second
.
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.
I rather not generalize this code that is involved already. I think second
better conveys the intent 👍
854347a
to
37fae81
Compare
Changelog
Context
This was asked by a user here on Slack and it makes sense, since existing callers can just ignore the new logs that are being returned; taking advantage of Haskell's lazyness.
How to trust this PR
It's returning more data
Checklist