-
Notifications
You must be signed in to change notification settings - Fork 12
Add ErgoTree constant replacing and template extraction
#182
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
Conversation
🦋 Changeset detectedLatest commit: 8bdd3da The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #182 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 125 123 -2
Lines 13977 14036 +59
Branches 1698 1729 +31
=========================================
+ Hits 13977 14036 +59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@fleet-sdk/blockchain-providers
@fleet-sdk/common
@fleet-sdk/compiler
@fleet-sdk/core
@fleet-sdk/crypto
@fleet-sdk/mock-chain
@fleet-sdk/serializer
@fleet-sdk/wallet
@fleet-sdk/ageusd-plugin
@fleet-sdk/babel-fees-plugin
commit: |
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.
Pull Request Overview
This PR updates the serialization and deserialization logic across the Fleet SDK packages by introducing memoization for SConstant bytes, updating the argument order for array serializer callbacks, and refactoring ErgoTree handling as part of the constant handling improvements. Key changes include:
- Adding memoization for SConstant serialization in packages/serializer.
- Updating writeArray callbacks to use the new (writer, item) parameter order in coders and serializers.
- Refactoring ErgoTree to use a SigmaByteReader-based parsing and adding constant replacement APIs.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/serializer/src/sigmaConstant.ts | Introduces memoization of serialized bytes and a new getter (bytes) for cached values. |
| packages/serializer/src/sigmaConstant.spec.ts | Updates tests to verify proper caching and behavior of the new bytes getter. |
| packages/serializer/src/serializers/* | Updates writeArray callback argument order in transaction and box serializers. |
| packages/serializer/src/coders/* | Changes writeArray callback signature and introduces a readRemainingBytes() method. |
| packages/core/src/models/ergoTree.ts | Refactors ErgoTree parsing, serialization, and constant replacement mechanisms. |
| packages/compiler/* | Updates compiler API to return ErgoTree directly and removes unused exports. |
| .changeset/* | Adjusts change logs to document new constant handling and compiler output changes. |
Comments suppressed due to low confidence (1)
packages/core/src/models/ergoTree.ts:93
- [nitpick] The early return in 'serialize()' using the cached byteReader bytes is efficient but may become a source of state inconsistency if future modifications occur in the tree without resetting the reader. Confirm that resetting '#byteReader' after state changes (as done in 'replaceConstant') covers all update scenarios.
if (this.#byteReader) return this.#byteReader.bytes;
ErgoTree constants handlingErgoTree constant replacing and template extraction
Fixes #71