Introduce hashScriptWithPrefix which produces the ScriptHash corresponding to a SerialisedScript
The old versions of PlutusLedgerApi exposed the function scriptHash which could be used to produce the ScriptHash associated with a given SerialisedScript. The fact that the new PlutusLedgerApi does not expose such a function means these projects are forced to implement their own variant of the function (which often involves introducing crypto/hashing library dependencies) or introduce additional heavy dependencies such as CardanoApi. This PR introduces the function hashScriptWithPrefix to PlutusLedgerApi.Common so that downstream applications can avoid redundant work.
Pre-submit checklist:
- Branch
- [x] Tests are provided (if possible)
- [x] Commit sequence broadly makes sense
- [x] Key commits have useful messages
- [x] Changelog fragments have been written (if appropriate)
- [x] Relevant tickets are mentioned in commit messages
- [x] Formatting, PNG optimization, etc. are updated
- PR
- [] (For external contributions) Corresponding issue exists and is linked in the description
- [x] Targeting master unless this is a cherry-pick backport
- [x] Self-reviewed the diff
- [x] Useful pull request description
- [x] Reviewer requested
@zliu41 Who should I request for review?
@effectfully