Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7360f5f
switched fetch service to use chainindex
idky137 Oct 9, 2025
d61043c
started updating tests
idky137 Oct 9, 2025
817ec8f
Merge remote-tracking branch 'idky137/chain_index_integration' into c…
idky137 Oct 9, 2025
f350b4d
merge conflicts
idky137 Oct 10, 2025
e759789
Merge branch 'dev' into chain_index_integration
idky137 Oct 10, 2025
d0ef046
solve merge conflicts with #638
Oscar-Pepper Nov 6, 2025
11a4845
Merge branch 'dev' into chain_index_integration
nachog00 Nov 6, 2025
a456f96
Fix incorrect mapping in get_raw_mempool
nachog00 Nov 7, 2025
0b3cafe
Update tokio test flavor to multi_thread in fetch_service.rs
nachog00 Nov 7, 2025
0bca530
Enable multi-threaded tests in local_cache.rs
nachog00 Nov 7, 2025
38df2d4
Update test annotation for address deltas
nachog00 Nov 7, 2025
8d72122
Specify Tokio test flavor in state_service.rs
nachog00 Nov 7, 2025
b1ed08f
Fix transaction hash byte order in get_mempool_tx test
nachog00 Nov 7, 2025
a281c29
Merge pull request #655 from zingolabs/fix/653
Oscar-Pepper Nov 7, 2025
ffb0d08
Merge pull request #657 from zingolabs/fix/656
Oscar-Pepper Nov 7, 2025
becd057
Merge pull request #660 from zingolabs/fix/659
Oscar-Pepper Nov 7, 2025
c361bd2
Merge branch 'dev' into chain_index_integration
Oscar-Pepper Nov 7, 2025
bda476c
Merge branch 'dev' into chain_index_integration
nachog00 Nov 7, 2025
eebf3f6
fix incorrect test assertion of key heap usage
Oscar-Pepper Nov 10, 2025
06ce056
replace remaining fixed delays with polling to fix last failing tests
Oscar-Pepper Nov 10, 2025
368558b
Merge remote-tracking branch 'zingolabs/chain_index_integration' into…
Oscar-Pepper Nov 10, 2025
d15568b
enable zaino for failing tests
Oscar-Pepper Nov 10, 2025
32cf7d2
Merge branch 'dev' into chain_index_integration
nachog00 Dec 4, 2025
f4a9500
Merge branch 'dev' into chain_index_integration
nachog00 Dec 11, 2025
89fb3be
Merge branch 'dev' into chain_index_integration
nachog00 Dec 12, 2025
fb8857d
Merge branch 'dev' into chain_index_integration
nachog00 Dec 12, 2025
837bd6b
Merge dev into chain_index_integration
nachog00 Dec 19, 2025
1e89508
Merged doc-comments
fluidvanadium Jan 27, 2026
e38f122
fixed zaino-state/src/chain_index/tests/proptest_blockgen.rs
idky137 Feb 2, 2026
811d04f
merge conflicts
idky137 Feb 2, 2026
d7661b0
updated ChainIndex::get_compact_block
idky137 Feb 2, 2026
e685085
added compact block streamer to chain index, switched fetchservice to…
idky137 Feb 2, 2026
e340d17
test and bug fixes
idky137 Feb 3, 2026
08ffe1e
fixed get_transparent_data_from_compact_block_when_requested
idky137 Feb 3, 2026
0804fb5
Merge pull request #815 from idky137/chain_index_integration
nachog00 Feb 3, 2026
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
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ serde_json = { workspace = true, features = ["preserve_order"] }
futures.workspace = true
tempfile.workspace = true
tower = { workspace = true, features = ["buffer", "util"] }
hex = { workspace = true }

# Runtime
tokio = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/chain_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod chain_query_interface {
)
.await
.unwrap();
let index_reader = chain_index.subscriber().await;
let index_reader = chain_index.subscriber();
tokio::time::sleep(Duration::from_secs(3)).await;

