Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break ckb-launcher and ckb-chain's cycle dependency by moving SharedPackage and SharedBuilder from ckb-launcher to ckb-shared #4236

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
eaa387d
Add `util/migrate` crate
eval-exec Nov 17, 2023
0752647
Add dependencies for `ckb-migrate`
eval-exec Nov 17, 2023
4ac28f2
Move util/launcher/migration-template into ckb-migrate
eval-exec Nov 17, 2023
d33cdc1
Move util/launcher/src/migrations into ckb-migrate
eval-exec Nov 17, 2023
b685164
Move util/launcher/src/tests.rs into ckb-migrate
eval-exec Nov 17, 2023
2fb84d5
Remove util/launcher/migration-template from ckb workspace members
eval-exec Nov 17, 2023
6c1cf99
Add util/migrate as ckb workspace members
eval-exec Nov 17, 2023
cd7cbd9
Remove migration-template from ckb-launcher's dependencies
eval-exec Nov 17, 2023
492a5ae
Add ckb-migrate as ckb-launcher's dependencies
eval-exec Nov 17, 2023
e1a4370
Add ckb-migrate as ckb-bin's dependencies
eval-exec Nov 17, 2023
5cfa069
Move util/launcher/src/migrate.rs into ckb-migrate
eval-exec Nov 17, 2023
06a3398
Remove migrate modules declaration from ckb-launcher
eval-exec Nov 17, 2023
30835d4
Include all util/migrate components to ckb-migrate
eval-exec Nov 17, 2023
9190a4b
Add migrations module for ckb-migrate
eval-exec Nov 17, 2023
07daf59
Fix ckb-launcher should use ckb-migrate
eval-exec Nov 17, 2023
ea735d7
Fix ckb-bin should use ckb-migrate
eval-exec Nov 17, 2023
545a716
Update `Cargo.lock` by `make prod`
eval-exec Nov 17, 2023
4ff1a95
Add tempfile for ckb-migrate
eval-exec Nov 17, 2023
3ea7166
Add doc for ckb-migrate
eval-exec Nov 17, 2023
e2f8e57
Remove useless dependencies from ckb-launcher
eval-exec Nov 17, 2023
2a93afe
Fix check-cargotoml.sh
eval-exec Nov 17, 2023
dfcbc99
Add `shared_builder` module for `ckb-shared`
eval-exec Nov 17, 2023
ed6ea17
Move `SharedPacakge` from `ckb-launcher` to `ckb-shared`
eval-exec Nov 17, 2023
d88c721
Move `SharedBuilder` from `ckb-launcher` to `ckb-shared`
eval-exec Nov 17, 2023
6b885a7
Move `SharedBuilder`'s helper functions to `ckb-shared`
eval-exec Nov 17, 2023
f65deec
Add dependencies for `ckb-shared`
eval-exec Nov 17, 2023
ecab91b
Remove `shared_builder` from `ckb-launcher`
eval-exec Nov 17, 2023
0d69b25
Make `ckb-shared::shared_builder` public
eval-exec Nov 17, 2023
b877518
Let `ckb-launcher` import `ckb-shared`
eval-exec Nov 17, 2023
ab2891a
Update `Cargo.lock` by `make prod`
eval-exec Nov 17, 2023
64a646a
Prevent `ckb-launcher` re-export `ckb-shared::shared_builder`
eval-exec Nov 17, 2023
cdbb1b3
Re-export `SharedPackage` and `SharedBuilder` for `ckb-shared`
eval-exec Nov 17, 2023
a2a143c
Fix `ckb_shared::SharedBuilder` usage in verification-contextual
eval-exec Nov 17, 2023
5c0504e
Fix `ckb_shared::SharedBuilder` usage in light-client-protocol-server
eval-exec Nov 17, 2023
8b4612e
Fix `ckb_shared::SharedBuilder` usage in ckb-sync
eval-exec Nov 17, 2023
3bb3242
Fix `ckb_shared::SharedBuilder` usage in ckb-rpc
eval-exec Nov 17, 2023
3001cd6
Fix `ckb_shared::SharedBuilder` usage in ckb-chain
eval-exec Nov 17, 2023
eb78eab
Fix `ckb_shared::SharedBuilder` usage in ckb-benches
eval-exec Nov 17, 2023
8f4f597
Fix `ckb_shared::SharedBuilder` usage in ckb-bin
eval-exec Nov 17, 2023
13c49d2
Update `Cargo.lock` by `make prod`
eval-exec Nov 17, 2023
ce24fc0
Execute `cargo fmt`
eval-exec Nov 18, 2023
10f85d3
Add doc for shared_builder
eval-exec Nov 18, 2023
0179847
Re-format rpc/Cargo.toml
eval-exec Nov 18, 2023
0ba97b4
`ckb-launcher` use `ckb-shared` portable and march-native feature
eval-exec Nov 18, 2023
5d8e8a1
Sort ckb's workspace members
eval-exec Nov 18, 2023
1c06193
Merge `ckb_shared`'s import statements
eval-exec Nov 20, 2023
480f1b1
Merge `ckb_shared` related import statements into one line
eval-exec Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ members = [
"error",
"util/multisig",
"util/gen-types",
"util/migrate/migration-template",
"util/types",
"util/jsonrpc-types",
"freezer",
Expand All @@ -76,6 +77,7 @@ members = [
"util/dao",
"util/reward-calculator",
"util/snapshot",
"util/migrate",
"verification/traits",
"verification",
"verification/contextual",
Expand All @@ -86,7 +88,6 @@ members = [
"sync",
"util/instrument",
"rpc",
"util/launcher/migration-template",
"util/light-client-protocol-server",
"util/launcher",
"ckb-bin"
Expand Down
1 change: 0 additions & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ckb-verification-traits = { path = "../verification/traits", version = "= 0.113.
ckb-app-config = { path = "../util/app-config", version = "= 0.113.0-pre" }
ckb-resource = { path = "../resource", version = "= 0.113.0-pre" }
ckb-network = { path = "../network", version = "= 0.113.0-pre" }
ckb-launcher = { path = "../util/launcher", version = "= 0.113.0-pre" }
tempfile.workspace = true

[[bench]]
Expand Down
3 changes: 1 addition & 2 deletions benches/benches/benchmarks/overall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use ckb_chain::chain::{ChainController, ChainService};
use ckb_chain_spec::consensus::{ConsensusBuilder, ProposalWindow};
use ckb_dao_utils::genesis_dao_data;
use ckb_jsonrpc_types::JsonBytes;
use ckb_launcher::SharedBuilder;
use ckb_network::{Flags, NetworkController, NetworkService, NetworkState};
use ckb_shared::Shared;
use ckb_shared::{Shared, SharedBuilder};
use ckb_store::ChainStore;
use ckb_types::{
bytes::Bytes,
Expand Down
3 changes: 1 addition & 2 deletions benches/benches/benchmarks/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use ckb_app_config::{BlockAssemblerConfig, TxPoolConfig};
use ckb_chain::chain::{ChainController, ChainService};
use ckb_chain_spec::{ChainSpec, IssuedCell};
use ckb_jsonrpc_types::JsonBytes;
use ckb_launcher::SharedBuilder;
use ckb_resource::Resource;
use ckb_shared::{Shared, Snapshot};
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_types::{
bytes::Bytes,
core::{
Expand Down
3 changes: 1 addition & 2 deletions benches/benches/benchmarks/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use ckb_chain_spec::consensus::{ConsensusBuilder, ProposalWindow};
use ckb_crypto::secp::Privkey;
use ckb_dao::DaoCalculator;
use ckb_dao_utils::genesis_dao_data;
use ckb_launcher::SharedBuilder;
use ckb_shared::{Shared, Snapshot};
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_store::ChainStore;
use ckb_system_scripts::BUNDLED_CELL;
use ckb_test_chain_utils::always_success_cell;
Expand Down
1 change: 0 additions & 1 deletion chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ckb-reward-calculator = { path = "../util/reward-calculator", version = "= 0.113
ckb-tx-pool = { path = "../tx-pool", version = "= 0.113.0-pre", features = ["internal"] }
ckb-jsonrpc-types = { path = "../util/jsonrpc-types", version = "= 0.113.0-pre" }
ckb-network = { path = "../network", version = "= 0.113.0-pre" }
ckb-launcher = { path = "../util/launcher", version = "= 0.113.0-pre" }
lazy_static = "1.4"
tempfile.workspace = true
ckb-systemtime = { path = "../util/systemtime", version = "= 0.113.0-pre" ,features = ["enable_faketime"]}
Expand Down
4 changes: 1 addition & 3 deletions chain/src/tests/block_assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use ckb_app_config::BlockAssemblerConfig;
use ckb_chain_spec::consensus::Consensus;
use ckb_dao_utils::genesis_dao_data;
use ckb_jsonrpc_types::ScriptHashType;
use ckb_launcher::SharedBuilder;
use ckb_shared::Shared;
use ckb_shared::Snapshot;
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_store::ChainStore;
use ckb_tx_pool::{block_assembler::CandidateUncles, PlugTarget, TxEntry};
use ckb_types::{
Expand Down
2 changes: 1 addition & 1 deletion chain/src/tests/find_fork.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::chain::{ChainService, ForkChanges};
use crate::tests::util::{MockChain, MockStore};
use ckb_chain_spec::consensus::{Consensus, ProposalWindow};
use ckb_launcher::SharedBuilder;
use ckb_shared::SharedBuilder;
use ckb_store::ChainStore;
use ckb_systemtime::unix_time_as_millis;
use ckb_types::{
Expand Down
2 changes: 1 addition & 1 deletion chain/src/tests/truncate.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::chain::ChainService;
use crate::tests::util::{MockChain, MockStore};
use ckb_chain_spec::consensus::Consensus;
use ckb_launcher::SharedBuilder;
use ckb_shared::SharedBuilder;
use ckb_store::ChainStore;
use ckb_verification_traits::Switch;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion chain/src/tests/uncle.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::chain::ChainService;
use crate::tests::util::{MockChain, MockStore};
use ckb_chain_spec::consensus::Consensus;
use ckb_launcher::SharedBuilder;
use ckb_shared::SharedBuilder;
use ckb_store::ChainStore;
use ckb_verification_traits::Switch;
use std::sync::Arc;
Expand Down
3 changes: 1 addition & 2 deletions chain/src/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use ckb_chain_spec::consensus::{Consensus, ConsensusBuilder};
use ckb_dao::DaoCalculator;
use ckb_dao_utils::genesis_dao_data;
use ckb_jsonrpc_types::ScriptHashType;
use ckb_launcher::SharedBuilder;
use ckb_network::{Flags, NetworkController, NetworkService, NetworkState};
use ckb_shared::shared::Shared;
use ckb_shared::{Shared, SharedBuilder};
use ckb_store::ChainStore;
pub use ckb_test_chain_utils::MockStore;
use ckb_test_chain_utils::{
Expand Down
1 change: 1 addition & 0 deletions ckb-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ckb-memory-tracker = { path = "../util/memory-tracker", version = "= 0.113.0-pre
ckb-chain-iter = { path = "../util/chain-iter", version = "= 0.113.0-pre" }
ckb-verification-traits = { path = "../verification/traits", version = "= 0.113.0-pre" }
ckb-async-runtime = { path = "../util/runtime", version = "= 0.113.0-pre" }
ckb-migrate = { path = "../util/migrate", version = "= 0.113.0-pre" }
ckb-launcher = { path = "../util/launcher", version = "= 0.113.0-pre" }
base64 = "0.21.0"
tempfile.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion ckb-bin/src/subcommand/export.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ckb_app_config::{ExitCode, ExportArgs};
use ckb_async_runtime::Handle;
use ckb_instrument::Export;
use ckb_launcher::SharedBuilder;
use ckb_shared::SharedBuilder;

pub fn export(args: ExportArgs, async_handle: Handle) -> Result<(), ExitCode> {
let builder = SharedBuilder::new(
Expand Down
2 changes: 1 addition & 1 deletion ckb-bin/src/subcommand/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ckb_app_config::{ExitCode, ImportArgs};
use ckb_async_runtime::Handle;
use ckb_chain::chain::ChainService;
use ckb_instrument::Import;
use ckb_launcher::SharedBuilder;
use ckb_shared::SharedBuilder;

pub fn import(args: ImportArgs, async_handle: Handle) -> Result<(), ExitCode> {
let builder = SharedBuilder::new(
Expand Down
2 changes: 1 addition & 1 deletion ckb-bin/src/subcommand/migrate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ckb_app_config::{ExitCode, MigrateArgs};
use ckb_launcher::migrate::Migrate;
use ckb_migrate::migrate::Migrate;
use is_terminal::IsTerminal;
use std::cmp::Ordering;

Expand Down
3 changes: 1 addition & 2 deletions ckb-bin/src/subcommand/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use ckb_async_runtime::Handle;
use ckb_chain::chain::ChainService;
use ckb_chain_iter::ChainIterator;
use ckb_instrument::{ProgressBar, ProgressStyle};
use ckb_launcher::SharedBuilder;
use ckb_shared::Shared;
use ckb_shared::{Shared, SharedBuilder};
use ckb_store::ChainStore;
use ckb_verification_traits::Switch;
use std::sync::Arc;
Expand Down
3 changes: 1 addition & 2 deletions ckb-bin/src/subcommand/stats.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use ckb_app_config::{ExitCode, StatsArgs};
use ckb_async_runtime::Handle;
use ckb_launcher::SharedBuilder;
use ckb_shared::Shared;
use ckb_shared::{Shared, SharedBuilder};
use ckb_store::ChainStore;
use ckb_types::{
core::{BlockNumber, ScriptHashType},
Expand Down
2 changes: 1 addition & 1 deletion rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tokio = "1"
[dev-dependencies]
reqwest = { version = "=0.11.20", features = ["blocking", "json"] }
serde = { version = "1.0", features = ["derive"] }
ckb-launcher = { path = "../util/launcher", version = "= 0.113.0-pre" }
ckb-shared = { path = "../shared", version = "= 0.113.0-pre" }
ckb-test-chain-utils = { path = "../util/test-chain-utils", version = "= 0.113.0-pre" }
tempfile.workspace = true
pretty_assertions = "1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use ckb_chain::chain::ChainService;
use ckb_chain_spec::consensus::{Consensus, ConsensusBuilder};
use ckb_chain_spec::versionbits::{ActiveMode, Deployment, DeploymentPos};
use ckb_dao_utils::genesis_dao_data;
use ckb_launcher::SharedBuilder;
use ckb_network::{Flags, NetworkService, NetworkState};
use ckb_network_alert::alert_relayer::AlertRelayer;
use ckb_notify::NotifyService;
use ckb_shared::SharedBuilder;
use ckb_sync::SyncShared;
use ckb_test_chain_utils::always_success_cell;
use ckb_types::{
Expand Down
3 changes: 1 addition & 2 deletions rpc/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ use ckb_chain::chain::{ChainController, ChainService};
use ckb_chain_spec::consensus::Consensus;
use ckb_dao::DaoCalculator;
use ckb_jsonrpc_types::ScriptHashType;
use ckb_launcher::SharedBuilder;
use ckb_network::{Flags, NetworkService, NetworkState};
use ckb_reward_calculator::RewardCalculator;
use ckb_shared::{Shared, Snapshot};
use ckb_shared::{Shared, SharedBuilder, Snapshot};
use ckb_store::ChainStore;
use ckb_test_chain_utils::{always_success_cell, always_success_cellbase};
use ckb_types::{
Expand Down
10 changes: 8 additions & 2 deletions shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ ckb-async-runtime = { path = "../util/runtime", version = "= 0.113.0-pre" }
ckb-stop-handler = { path = "../util/stop-handler", version = "= 0.113.0-pre" }
ckb-constant = { path = "../util/constant", version = "= 0.113.0-pre" }
ckb-systemtime = { path = "../util/systemtime", version = "= 0.113.0-pre" }
ckb-channel = { path = "../util/channel", version = "= 0.113.0-pre" }
ckb-app-config = {path = "../util/app-config", version = "= 0.113.0-pre"}
ckb-migrate = { path = "../util/migrate", version = "= 0.113.0-pre" }
once_cell = "1.8.0"
tempfile.workspace = true


[dev-dependencies]
ckb-systemtime = { path = "../util/systemtime", version = "= 0.113.0-pre", features = ["enable_faketime"] }

[features]
portable = ["ckb-db/portable", "ckb-store/portable", "ckb-tx-pool/portable"]
march-native = ["ckb-db/march-native", "ckb-store/march-native", "ckb-tx-pool/march-native"]
portable = ["ckb-db/portable", "ckb-store/portable", "ckb-tx-pool/portable", "ckb-migrate/portable"]
march-native = ["ckb-db/march-native", "ckb-store/march-native", "ckb-tx-pool/march-native", "ckb-migrate/march-native"]
2 changes: 2 additions & 0 deletions shared/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

// num_cpus is used in proc_macro
pub mod shared;
pub mod shared_builder;

pub use ckb_snapshot::{Snapshot, SnapshotMgr};
pub use shared::Shared;
pub use shared_builder::{SharedBuilder, SharedPackage};
Loading
Loading