Skip to content

refactor: Remove code from components/stacks-codec#2360

Open
jbencin-stacks wants to merge 2 commits intostx-labs:mainfrom
jbencin-stacks:refactor/remove-local-stacks-codec
Open

refactor: Remove code from components/stacks-codec#2360
jbencin-stacks wants to merge 2 commits intostx-labs:mainfrom
jbencin-stacks:refactor/remove-local-stacks-codec

Conversation

@jbencin-stacks
Copy link
Copy Markdown
Contributor

@jbencin-stacks jbencin-stacks commented Apr 13, 2026

Description

I'm working towards removing as much of components/stacks-codec as possible. Most of it is code duplicated from stacks-network/stacks-core.

This PR removes some of that code, but additional refactoring of stacks-core will be needed to remove more of it

Breaking change?

No

Example

Removes a lot of code
image

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 55.55556% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
components/stacks-codec/src/codec.rs 0.00% 39 Missing ⚠️
...omponents/stacks-network/src/chains_coordinator.rs 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jbencin-stacks jbencin-stacks marked this pull request as ready for review April 13, 2026 20:47
Copy link
Copy Markdown

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 reduces reliance on the duplicated components/stacks-codec implementations by switching multiple crates to use transaction types from stackslib (stacks-core) and relocating the contract-call transaction builder into stacks-rpc-client.

Changes:

  • Replace stacks_codec::codec::* transaction type usage with stackslib::chainstate::stacks::* in rpc-client and observer.
  • Move build_contract_call_transaction out of stacks-codec and into stacks-rpc-client::crypto, updating call sites.
  • Remove/trim duplicated code from components/stacks-codec, and adjust crate dependencies/features accordingly.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
components/stacks-rpc-client/src/rpc_client.rs Switches transaction imports from stacks-codec to stackslib.
components/stacks-rpc-client/src/crypto.rs Replaces codec imports with stackslib types and adds build_contract_call_transaction.
components/stacks-rpc-client/Cargo.toml Drops stacks-codec dependency and adds stackslib.
components/stacks-network/src/chains_coordinator.rs Updates contract-call tx builder call sites to use stacks-rpc-client.
components/stacks-network/Cargo.toml Removes stacks-codec dependency.
components/stacks-codec/src/codec.rs Deletes substantial duplicated functionality/types, keeping only what’s still needed.
components/observer/src/indexer/stacks/mod.rs Switches transaction imports from stacks-codec to stackslib.
components/observer/Cargo.toml Makes stacks-codec optional and ties it to the stacks-signers feature; adds stackslib.
components/clarinet-deployments/src/onchain/mod.rs Switches transaction/string types from stacks-codec to stackslib.
components/clarinet-deployments/Cargo.toml Drops stacks-codec dependency and adds stackslib.
Cargo.lock Lockfile updates reflecting dependency graph changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/stacks-rpc-client/src/crypto.rs
Comment thread components/clarinet-deployments/src/onchain/mod.rs
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.

3 participants