(
Expand Down Expand Up @@ -209,7 +209,7 @@ mod chain_query_interface {
)
.await
.unwrap();
let index_reader = chain_index.subscriber().await;
let index_reader = chain_index.subscriber();
tokio::time::sleep(Duration::from_secs(3)).await;

(test_manager, json_service, None, chain_index, index_reader)
Expand Down
66 changes: 39 additions & 27 deletions integration-tests/tests/fetch_service.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
//! These tests compare the output of `FetchService` with the output of `JsonRpcConnector`.

use futures::StreamExt as _;
use hex::ToHex as _;
use zaino_fetch::jsonrpsee::connector::{test_node_and_return_url, JsonRpSeeConnector};
use zaino_proto::proto::compact_formats::CompactBlock;
use zaino_proto::proto::service::{
AddressList, BlockId, BlockRange, GetAddressUtxosArg, GetMempoolTxRequest, GetSubtreeRootsArg,
PoolType, TransparentAddressBlockFilter, TxFilter,
};
use zaino_state::ChainIndex;
use zaino_state::FetchServiceSubscriber;
#[allow(deprecated)]
use zaino_state::{FetchService, LightWalletIndexer, StatusType, ZcashIndexer};
Expand Down Expand Up @@ -316,22 +318,30 @@ pub async fn test_get_mempool_info<V: ValidatorExt>(validator: &ValidatorKind) {
let info = fetch_service_subscriber.get_mempool_info().await.unwrap();

// Derive expected values directly from the current mempool contents.
let entries = fetch_service_subscriber.mempool.get_mempool().await;

let keys = fetch_service_subscriber
.indexer
.get_mempool_txids()
.await
.unwrap();

let values = fetch_service_subscriber
.indexer
.get_mempool_transactions(Vec::new())
.await
.unwrap();

// Size
assert_eq!(info.size, entries.len() as u64);
assert_eq!(info.size, values.len() as u64);
assert!(info.size >= 1);

// Bytes: sum of SerializedTransaction lengths
let expected_bytes: u64 = entries
.iter()
.map(|(_, value)| value.serialized_tx.as_ref().as_ref().len() as u64)
.sum();
let expected_bytes: u64 = values.iter().map(|entry| entry.len() as u64).sum();

// Key heap bytes: sum of txid String capacities
let expected_key_heap_bytes: u64 = entries
let expected_key_heap_bytes: u64 = keys
.iter()
.map(|(key, _)| key.txid.capacity() as u64)
.map(|key| key.encode_hex::<String>().capacity() as u64)
.sum();

let expected_usage = expected_bytes.saturating_add(expected_key_heap_bytes);
Expand Down Expand Up @@ -527,12 +537,12 @@ async fn fetch_service_get_address_tx_ids<V: ValidatorExt>(validator: &Validator
.generate_blocks_and_poll_indexer(1, &fetch_service_subscriber)
.await;

let chain_height = fetch_service_subscriber
.block_cache
.get_chain_height()
.await
.unwrap()
.0;
let chain_height: u32 = fetch_service_subscriber
.indexer
.snapshot_nonfinalized_state()
.best_tip
.height
.into();
dbg!(&chain_height);

let fetch_service_txids = fetch_service_subscriber
Expand Down Expand Up @@ -1168,11 +1178,10 @@ async fn fetch_service_get_block_range_returns_all_pools<V: ValidatorExt>(

assert_eq!(compact_block.height, end_height);

let expected_transaction_count = if matches!(validator, ValidatorKind::Zebrad) {
3
} else {
4 // zcashd uses shielded coinbase which will add an extra compact tx
};
// Transparent tx are now included in compact blocks unless specified so the
// expected block count should be 4 (3 sent tx + coinbase)
let expected_transaction_count = 4;

// the compact block has the right number of transactions
assert_eq!(compact_block.vtx.len(), expected_transaction_count);

Expand Down Expand Up @@ -1557,12 +1566,12 @@ async fn fetch_service_get_taddress_txids<V: ValidatorExt>(validator: &Validator
.generate_blocks_and_poll_indexer(1, &fetch_service_subscriber)
.await;

let chain_height = fetch_service_subscriber
.block_cache
.get_chain_height()
.await
.unwrap()
.0;
let chain_height: u32 = fetch_service_subscriber
.indexer
.snapshot_nonfinalized_state()
.best_tip
.height
.into();
dbg!(&chain_height);

let block_filter = TransparentAddressBlockFilter {
Expand Down Expand Up @@ -1735,8 +1744,11 @@ async fn fetch_service_get_mempool_tx<V: ValidatorExt>(validator: &ValidatorKind
let mut sorted_fetch_mempool_tx = fetch_mempool_tx.clone();
sorted_fetch_mempool_tx.sort_by_key(|tx| tx.txid.clone());

// Transaction IDs from quick_send are already in internal byte order,
// which matches what the mempool returns, so no reversal needed
let tx1_bytes = *tx_1.first().as_ref();
let tx2_bytes = *tx_2.first().as_ref();

let mut sorted_txids = [tx1_bytes, tx2_bytes];
sorted_txids.sort_by_key(|hash| *hash);

Expand Down Expand Up @@ -2363,7 +2375,7 @@ mod zcashd {
fetch_service_get_lightd_info::<Zcashd>(&ValidatorKind::Zcashd).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
pub(crate) async fn get_network_sol_ps() {
assert_fetch_service_getnetworksols_matches_rpc::<Zcashd>(&ValidatorKind::Zcashd).await;
}
Expand Down Expand Up @@ -2592,7 +2604,7 @@ mod zebrad {
fetch_service_get_lightd_info::<Zebrad>(&ValidatorKind::Zebrad).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
pub(crate) async fn get_network_sol_ps() {
assert_fetch_service_getnetworksols_matches_rpc::<Zebrad>(&ValidatorKind::Zebrad).await;
}
Expand Down
30 changes: 21 additions & 9 deletions integration-tests/tests/json_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use zaino_common::{DatabaseConfig, ServiceConfig, StorageConfig};

#[allow(deprecated)]
use zaino_state::{
FetchService, FetchServiceConfig, FetchServiceSubscriber, ZcashIndexer, ZcashService as _,
ChainIndex, FetchService, FetchServiceConfig, FetchServiceSubscriber, ZcashIndexer,
ZcashService as _,
};
use zaino_testutils::from_inputs;
use zaino_testutils::{TestManager, ValidatorKind};
Expand Down Expand Up @@ -627,11 +628,11 @@ async fn get_address_tx_ids_inner() {
.await;

let chain_height = zcashd_subscriber
.block_cache
.get_chain_height()
.await
.unwrap()
.0;
.indexer
.snapshot_nonfinalized_state()
.best_tip
.height
.into();
dbg!(&chain_height);

let zcashd_txids = zcashd_subscriber
Expand Down Expand Up @@ -836,7 +837,13 @@ mod zcashd {

assert_eq!(zcashd_mining_info, zaino_mining_info);

test_manager.local_net.generate_blocks(1).await.unwrap();
generate_blocks_and_poll_all_chain_indexes(
1,
&test_manager,
zaino_subscriber.clone(),
zcashd_subscriber.clone(),
)
.await;
}

test_manager.close().await;
Expand Down Expand Up @@ -917,8 +924,13 @@ mod zcashd {
const BLOCK_LIMIT: u32 = 10;

for i in 0..BLOCK_LIMIT {
test_manager.local_net.generate_blocks(1).await.unwrap();
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
generate_blocks_and_poll_all_chain_indexes(
1,
&test_manager,
zaino_subscriber.clone(),
zcashd_subscriber.clone(),
)
.await;

let block = zcashd_subscriber
.z_get_block(i.to_string(), Some(1))
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/tests/local_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ mod zcashd {
launch_local_cache::<Zcashd>(&ValidatorKind::Zcashd).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn process_100_blocks() {
launch_local_cache_process_n_block_batches::<Zcashd>(&ValidatorKind::Zcashd, 1).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn process_200_blocks() {
launch_local_cache_process_n_block_batches::<Zcashd>(&ValidatorKind::Zcashd, 2).await;
}
Expand All @@ -182,12 +182,12 @@ mod zebrad {
launch_local_cache::<Zebrad>(&ValidatorKind::Zebrad).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn process_100_blocks() {
launch_local_cache_process_n_block_batches::<Zebrad>(&ValidatorKind::Zebrad, 1).await;
}

#[tokio::test]
#[tokio::test(flavor = "multi_thread")]
async fn process_200_blocks() {
launch_local_cache_process_n_block_batches::<Zebrad>(&ValidatorKind::Zebrad, 2).await;
}
Expand Down
Loading