Skip to content

Conversation

@arobsn
Copy link
Member

@arobsn arobsn commented May 16, 2025

Fixes #71

@changeset-bot
Copy link

changeset-bot bot commented May 16, 2025

🦋 Changeset detected

Latest commit: 8bdd3da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@fleet-sdk/serializer Minor
@fleet-sdk/core Minor
@fleet-sdk/compiler Minor
@fleet-sdk/mock-chain Minor
@fleet-sdk/wallet Minor
@fleet-sdk/ageusd-plugin Patch
@fleet-sdk/babel-fees-plugin Patch
@fleet-sdk/blockchain-providers Minor

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
Copy link

codecov bot commented May 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (824688d) to head (8bdd3da).
Report is 19 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 16, 2025

@fleet-sdk/blockchain-providers

npm i https://pkg.pr.new/@fleet-sdk/blockchain-providers@182

@fleet-sdk/common

npm i https://pkg.pr.new/@fleet-sdk/common@182

@fleet-sdk/compiler

npm i https://pkg.pr.new/@fleet-sdk/compiler@182

@fleet-sdk/core

npm i https://pkg.pr.new/@fleet-sdk/core@182

@fleet-sdk/crypto

npm i https://pkg.pr.new/@fleet-sdk/crypto@182

@fleet-sdk/mock-chain

npm i https://pkg.pr.new/@fleet-sdk/mock-chain@182

@fleet-sdk/serializer

npm i https://pkg.pr.new/@fleet-sdk/serializer@182

@fleet-sdk/wallet

npm i https://pkg.pr.new/@fleet-sdk/wallet@182

@fleet-sdk/ageusd-plugin

npm i https://pkg.pr.new/@fleet-sdk/ageusd-plugin@182

@fleet-sdk/babel-fees-plugin

npm i https://pkg.pr.new/@fleet-sdk/babel-fees-plugin@182

commit: 8bdd3da

@arobsn arobsn requested a review from Copilot May 20, 2025 21:25
Copy link

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 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;

@arobsn arobsn changed the title Add ErgoTree constants handling Add ErgoTree constant replacing and template extraction May 20, 2025
@arobsn arobsn marked this pull request as ready for review May 20, 2025 23:31
@arobsn arobsn merged commit da33768 into master May 21, 2025
16 checks passed
@arobsn arobsn deleted the arobsn/i71 branch May 21, 2025 16:58
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.

Add ErgoTree constants replacement

2 participants