feat: upgrade @stacks/codec to 2.1.0 for pox-5 compatibility - #355
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Upgrades @stacks/codec to v2.0.0 (ESM default-export behavior) and adjusts internal imports/usages so runtime decoding and enum references continue to work (pox-5 compatibility), while also updating CI/release workflows to pin GitHub Actions to specific SHAs.
Changes:
- Bump
@stacks/codecfrom^1.6.0to^2.0.0and update lockfile accordingly. - Replace default
codecimports with named imports (decode*,*TypeID, and related types) across token processing and block decoding code paths. - Pin GitHub Actions used in CI/release workflows to specific commit SHAs.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/token-processor/util/sip-validation.ts | Switches @stacks/codec usage to named imports for clarity value decoding and payload type checks. |
| src/token-processor/stacks-node/stacks-node-rpc-client.ts | Updates clarity-value typing/decoding to use named @stacks/codec exports. |
| src/token-processor/queue/job/update-token-supply-job.ts | Adjusts uint CV helper and types to use named @stacks/codec exports. |
| src/token-processor/queue/job/process-token-job.ts | Adjusts uint CV helper and types to use named @stacks/codec exports. |
| src/stacks-core/stacks-core-block-processor.ts | Updates transaction/clarity decoding to use named @stacks/codec exports. |
| package.json | Bumps @stacks/codec dependency to ^2.0.0. |
| package-lock.json | Locks @stacks/codec to 2.0.0 (and updates metadata/engines). |
| .github/workflows/release.yml | Pins actions used in release workflow to specific SHAs. |
| .github/workflows/ci.yml | Pins actions used in CI workflow to specific SHAs (and updates Codecov action pin). |
💡 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.
Description
Two related maintenance changes for the pox-5 upgrade branch:
1. Upgrade
@stacks/codec^1.6.0→^2.1.0for compatibility with the new Stacks pox-5 contract.Codec 2.x ships as proper ESM with a real
export default(the native binding functions). The repo imported it with a default import (import codec from '@stacks/codec') and then accessed both decode functions and enums viacodec.*. Under 1.6.0's CJS interop that default resolved to the full module namespace, socodec.ClarityTypeID,codec.TxPayloadTypeID, etc. worked at runtime. Under 2.x's ESM the default export contains only the decode functions — the enums are separate named exports — socodec.TxPayloadTypeIDwasundefinedat runtime (TypeError: Cannot read properties of undefined (reading 'SmartContract')).The subtle part:
tscpassed clean either way, because TypeScript still typed the default import as the full namespace. The failure only surfaced at runtime, caught by the test suite.Fixed by switching the five affected files to named imports of the specific symbols and types used:
src/token-processor/util/sip-validation.tssrc/token-processor/stacks-node/stacks-node-rpc-client.tssrc/token-processor/queue/job/update-token-supply-job.tssrc/token-processor/queue/job/process-token-job.tssrc/stacks-core/stacks-core-block-processor.tsThe subsequent bump from 2.0.0 → 2.1.0 was a drop-in upgrade with no API changes and no further code edits.
2. Pin all GitHub Actions to commit SHAs in
.github/workflows/ci.ymland.github/workflows/release.yml, hardening the CI/release supply chain. Each action is pinned to a full commit SHA with its version as a trailing comment, and bumped to its latest release in the process:actions/checkout@v6@9c091bb(v7.0.0)actions/setup-node@v6@48b55a0(v6.4.0)actions/cache@v5@55cc834(v6.1.0)codecov/codecov-action@v5@fb8b358(v7.0.0)docker/setup-qemu-action@v4@96fe6ef(v4.2.0)docker/setup-buildx-action@v4@bb05f3f(v4.2.0)docker/metadata-action@v6@dc80280(v6.2.0)docker/login-action@v4@af1e73f(v4.4.0)docker/build-push-action@v7@53b7df9(v7.3.0)Breaking change?
No. Internal-only changes; no public API or behavior changes.
Checklist
🤖 Generated with Claude Code