Skip to content

refactor: Move stacks-codec into separate crate#6981

Merged
brice-stacks merged 5 commits intostacks-network:developfrom
jbencin-stacks:refactor/stacks-codec-crate
Apr 9, 2026
Merged

refactor: Move stacks-codec into separate crate#6981
brice-stacks merged 5 commits intostacks-network:developfrom
jbencin-stacks:refactor/stacks-codec-crate

Conversation

@jbencin-stacks
Copy link
Copy Markdown

Description

In Clarinet currently we use a copy/pasted version of stacks-codec. This is not a good way to share code, and I think the ideal way to handle it would be to publish stacks-codec on crates.io

To do this, we need to refactor stacks-codec into it's own crate, and make sure it doesn't depend on any other parts of stacks-core. This PR simply moves stacks-codec out of stacks-common and into it's own crate, while re-exporting stacks-codec from stacks-common to avoid further changes in the code that currently uses it

Applicable issues

Additional info (benefits, drawbacks, caveats)

There may be other Stacks projects in Rust which can benefit from this

Checklist

  • Test coverage for new or modified code paths
  • For new Clarity features or consensus changes, add property tests (see docs/property-testing.md)
  • Changelog is updated
  • Required documentation changes (e.g., rpc/openapi.yaml for RPC endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 12, 2026

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
7 out of 8 committers have signed the CLA.

✅ simone-stacks
✅ dhaney-stacks
✅ jacinta-stacks
✅ brice-stacks
✅ benjamin-stacks
✅ wileyj
✅ aaronb-stacks
❌ jbencin-stacks
You have signed the CLA already but the status is still pending? Let us recheck it.

@jbencin-stacks jbencin-stacks changed the base branch from master to develop March 12, 2026 16:08
jcnelson
jcnelson previously approved these changes Mar 12, 2026
Copy link
Copy Markdown
Member

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

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

LGTM as long as CI passes

@jbencin-stacks jbencin-stacks marked this pull request as ready for review March 12, 2026 16:50
@brice-stacks brice-stacks self-requested a review April 9, 2026 19:27
Copy link
Copy Markdown
Contributor

@brice-stacks brice-stacks left a comment

Choose a reason for hiding this comment

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

lgtm

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24209411066

Coverage decreased (-0.05%) to 85.666%

Details

  • Coverage decreased (-0.05%) from the base build.
  • Patch coverage: 20 uncovered changes across 1 file (114 of 134 lines covered, 85.07%).
  • 1909 coverage regressions across 65 files.

Uncovered Changes

File Changed Covered %
stacks-codec/src/lib.rs 126 106 84.13%

Coverage Regressions

1909 previously-covered lines in 65 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
stackslib/src/net/inv/epoch2x.rs 221 79.49%
stackslib/src/net/chat.rs 199 93.0%
stacks-node/src/nakamoto_node/miner.rs 130 87.39%
stackslib/src/net/api/postblock_proposal.rs 108 82.02%
stackslib/src/clarity_vm/database/marf.rs 99 60.67%
clarity/src/vm/contexts.rs 75 92.36%
clarity/src/vm/functions/database.rs 75 92.36%
stackslib/src/net/codec.rs 69 91.63%
stackslib/src/clarity_vm/database/ephemeral.rs 61 56.82%
stackslib/src/net/p2p.rs 60 75.18%

Coverage Stats

Coverage Status
Relevant Lines: 217886
Covered Lines: 186654
Line Coverage: 85.67%
Coverage Strength: 17168241.91 hits per line

💛 - Coveralls

@brice-stacks brice-stacks added this pull request to the merge queue Apr 9, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Apr 9, 2026
@brice-stacks brice-stacks added this pull request to the merge queue Apr 9, 2026
Merged via the queue into stacks-network:develop with commit 3617e52 Apr 9, 2026
324 of 330 checks passed
@jbencin-stacks jbencin-stacks deleted the refactor/stacks-codec-crate branch April 10, 2026 13:38
@github-actions
Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import stacks-codec from stacks-core

5 participants