Skip to content

Indexer ReadApi::get_chain_identifier should rely on IndexerReader::get_chain_identifier #6156

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

Closed
samuel-rufi opened this issue Mar 31, 2025 · 0 comments · Fixed by #6876
Closed
Assignees
Labels
infrastructure Issues related to the Infrastructure Team

Comments

@samuel-rufi
Copy link
Member

Description

Currently, the Indexer ReadApi::get_chain_identifier relies on the IndexerReader::get_checkpoint to derive the required chain identifier. For that it fetches checkpoint 0 from the database and converts the checkpoint digest into the chain identifier:

    async fn get_chain_identifier(&self) -> RpcResult<ChainIdentifier> {
        let genesis_checkpoint = self.get_checkpoint(CheckpointId::SequenceNumber(0)).await?;
        Ok(ChainIdentifier::from(genesis_checkpoint.digest))
    }

Considering pruning, if the checkpoint is not available this RPC function, this will fail. To solve this, it should make use of the newly introduced IndexerReader::get_chain_identifier function in #6123.

This function relies on the chain_identifier table which should be always populated even if we enable pruning. This field is initialized when the Indexer starts the first time and syncs checkpoint 0. On data pruning, this field should continue to exist.

The newly introduced IndexerReader::get_chain_identifier not only brings more stability to the RPC, it also exposes the functionality to all other APIs if needed, which the original ReadApi::get_chain_identifier did not.

Task

Use IndexerReader::get_chain_identifier in the ReadApi::get_chain_identifier implementation for more RPC stability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Issues related to the Infrastructure Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant