Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
515 changes: 445 additions & 70 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ p2p = { version = "0.7.0", package = "tentacle", default-features = false }
parking_lot = "0.12"
paste = "1.0"
path-clean = "0.1.0"
postgresql_embedded = { version = "0.18", default-features = false, features = ["blocking", "theseus"] }
pretty_assertions = "1.3.0"
proc-macro2 = "1.0"
prometheus = "0.13.3"
Expand Down Expand Up @@ -310,6 +311,8 @@ yansi = "0.5"
seq-macro = "0.3"
strum = { version = "0.27", features = ["derive"] }
phf = { version = "0.12", features = ["macros"] }
tracing = { version = "0.1.41", features = ["log", "log-always"] }
tracing-subscriber = "0.3.20"

[profile.release]
overflow-checks = true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CKB_FEATURES ?= deadlock_detection,with_sentry
ALL_FEATURES := deadlock_detection,with_sentry,with_dns_seeding,profiling,march-native
CKB_BENCH_FEATURES ?= ci
CKB_BUILD_TARGET ?=
INTEGRATION_RUST_LOG := info,ckb_test=debug,ckb_sync=debug,ckb_relay=debug,ckb_network=debug
INTEGRATION_RUST_LOG := info
CARGO_TARGET_DIR ?= $(shell pwd)/target
BINARY_NAME ?= "ckb"
COV_PROFRAW_DIR = ${CARGO_TARGET_DIR}/cov
Expand Down
2 changes: 2 additions & 0 deletions ckb-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ is-terminal.workspace = true
fdlimit.workspace = true
ckb-stop-handler.workspace = true
tokio = { workspace = true, features = ["sync"] }
tracing.workspace = true
tracing-subscriber.workspace = true

