feat/upgrade modules 9#41
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a comprehensive upgrade to the Effect Schema library (module version 9) across the evolution package. The changes modernize the schema definitions, update API usage patterns, and refactor type structures for better consistency and performance.
Key changes include:
- Migration from legacy schema APIs to newer Schema patterns (e.g.,
Schema.BigIntFromSelf→Schema.BigInt) - Consolidation of byte transformation schemas using built-in
Schema.Uint8ArrayFromHexpatterns - Refactoring of native script handling with new TaggedClass structure and improved CBOR encoding
- Updates to Data module with proper recursive schema handling and runtime type definitions
Reviewed Changes
Copilot reviewed 87 out of 87 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/evolution/src/core/NativeScripts.ts | Complete rewrite with TaggedClass structure and improved CBOR handling |
| packages/evolution/src/core/Data.ts | Updated with proper recursive schemas and runtime vs encoded type separation |
| packages/evolution/src/core/Transaction.ts | New complete transaction CBOR serialization implementation |
| packages/evolution/src/core/Function.ts | Enhanced error handling with proper stack traces |
| packages/evolution/src/core/TransactionWitnessSet.ts | Improved CBOR map handling and witness set parsing |
| Multiple byte modules | Simplified to use Schema.Uint8ArrayFromHex instead of custom transformations |
| Multiple core modules | Updated to use Schema.BigInt instead of Schema.BigIntFromSelf |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| it("property: Evolution SDK CBOR matches CML CBOR for any generated TransactionOutput", () => { | ||
| FastCheck.assert( | ||
| FastCheck.property(TransactionOutput.arbitrary(), (evOut) => { | ||
| FastCheck.property(TransactionOutput.arbitrary, (evOut) => { |
There was a problem hiding this comment.
The function call is missing parentheses. It should be TransactionOutput.arbitrary() to invoke the function that returns the FastCheck.Arbitrary.
| FastCheck.property(TransactionOutput.arbitrary, (evOut) => { | |
| FastCheck.property(TransactionOutput.arbitrary(), (evOut) => { |
| const invalidHexCases = ["not-hex", "xyz", "123g", "deadbeef ", " deadbeef", "0x123456"] | ||
|
|
||
| it.each(invalidHexCases)("should fail schema validation on invalid hex string: %s", (input) => { | ||
| expect(Data.isBytes(input)).toBe(false) |
There was a problem hiding this comment.
This test is checking Data.isBytes(input) with a raw string input, but according to the updated Data module, isBytes expects a Uint8Array. The test should create a proper Data.bytearray() instance or use a different validation approach.
| expect(Data.isBytes(input)).toBe(false) | |
| expect(() => Data.bytearray(input)).toThrow() |
No description provided.