Skip to content
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

tx-generator cleanups #4231

Merged
merged 3 commits into from
Aug 5, 2022
Merged

tx-generator cleanups #4231

merged 3 commits into from
Aug 5, 2022

Conversation

MarcFontaine
Copy link
Contributor

@MarcFontaine MarcFontaine commented Jul 25, 2022

  • Merge createChangeInEra with createScriptChange.
  • Make mkUTxOScript polymorphic on the era.
  • Merge runBenchmarkInEra with runPlutusBenchmark.
    runBenchmark can now create transactions that contain any mix of normal and plutus inputs.
  • Change ToUTxO era = [Lovelace] -> ([TxOut CtxTx era], TxId -> [Fund]) to
    ToUTxO era = Lovelace -> (TxOut CtxTx era, TxIx -> TxId -> Fund)
    (Deal with every output of a TX individually. Notice : The new new type is more restricted than the old version.
    This change DOES not add new capabilities (but simplifies some parts of the code )

* Merge `createChangeInEra` with `createScriptChange`.
* Make `mkUTxOScript` polymorphic on the era.
@MarcFontaine MarcFontaine force-pushed the mafo/tx-generator-planing branch 6 times, most recently from 2055ead to 80d2cd8 Compare August 4, 2022 13:17
@MarcFontaine MarcFontaine marked this pull request as ready for review August 4, 2022 13:27
@MarcFontaine MarcFontaine force-pushed the mafo/tx-generator-planing branch from 80d2cd8 to aa5d5bb Compare August 4, 2022 13:50
@@ -66,6 +69,22 @@ getFundLovelace (Fund (InAnyCardanoEra _ a)) = case _fundVal a of
TxOutAdaOnly _era l -> l
TxOutValue _era v -> selectLovelace v


Copy link
Contributor

@mgmeier mgmeier Aug 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a dummy question... if we don't actually want it, what's the motivation for ruling out era transitions in this context? Would be great if the comment could provide that info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there are two 'era's in play: The era when the fund is created (this is wrapped an InAnyCardanoEra) and the era from getFundWitness :: forall era. IsShelleyBasedEra era => Fund -> Witness WitCtxTxIn era (That is basically when trying to spend the fund.)
getFundWitness must be partial (for example it makes no sense to spend funds in an earlier era that that not support a specific feature). But the way it was done here simply enforced that both eras are the same.
That was just lazyness on my side because writing the most general possible function is clunky.
So it does not intentionally rule out era transitions but it is a feature is just not implemented at the moment.

@MarcFontaine
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Aug 5, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit b301852 into master Aug 5, 2022
@iohk-bors iohk-bors bot deleted the mafo/tx-generator-planing branch August 5, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants