-
Notifications
You must be signed in to change notification settings - Fork 137
Simplify txbuilder output addition #304
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
Conversation
|
Note: this will soft-conflict with the following PR because it hardcodes |
rooooooooob
left a comment
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 although @vsubhuman should check it over too since he was the one who added these convenience functions to begin with and his PR #273 touches some of this code (although from what I can see it should be fine since that PR doesn't change how the output is added for the mint+output convenience setters.)
…outputs # Conflicts: # rust/src/tx_builder.rs
vsubhuman
left a comment
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.
Great change, thank you, Seba!
vsubhuman
left a comment
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.
/check
Currently a few places in cardano-serialization-lib hardcode that no data hash is present in outputs which can lead to the incorrect minimum ADA amount being calculated.
This PR fixes these by properly tracking data hash in the tx builder.
However, I ran into a problem: the tx builder currently has a combinatorial explosion of different functions for adding outputs. Notably,
We can't just add a new optional parameter to all these functions because WASM doesn't like
Option, so the naive solution would be to double the number of functions which isn't acceptable either.To tackle this, I instead created an
TransactionOutputBuilderso that it's easier to create plainTransactionOutputobjects based on certain requirements. This simplifies the txbuilder code and also makes it easier to deal withTransactionOutputcreation on the JS-side as well