Refactor/split common#531
Merged
Merged
Conversation
8e6a8a5 to
bf869bd
Compare
bf869bd to
0d4dfe5
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the former common crate into multiple focused crates (common-core, common-runtime, common-rsk, common-broker, common-bitvmx, common-dev) and updates all consumers (services, tests, docs, and build config) to depend on the minimal subset they actually use.
Changes:
- Replaced the monolithic
crates/commonwith multiplecrates/common/*crates and updated workspace membership/lockfile accordingly. - Updated imports and Cargo dependencies across
coordinator,transaction-dispatcher,block-indexer,log-indexer, anduser-apito target the new crates (including feature-gating BitVMX broker support). - Moved shared dev/test generators into
common-devand updated docs/build-time logging defaults to match new crate names.
Reviewed changes
Copilot reviewed 98 out of 112 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/LOGGING.md | Update documentation links/paths to common-runtime logging module. |
| docs/LOCAL_SETUP.md | Update git-hook installation instructions to use common-dev. |
| docker/build/Dockerfile | Update default RUST_LOG directives to new crate names. |
| crates/user-api/src/sync_contracts_gateway.rs | Switch Address import to common-core. |
| crates/user-api/src/server.rs | Switch broker/types/runtime imports to new common-* crates. |
| crates/user-api/src/main.rs | Switch broker/runtime imports to new common-* crates. |
| crates/user-api/src/config.rs | Switch config/errors/logging types to common-runtime. |
| crates/user-api/Cargo.toml | Replace common dependency with common-broker/core/runtime. |
| crates/transaction-dispatcher/tests/runtime_sync_integration_test.rs | Switch RuntimeSync import to common-runtime. |
| crates/transaction-dispatcher/src/types.rs | Switch BitVMX/core types imports to common-bitvmx/common-core. |
| crates/transaction-dispatcher/src/rsk_gateway.rs | Switch core types imports to common-core. |
| crates/transaction-dispatcher/src/lib.rs | Switch Address/RuntimeSync imports to common-core/common-runtime. |
| crates/transaction-dispatcher/src/contracts/types.rs | Switch BitVMX type import to common-bitvmx. |
| crates/transaction-dispatcher/src/contracts/native_bridge.rs | Switch core types imports to common-core (and tests). |
| crates/transaction-dispatcher/src/contracts/interactions/deposit_aggregated_key.rs | Switch CommitteeId import to common-core in tests. |
| crates/transaction-dispatcher/src/contracts/interactions/apply_to_stream.rs | Switch BitVMX type import to common-bitvmx in tests. |
| crates/transaction-dispatcher/src/contracts/interactions/add_operator_take_tx_hash.rs | Switch TxIdParser import to common-core. |
| crates/transaction-dispatcher/src/contracts/committee_registry.rs | Switch CommitteeId import to common-core. |
| crates/transaction-dispatcher/src/config.rs | Switch config/errors/logging types to common-runtime and core types to common-core. |
| crates/transaction-dispatcher/Cargo.toml | Replace common dependency with common-bitvmx/core/runtime. |
| crates/log-indexer/tests/integration_tests.rs | Switch types to common-core, provider/indexer to common-rsk, fixtures to common-dev, config/shutdown to common-runtime. |
| crates/log-indexer/src/store.rs | Switch core types imports to common-core and fixtures to common-dev. |
| crates/log-indexer/src/notifier.rs | Switch broker/types/constants/shutdown/types to new common-* crates (and tests). |
| crates/log-indexer/src/main.rs | Switch broker/types/provider/indexer/shutdown imports to new common-* crates. |
| crates/log-indexer/src/indexer.rs | Switch provider/indexer/config/shutdown/types to new common-* crates; use resolve_initial_block helper from common-rsk. |
| crates/log-indexer/src/config.rs | Switch config/errors/types/logging imports to common-runtime/common-core. |
| crates/log-indexer/Cargo.toml | Replace common dependency with common-broker/core/rsk/runtime; add common-dev dev-dep. |
| crates/coordinator/src/user_requests.rs | Switch BitVMX/core types imports to common-bitvmx/common-core. |
| crates/coordinator/src/types.rs | Switch BitVMX/core types imports to common-bitvmx/common-core; fixtures to common-dev. |
| crates/coordinator/src/store.rs | Switch BitVMX/core types imports to common-bitvmx/common-core. |
| crates/coordinator/src/monitor.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; fixtures to common-dev. |
| crates/coordinator/src/main.rs | Switch broker/config/runtime/logging/shutdown imports to common-broker/common-runtime. |
| crates/coordinator/src/flows/pegout/pegout_processor.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update test helpers. |
| crates/coordinator/src/flows/pegout/pegout_flow.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update TxIdParser paths. |
| crates/coordinator/src/flows/pegin/pegin_processor.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update test helpers. |
| crates/coordinator/src/flows/pegin/pegin_flow.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates. |
| crates/coordinator/src/flows/operator_take/types.rs | Switch BitVMX/core types imports to common-bitvmx/common-core. |
| crates/coordinator/src/flows/operator_take/operator_take_processor.rs | Switch BitVMX/broker/core/runtime imports and trait bounds to common-broker; update core type paths. |
| crates/coordinator/src/flows/operator_take/operator_take_flow.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates. |
| crates/coordinator/src/flows/funding_info_flow.rs | Switch BitVMX/broker types imports to common-bitvmx/common-broker. |
| crates/coordinator/src/flows/common/native_bridge_verifier.rs | Switch BitVMX/core/runtime imports to new common-* crates; update core type paths. |
| crates/coordinator/src/flows/common/context.rs | Switch BitVMX/core types imports to common-bitvmx/common-core. |
| crates/coordinator/src/flows/committee/setup_committee_processor.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update test helpers. |
| crates/coordinator/src/flows/committee/setup_committee_flow.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update type paths. |
| crates/coordinator/src/flows/committee/full_penalization_setup.rs | Switch BitVMX/broker imports to common-bitvmx/common-broker. |
| crates/coordinator/src/flows/committee/dispute_core_setup.rs | Switch BitVMX/broker/core imports to new common-* crates. |
| crates/coordinator/src/flows/committee/dispute_channel_setup.rs | Switch BitVMX config/types/broker/core imports to new common-* crates. |
| crates/coordinator/src/flows/committee/common.rs | Switch BitVMX/broker/core imports to new common-* crates. |
| crates/coordinator/src/flows/btc_signature/btc_signature_subflow.rs | Switch core/runtime imports to common-core/common-runtime; fixtures to common-dev. |
| crates/coordinator/src/flows/btc_signature/btc_signature_lifecycle.rs | Switch core/runtime imports to common-core/common-runtime; fixtures to common-dev. |
| crates/coordinator/src/event_processor.rs | Switch BitVMX/core type imports to common-bitvmx/common-core. |
| crates/coordinator/src/coordinator.rs | Switch BitVMX/broker/core/runtime imports to new common-* crates; update test fixtures. |
| crates/coordinator/src/config.rs | Switch config/errors/logging/types imports to common-runtime/common-core. |
| crates/coordinator/src/blockchain_tracker.rs | Switch core types imports to common-core; fixtures to common-dev. |
| crates/coordinator/Cargo.toml | Replace common with common-bitvmx/broker/core/runtime; add common-dev dev-dep. |
| crates/common/src/msg_broker/mod.rs | Remove legacy common::msg_broker module (crate split). |
| crates/common/src/lib.rs | Remove legacy common crate root module declarations (crate split). |
| crates/common/runtime/src/shutdown_flag.rs | New ShutdownFlag implementation under common-runtime. |
| crates/common/runtime/src/runtime_sync.rs | New RuntimeSync wrapper under common-runtime (with tests). |
| crates/common/runtime/src/logging.rs | New logging/subscriber setup under common-runtime (with tests). |
| crates/common/runtime/src/lib.rs | New common-runtime crate root. |
| crates/common/runtime/src/errors.rs | New common-runtime config error type. |
| crates/common/runtime/src/config.rs | Move config loading into common-runtime; adjust project-root resolution. |
| crates/common/runtime/LICENSE | Add license file for common-runtime. |
| crates/common/runtime/Cargo.toml | Add manifest for common-runtime. |
| crates/common/rsk/tests/resources/log_response.json | Add test fixture data for common-rsk provider tests. |
| crates/common/rsk/tests/resources/block_response.json | Add test fixture data for common-rsk provider tests. |
| crates/common/rsk/src/rsk_provider.rs | Move provider traits/types to common-rsk; add resolve_initial_block. |
| crates/common/rsk/src/rsk_indexer.rs | Add RskIndexer trait to common-rsk. |
| crates/common/rsk/src/lib.rs | New common-rsk crate root. |
| crates/common/rsk/src/alloy_rsk_provider/sub.rs | Update alloy subscription code to use common-core types. |
| crates/common/rsk/src/alloy_rsk_provider/rpc.rs | Update alloy RPC provider to use common-core types and common-runtime runtime/shutdown. |
| crates/common/rsk/src/alloy_rsk_provider/mod.rs | New module declaration for common-rsk alloy provider. |
| crates/common/rsk/LICENSE | Add license file for common-rsk. |
| crates/common/rsk/Cargo.toml | Add manifest for common-rsk. |
| crates/common/dev/src/rsk_utils.rs | Move RSK test utilities to common-dev using common-core types; update doc examples. |
| crates/common/dev/src/rsk_log_generator.rs | Move log generator to common-dev using common-core types; update doc examples. |
| crates/common/dev/src/rsk_block_generator.rs | Move block generator to common-dev using common-core types; update doc examples. |
| crates/common/dev/src/mock_rsk_provider_handler.rs | Move provider mock handler to common-dev behind provider-mock feature. |
| crates/common/dev/src/lib.rs | New common-dev crate root with feature-gated mock module. |
| crates/common/dev/LICENSE | Add license file for common-dev. |
| crates/common/dev/Cargo.toml | Add manifest for common-dev (incl. cargo-husky dev-dep). |
| crates/common/core/src/types.rs | Update doc examples and adjust tests (duplicate fixtures to avoid common-dev dependency). |
| crates/common/core/src/lib.rs | New common-core crate root. |
| crates/common/core/src/constants.rs | Add shared constants (e.g., notifier period) to common-core. |
| crates/common/core/src/anvil_mocks.rs | Add anvil-only helpers under common-core feature. |
| crates/common/core/LICENSE | Add license file for common-core. |
| crates/common/core/Cargo.toml | Add manifest for common-core. |
| crates/common/Cargo.toml | Remove legacy common crate manifest (crate split). |
| crates/common/broker/src/types.rs | Update broker message types to use common-core types. |
| crates/common/broker/src/lib.rs | New common-broker crate root. |
| crates/common/broker/src/broker.rs | Feature-gate BitVMX channel behind bitvmx feature; keep Union channel available by default. |
| crates/common/broker/LICENSE | Add license file for common-broker. |
| crates/common/broker/Cargo.toml | Add manifest for common-broker. |
| crates/common/bitvmx/src/lib.rs | New common-bitvmx crate root. |
| crates/common/bitvmx/src/config.rs | Update module pathing for BitVMX config types. |
| crates/common/bitvmx/src/bitvmx_types.rs | Introduce BitVMX protocol message/types module (moved from legacy common). |
| crates/common/bitvmx/LICENSE | Add license file for common-bitvmx. |
| crates/common/bitvmx/Cargo.toml | Add manifest for common-bitvmx. |
| crates/block-indexer/tests/integration_tests.rs | Update tests to use new common-* crates and local cache module. |
| crates/block-indexer/src/store.rs | Switch types to common-core and cache to new local cache module. |
| crates/block-indexer/src/notifier.rs | Switch broker/constants/shutdown/types to new common-* crates (and tests). |
| crates/block-indexer/src/main.rs | Switch broker/types/provider/indexer/shutdown imports to new common-* crates. |
| crates/block-indexer/src/lib.rs | Export new cache module. |
| crates/block-indexer/src/indexer.rs | Switch provider/indexer/config/shutdown/types to new common-* crates; use resolve_initial_block helper. |
| crates/block-indexer/src/config.rs | Switch config/errors/logging imports to common-runtime. |
| crates/block-indexer/src/cache.rs | New in-crate LRU cache implementation replacing legacy common::cache. |
| crates/block-indexer/Cargo.toml | Replace common dependency with common-broker/core/rsk/runtime; add lru and common-dev dev-dep. |
| CONTRIBUTING.md | Update crate tier list and TxIdParser reference to common-core. |
| cli/run/src/main.rs | Update documentation comment paths for moved anvil shims. |
| Cargo.toml | Update workspace members list to new common-* crates. |
| Cargo.lock | Update lockfile to reflect new crate graph and dependencies. |
Comments suppressed due to low confidence (1)
crates/common/rsk/src/rsk_provider.rs:107
- The docstring claims this function panics when
initial_block_hashis missing/invalid, but the implementation returns an error viacontext/with_contextinstead. Please update the docs to match behavior (and/or remove the# Panicssection).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
asoto-iov
approved these changes
Jun 11, 2026
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.
🧱 Refactor: split the
commoncrate into focused cratescommonhad become a grab-bag — every service pulled the whole thing (alloy WS provider, BitVMX emulator, broker transport, test fixtures) even when it only needed a couple of types. I broke it into focused crates undercrates/common/:common-core— shared types & constantscommon-runtime— config, logging, shutdown/runtime helperscommon-rsk— Rootstock provider (alloy)common-broker— broker transport (BitVMX channel behind a feature)common-bitvmx— BitVMX message typescommon-dev— test fixtures (dev-only)Benefits:
transaction-dispatcherdrops the broker stack;user-api+ indexers no longer compile the BitVMX emulator → smaller binaries & faster per-crate buildsNo behavior changes — pure refactor. Imports stay
common_core::…etc. ✅ clippy, full tests, andcargo docall green.Description
Motivation and Context
How Has This Been Tested?
Types of changes