Skip to content

feat: upgrade @stacks/codec to 2.1.0 for pox-5 compatibility - #355

Merged
rafa-stacks merged 3 commits into
masterfrom
pox5
Jul 10, 2026
Merged

rafa-stacks merged 3 commits into
masterfrom
pox5

Conversation

@rafa-stacks

@rafa-stacks rafa-stacks commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Two related maintenance changes for the pox-5 upgrade branch:

1. Upgrade @stacks/codec ^1.6.0^2.1.0 for 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 via codec.*. Under 1.6.0's CJS interop that default resolved to the full module namespace, so codec.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 — so codec.TxPayloadTypeID was undefined at runtime (TypeError: Cannot read properties of undefined (reading 'SmartContract')).

The subtle part: tsc passed 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.ts
  • src/token-processor/stacks-node/stacks-node-rpc-client.ts
  • src/token-processor/queue/job/update-token-supply-job.ts
  • src/token-processor/queue/job/process-token-job.ts
  • src/stacks-core/stacks-core-block-processor.ts

The 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.yml and .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:

Action Was Now
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

  • All tests pass
  • Tests added in this PR (if applicable)

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/codec from ^1.6.0 to ^2.0.0 and update lockfile accordingly.
  • Replace default codec imports 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.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/release.yml
@rafa-stacks rafa-stacks changed the title feat: upgrade @stacks/codec to 2.0.0 for pox-5 compatibility feat(pox5): upgrade @stacks/codec to 2.0.0 for pox-5 compatibility Jul 9, 2026
@rafa-stacks rafa-stacks changed the title feat(pox5): upgrade @stacks/codec to 2.0.0 for pox-5 compatibility feat: upgrade @stacks/codec to 2.1.0 for pox-5 compatibility Jul 9, 2026

@bgridley-stacks bgridley-stacks left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rafa-stacks
rafa-stacks merged commit fefc473 into master Jul 10, 2026
10 checks passed
@rafa-stacks
rafa-stacks deleted the pox5 branch July 10, 2026 16:08
@github-project-automation github-project-automation Bot moved this to ✅ Done in API Board Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants