Skip to content

Move functionality into blockchainsource, merge indexer services, unlock widespread mock based testing.#1361

Open
idky137 wants to merge 14 commits into
devfrom
move_functionality_into_blockchainsource
Open

Move functionality into blockchainsource, merge indexer services, unlock widespread mock based testing.#1361
idky137 wants to merge 14 commits into
devfrom
move_functionality_into_blockchainsource

Conversation

@idky137

@idky137 idky137 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Moves all chain fetch in zaino-state behind the ValidatorConnector trait, making the whole crate mock testable.

  • Splits ChainIndex into 2 separate traits: ChainIndex, ChainIndexRpcExt, keeping the core (zallet) API clean.
  • Moves split chain fetch functionality (Zcash RPC vs ReadStateService) currently held in zaino-state::backends::{state, fetch} into BlockChainSource / ValidatorConnector.
  • merges StateService and FetchService into unified NodeBackedIndexerService.

Remaining work (not in this PR):

  • update test vectors MockChainSource uses - currently the mock data held is insufficient to full test zaino state, the test data should be updated to a 1500 block chain containing transparent, sapling, orchard and ironwood transactions. (test vector builder code held in live-tests/e2e/tests/test_vectors.rs).
  • Rewrite live-tests:
    • Regtest ValidatorConnector tests (full suite)
    • Regtest e2e tests (concise set)
    • MockchainSource crate / integration / unit tests (default test set).

NOTE: This PR bcame much larger than I had anticipated, if it is too large to review / merge in its current form I am happy to divide it into several smaller PRS:

  1. Split ChainIndex trait:

9923aaa

2.n move StateService/FetchService functionality into ValidatorConnector:

abbeb86

c7671b8

2a4df3f

4b2c231

91c3772

68cb4fb

68cb4fb

179feab

60a8dc2

511fe58

9c697ee

  1. merge StateService and FetchService:

6d838c0

@idky137 idky137 changed the title Move functionality into blockchainsource Move functionality into blockchainsource, merge indexer services, unlock widespread mock based testing. Jul 3, 2026
@idky137 idky137 self-assigned this Jul 3, 2026
idky137 added 3 commits July 3, 2026 15:37
…o_blockchainsource

# Conflicts:
#	live-tests/e2e/tests/devtool.rs
#	live-tests/e2e/tests/test_vectors.rs
#	packages/zaino-state/src/backends.rs
#	packages/zaino-state/src/backends/state.rs
#	packages/zaino-state/src/chain_index.rs
#	packages/zaino-state/src/chain_index/source/validator_connector.rs
#	packages/zaino-state/src/indexer/node_backed_indexer.rs
@idky137 idky137 marked this pull request as ready for review July 7, 2026 15:11
@idky137 idky137 requested a review from zancas July 7, 2026 15:32
@zancas

zancas commented Jul 7, 2026

Copy link
Copy Markdown
Member

The failing "Integration tests / Build zallet" checks are not caused by this PR. The zallet compile itself succeeds; the jobs die in a later workflow step, "Stage vendored db_dump", which looks for the db_dump helper that the zewif-zcashd build script vendors under zallet/target/.../build/zewif-zcashd-*/out/ and finds nothing.

The same step fails identically on unrelated zaino PRs (for example #1381, forty minutes earlier), and every zaino-interop-request run in zcash/integration-tests today is red the same way. The likely trigger is zallet's workspace-split restructure merged to main this morning (zcash/wallet #547#549), which reworked the package layout and build paths so the workflow's hardcoded find pattern no longer matches where zewif-zcashd builds. The fix belongs in the zcash/integration-tests workflow; until it lands, this required check will stay red on every zaino PR.

@zancas

zancas commented Jul 7, 2026

Copy link
Copy Markdown
Member

A second CI-relevant finding, and this one is introduced by the PR (deterministic — reproduced twice in omnibus runs and once in isolation):

FAIL clientless::fetch_service zebrad::validation::z_validate_address
assertion `left == right` failed: mismatch for Sapling (zebrad passthrough via FetchService — keys omitted)
  left:  … diversifier: Some("977e0b930ee6c11e4d26f8"), diversified_transmission_key: Some("553ef2…") …
  right: … diversifier: None, diversified_transmission_key: None …

Cause. The test runs the shared suite with SaplingSuite::ZebradPassthroughFetchService (live-tests/clientless/tests/fetch_service.rs:721), which pins the old FetchService behavior: z_validate_address was a JSON-RPC passthrough to the validator, and zebrad's response omits diversifier and diversifiedtransmissionkey. The merged service changed that. At base, FetchService::z_validate_address called self.fetcher.z_validate_address(...); at the PR head, NodeBackedIndexerService::z_validate_address calls the local derivation crate::indexer::z_validate_address(address, &network) (packages/zaino-state/src/indexer/node_backed_indexer.rs:607-614) on both connection types, so the response now carries the derived keys and no longer matches the pinned None/None expectation.

Recommendation. Unify on the local computation — it matches the old StateService and zcashd, and the suite's "don't delegate component extraction to a remote actor" rationale does not apply to a local derivation. Concretely:

  1. Switch the zebrad fetch test to SaplingSuite::Standard, and remove the now-unreachable ZebradPassthroughFetchService variant along with run_z_validate_sapling_zebrad_passthrough_fetchservice and its stale rationale comment (live-tests/clientless/src/lib.rs:121-150).
  2. Keep the RPC marked deprecated: the merge silently dropped the tracing::warn!("{}", Z_VALIDATE_DEPRECATION) that the old FetchService emitted on every call (visible in the same hunk). Restore that warning in the merged implementation so operators keep the deprecation signal.

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.

2 participants