[target.'cfg(not(target_os="windows"))'.dependencies]
daemonize = { version = "0.5.0" }
Expand Down
2 changes: 2 additions & 0 deletions ckb-bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn run_app(version: Version) -> Result<(), ExitCode> {
unsafe {
::std::env::set_var("RUST_BACKTRACE", "full");
}
// tracing_subscriber::fmt::init();

let (bin_name, app_matches) = cli::get_bin_name_and_matches(&version);
if let Some((cli, matches)) = app_matches.subcommand() {
Expand Down Expand Up @@ -133,6 +134,7 @@ fn run_app_inner(
let setup = Setup::from_matches(bin_name, cmd, matches)?;
let _guard = SetupGuard::from_setup(&setup, &version, handle.clone(), is_silent_logging)?;

info!("run app inner.............................");
raise_fd_limit();

let ret = match cmd {
Expand Down
3 changes: 3 additions & 0 deletions rpc/src/service_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use ckb_app_config::{DBConfig, IndexerConfig, RpcConfig};
use ckb_chain::ChainController;
use ckb_indexer::IndexerService;
use ckb_indexer_sync::{PoolService, new_secondary_db};
use ckb_logger::{debug, info};
use ckb_network::NetworkController;
use ckb_network_alert::{notifier::Notifier as AlertNotifier, verifier::Verifier as AlertVerifier};
use ckb_pow::Pow;
Expand Down Expand Up @@ -227,6 +228,8 @@ impl<'a> ServiceBuilder<'a> {

if self.config.rich_indexer_enable() {
// Init rich-indexer service
info!("Rich Indexer enabled");
debug!("Rich Indexer enabled");
let mut rich_indexer = RichIndexerService::new(
ckb_secondary_db,
pool_service,
Expand Down
5 changes: 4 additions & 1 deletion test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version.workspace = true
license = "MIT"
authors = ["Nervos Core Dev <[email protected]>"]
edition = "2024"
description = "CKB integration tests."
description = "ckb integration tests."
homepage = "https://github.com/nervosnetwork/ckb"
repository = "https://github.com/nervosnetwork/ckb"

Expand Down Expand Up @@ -40,6 +40,9 @@ byteorder.workspace = true
jsonrpc-core.workspace = true
ctrlc.workspace = true
log.workspace = true
postgresql_embedded.workspace = true
tracing.workspace = true
tracing-subscriber.workspace = true

[target.'cfg(not(target_os="windows"))'.dependencies]
nix = { version = "0.29.0", default-features = false, features = ["signal"] }
Expand Down
4 changes: 4 additions & 0 deletions test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ pub fn main_test() {
env::set_var("RUST_BACKTRACE", "full");
}

// tracing_subscriber::fmt::init();

let clap_app = clap_app();
let matches = clap_app.get_matches();

Expand Down Expand Up @@ -636,6 +638,8 @@ fn all_specs() -> Vec<Box<dyn Spec>> {
Box::new(CheckVmBExtension),
Box::new(RandomlyKill),
Box::new(SyncChurn),
// Rich-indexer chain reorganization bug reproduction test
Box::new(RichIndexerUncleBlockBug::default()),
];
specs.shuffle(&mut thread_rng());
specs
Expand Down
27 changes: 14 additions & 13 deletions test/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ impl Node {
"--ba-advanced",
])
.stdin(Stdio::null())
.stdout(Stdio::null())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
.expect("failed to run binary");
Expand Down Expand Up @@ -793,18 +793,19 @@ impl Node {

pub fn wait_find_unverified_blocks_finished(&self) {
// wait for node[0] to find unverified blocks finished

let now = std::time::Instant::now();
while !self
.access_log(|line: &str| line.contains("find unverified blocks finished"))
.expect("node[0] must have log")
{
std::thread::sleep(std::time::Duration::from_secs(1));
if now.elapsed() > Duration::from_secs(60) {
panic!("node[0] should find unverified blocks finished in 60s");
}
info!("waiting for node[0] to find unverified blocks finished");
}
std::thread::sleep(Duration::from_secs(5));

// let now = std::time::Instant::now();
// while !self
// .access_log(|line: &str| line.contains("find unverified blocks finished"))
// .expect("node[0] must have log")
// {
// std::thread::sleep(std::time::Duration::from_secs(1));
// if now.elapsed() > Duration::from_secs(60) {
// panic!("node[0] should find unverified blocks finished in 60s");
// }
// info!("waiting for node[0] to find unverified blocks finished");
// }
}

pub fn access_log<F>(&self, line_checker: F) -> io::Result<bool>
Expand Down
14 changes: 11 additions & 3 deletions test/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ use ckb_error::AnyError;
use ckb_jsonrpc_types::{
Alert, BannedAddr, Block, BlockEconomicState, BlockFilter, BlockNumber, BlockTemplate,
BlockView, Capacity, CellWithStatus, ChainInfo, EpochNumber, EpochView, EstimateCycles,
HeaderView, LocalNode, OutPoint, PoolTxDetailInfo, RawTxPool, RemoteNode, SyncState, Timestamp,
Transaction, TransactionProof, TransactionWithStatusResponse, TxPoolInfo, Uint32, Uint64,
Version,
HeaderView, IndexerTip, LocalNode, OutPoint, PoolTxDetailInfo, RawTxPool, RemoteNode,
SyncState, Timestamp, Transaction, TransactionProof, TransactionWithStatusResponse, TxPoolInfo,
Uint32, Uint64, Version,
};
use ckb_types::core::{
BlockNumber as CoreBlockNumber, Capacity as CoreCapacity, EpochNumber as CoreEpochNumber,
Expand Down Expand Up @@ -128,6 +128,12 @@ impl RpcClient {
.expect("rpc call get_current_epoch")
}

pub fn get_indexer_tip(&self) -> Option<IndexerTip> {
self.inner
.get_indexer_tip()
.expect("rpc call get_indexer_tip")
}

pub fn get_epoch_by_number(&self, number: CoreEpochNumber) -> Option<EpochView> {
self.inner
.get_epoch_by_number(number.into())
Expand Down Expand Up @@ -392,4 +398,6 @@ jsonrpc!(
pub fn notify_transaction(&self, tx: Transaction) -> H256;
pub fn tx_pool_ready(&self) -> bool;
pub fn get_pool_tx_detail_info(&self, _hash: H256) -> PoolTxDetailInfo;

pub fn get_indexer_tip(&self) -> Option<IndexerTip>;
});
Loading
Loading