Skip to content

state service chain index integration#690

Merged
AloeareV merged 105 commits intochain_index_integrationfrom
state_service_chain_index_integration
Feb 13, 2026
Merged

state service chain index integration#690
AloeareV merged 105 commits intochain_index_integrationfrom
state_service_chain_index_integration

Conversation

@Oscar-Pepper
Copy link
Contributor

@Oscar-Pepper Oscar-Pepper commented Nov 24, 2025

fix #677

This deprecates all fields from StateService and StateServiceSubscriber without deleting them, so that we can update the rpc implementations (ZcashIndexer and LightwalletdIndexer traits) while still compiling fine.

Once those fields are completely un-relied upon by any endpoint, we can remove them and call this done.

NOTE: this work is done on top of PR #650, and it's expected to land before it

@nachog00 nachog00 linked an issue Nov 24, 2025 that may be closed by this pull request
- Moved `NodeBackedChainIndex`, `NodeBackedChainIndexSubscriber`, and `State` import to maintain alphabetical order
- Updated deprecation messages to be more informative regarding the new indexer's role and related issue #677
- Added more fields to the deprecation, as I believe they are part of what chain_index replaces, so we better get it out from the get go.
- Reordered fields in `StateService` and `StateServiceSubscriber` structs in `zaino-state/src/backends/state.rs`
- Reordering aligns with ongoing transition to new indexer field as part of #677 completion
Since the whole state_service module is annotated as deprecated alaready, the deprecation warnings that stem from the fields we marked as deprecated on this PR get confused with the rest. Also, there were allow(deprecated) exceptions that canceled everything out, so:

- commented out deprecated annotation on StateService, StateServiceSubscriber and StateServiceError
- commented out allow(deprecated) on implementors of the above mentioned

this way we now get the right warnings just for the fields we are deprecating on this PR

one apparent problem is that state.rs being a massive 2.5k single file module, we get all warnings for all method implementations at once. It would be WAY cleaner if we had a file per implemented method, that way it would be overly clear which methods have been properly ported already.
@nachog00
Copy link
Contributor

Got warnings discriminating the deprecated fields only. Work on individual rpcs will be easier if done on top of this 👍🏼

nachog00 and others added 23 commits November 28, 2025 20:47
the method now uses the chain index interface
I haven't run tests yet, we'll see if this is the right implementation
- Removed #[deprecated] annotations in `StateService` and `StateServiceSubscriber`

Since NodeBackedChainINdex can't yet provide those fields, we leave them un-deprecated on a first migration pass.

reference #677 (comment) for reference
- Commented out the #[deprecated] attribute on StateServiceConfig in config.rs

This cluttered the deprecation wrning for the current migratiion work.
- Removed `#[deprecated]` attribute from `mempool` field in `state.rs`

Since i realised that FetchService is also keeping this field... we might as well complete this migration without deprecating it either on stateservice.

I suspect all changes will boil down to nbci replacing the blockcache field...
- Added ChainIndex trait and chain_types imports
- Replaced block_cache.get_compact_block() with indexer methods
- Uses snapshot_nonfinalized_state() for consistent queries
- Handles both hash and height lookups via get_block_height()
…ck_cache

- Added ChainIndex trait and chain_types imports
- Use indexer.get_compact_block() then apply compact_block_to_nullifiers()
- Simplified height conversion with map_err
- Added ChainIndex, NonFinalizedSnapshot traits and chain_types imports
- Simplified height parsing with chained map_err
- Use indexer.get_compact_block() in a loop for start..=end range
- Get chain height from snapshot.best_chaintip()
- Removed complex backwards-walking via prev_hash
- Added NonFinalizedSnapshot to imports
- Get chain_height from indexer snapshot's best_chaintip()
- Updated import to include ChainIndexError in state.rs
- Replaced block_cache with compact_block retrieval from indexer
- Added error handling for missing compact block data
- Removed unused `NonEmpty` import for clean-up

replaced block_cache for indexer
nachog00 and others added 8 commits December 20, 2025 12:55
Add readiness polling to test utilities after block generation

These seem useful!  Aren't they relevant to wider contexts than test?
The sync loop was silently exiting on errors (via `?`) without updating
the status, leaving it stuck at `Syncing`. This caused tests to hang
indefinitely waiting for block heights that would never be reached.

Changes:
- Wrap sync loop in async block to catch errors before task exits
- Set status to CriticalError when sync loop exits with an error
- Log the error for debugging

Also add liveness checks to test utilities:
- generate_blocks_and_poll_indexer now checks is_live() each iteration
- generate_blocks_and_poll_chain_index now checks is_live() each iteration
- Tests fail fast with descriptive messages when backend is unreachable

This enables early detection of backend failures in CI instead of
waiting for nextest timeouts.
Introduce Status trait for service readiness probing
@idky137
Copy link
Contributor

idky137 commented Feb 3, 2026

@nachog00 nachog00 marked this pull request as ready for review February 13, 2026 19:38
@AloeareV AloeareV merged commit d5e68d1 into chain_index_integration Feb 13, 2026
8 of 13 checks passed
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.

StateService migration to chainindex backend

5 participants