fix: optimize Hash implementations and update tests for ExUnits class#57
Merged
Conversation
- Optimize Hash.symbol implementations to use minimal hashing strategy: - BootstrapWitness: only hash publicKey (identifying field) - ExUnitPrices: only hash memPrice - ExUnits: only hash mem - PoolVotingThresholds: only hash t1 - DRepVotingThresholds: only hash t1 - Redeemer: only hash tag + index - All Hash implementations use Hash.cached() for performance - Fix computeTotalExUnits to use ExUnits class properties instead of tuple - Fix Redeemer creation in TxBuilderImpl to use ExUnits class constructor - Fix assetsToValue to build MultiAsset map correctly without using empty() - Update all test files to use ExUnits class properties (.mem, .steps) instead of tuple indexing - Update all test files to access MultiAsset via .map property - Remove @example blocks from core modules (ProtocolVersion, TSchema, PoolParams) - All 652 tests passing
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements documentation generation improvements by updating generated API documentation to reflect new class-based schemas with enhanced equality and hash implementations. The changes primarily involve:
- Addition of
[Equal.symbol]and[Hash.symbol]method documentation for all class-based schemas - Addition of
toJSON,toString, and[Inspectable.NodeInspectSymbol]method documentation - Removal of deprecated error classes, constructors, and utility functions from documentation
- Standardization of function signatures (e.g.,
input→data,a, etc.) - Migration from tuple-based to class-based representations for types like
ExUnits,UnitInterval, andNonnegativeInterval
Reviewed Changes
Copilot reviewed 122 out of 288 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| VrfVkey.ts.md | Added symbol method documentation, removed error classes |
| VrfKeyHash.ts.md | Added symbol method documentation, removed error classes |
| VrfCert.ts.md | Added symbol method documentation for VRFOutput and VRFProof |
| VotingProcedures.ts.md | Added symbol methods, removed constructor utilities |
| Value.ts.md | Added symbol methods for OnlyCoin and WithAssets classes |
| TransactionWitnessSet.ts.md | Added symbol methods for TransactionWitnessSet and VKeyWitness |
| TransactionOutput.ts.md | Added symbol methods, updated method names |
| TransactionInput.ts.md | Added symbol methods, removed error classes |
| Transaction.ts.md | Added symbol methods, removed error classes |
| Redeemer.ts.md | Migrated ExUnits from tuple to class, added symbol methods |
| ProtocolParamUpdate.ts.md | Migrated ExUnits/ExUnitPrices to classes, added symbol methods |
| ProposalProcedures.ts.md | Added symbol methods, removed constructors |
| ProposalProcedure.ts.md | Added symbol methods, removed error classes |
| MultiAsset.ts.md | Migrated to class-based schema with symbol methods |
| NonnegativeInterval.ts.md | Migrated from tuple to class-based schema |
| UnitInterval.ts.md | Migrated from tuple to class-based schema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes Transaction CBOR roundtrip equality issues and optimizes Hash implementations throughout the codebase.
Changes
Hash Optimization
Hash.symbolimplementations to use minimal hashing strategy:publicKey(identifying field)memPricememt1t1tag+indexHash.cached()for performanceExUnits Class Migration
computeTotalExUnitsto use ExUnits class properties instead of tuple.mem,.steps) instead of tuple indexingMultiAsset Fixes
assetsToValueto build MultiAsset map correctly without usingempty().mappropertyDocumentation
Test Results
✅ All 652 tests passing
✅ No linting errors
✅ Documentation generation successful