Skip to content

Conversation

@solidsnakedev
Copy link
Collaborator

Move PlutusData hashing from `utils/Hash.hashPlutusData()` to `Data.hashData()` for better organization and discoverability.

Changes:

  • Add `Data.hashData()` function that computes blake2b-256 hash of PlutusData
  • Remove `hashPlutusData` from `utils/Hash`
  • Update test to use `Data.hashData`

Breaking Change: `hashPlutusData` removed from `utils/Hash`. Use `Data.hashData()` instead.

Copilot AI review requested due to automatic review settings January 27, 2026 19:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the PlutusData hashing functionality by moving it from utils/Hash.hashPlutusData() to Data.hashData() for better organization and discoverability. The change is a breaking change as it removes the old function entirely.

Changes:

  • Added Data.hashData() function to compute blake2b-256 hash of PlutusData
  • Removed hashPlutusData from utils/Hash module
  • Updated test to use the new Data.hashData() function
  • Updated documentation to mark the old function as deprecated and document the new function
  • Updated Address module documentation versions from v1.0.0 to v2.0.0

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/evolution/src/Data.ts Adds the new hashData function with proper documentation and examples
packages/evolution/src/utils/Hash.ts Removes the old hashPlutusData function and its import of DatumHash
packages/evolution/test/UtilsHash.CML.test.ts Updates test to use Data.hashData instead of UtilsHash.hashPlutusData
packages/evolution/docs/modules/Data.ts.md Documents the new Data.hashData function with signature and examples
packages/evolution/docs/modules/utils/Hash.ts.md Marks hashPlutusData as deprecated with strikethrough
docs/content/docs/modules/Data.mdx Documents the new Data.hashData function (MDX version)
docs/content/docs/modules/utils/Hash.mdx Marks hashPlutusData as deprecated (MDX version)
packages/evolution/docs/modules/Address.ts.md Updates version annotations from v1.0.0 to v2.0.0
docs/content/docs/modules/Address.mdx Updates version annotations from v1.0.0 to v2.0.0
.changeset/sour-lands-greet.md Documents the breaking change and provides migration examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

```ts
export declare const hashPlutusData: (pd: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The return type in the deprecated function signature is incomplete. It shows => DatumHash but should be => DatumHash.DatumHash to be consistent with other function signatures in the documentation and to correctly reference the fully qualified type.

Suggested change
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash

Copilot uses AI. Check for mistakes.
```ts
export declare const hashPlutusData: (pd: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The return type in the deprecated function signature is incomplete. It shows => DatumHash but should be => DatumHash.DatumHash to be consistent with other function signatures in the documentation and to correctly reference the fully qualified type.

Suggested change
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash
export declare const hashPlutusData: (data: Data.Data, options?: CBOR.CodecOptions) => DatumHash.DatumHash

Copilot uses AI. Check for mistakes.
## Address overview

Added in v1.0.0
Added in v2.0.0
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The Address documentation version changes from v1.0.0 to v2.0.0 appear to be unrelated to the hashPlutusData refactoring described in the PR. While these changes may be correct (as the Address.ts source code uses @SInCE 2.0.0), they are not mentioned in the PR description. Consider whether these changes should be in a separate PR or if the PR description should be updated to mention them.

Copilot uses AI. Check for mistakes.
@solidsnakedev solidsnakedev merged commit fbd4453 into main Jan 27, 2026
@solidsnakedev solidsnakedev deleted the refactor/move-hashplutusdata-to-data branch January 27, 2026 19:54
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