Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Introduce hashScriptWithPrefix which produces the ScriptHash corresponding to a SerialisedScript #6527
base: master
Are you sure you want to change the base?
Introduce hashScriptWithPrefix which produces the ScriptHash corresponding to a SerialisedScript #6527
Changes from 3 commits
7d57649
7849f35
8340890
a4ec9d5
ec56df3
f135829
5a2e532
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This way one can't pass invalid prefix?
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.
How about:
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.
This approach also makes invalid prefixes un-representable. I wouldn't stop here though:
PlutusLedgerApi.Common.hashScriptV1
move toPlutusLedgerApi.V1.hashScript
PlutusLedgerApi.Common.hashScriptV2
move toPlutusLedgerApi.V2.hashScript
PlutusLedgerApi.Common.hashScriptV3
move toPlutusLedgerApi.V3.hashScript
wdyt?
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.
Also replace this with the new functions.
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.
Yes and we probably don't need
hashScriptWithPrefix
at all, you can just copy-paste the body of that definition within eachV*
file. I'm just nitpicking though, feel free to ignore.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.
This introduces a cyclic dependency between
plutus-tx
andplutus-ledger-api
.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.
Personally I'd do what @effectfully suggests: inline the
hasScriptWithPrefix
into V1/V2/V3hashScript
s.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.
The reason I want to keep it is because
hashScriptWithPrefix
as an export is useful to me in creating and testing new language versions that I use in Midgard (optimistic rollup building on Cardano), and it will also be useful for the Hydra team for the same reason.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.
Right, so this should really exist in a
plutus-script-utils
package, which users should depend on, rather thanplutus-ledger-api
which is intended to be stuff the ledger needs. This is the reason why a number of functions similar to this one was removed fromplutus-ledger-api
in the first place. This nonetheless can be future work.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.
its unfortunate that we have to include an opaque test fixture: I'd rather prefer to include sources of the scripts and compile them with plugin together with tests. However, tests for the
plutus-ledger-api
dont use plugin, so, maybe, you can consider placing tests in the:?