-
Notifications
You must be signed in to change notification settings - Fork 34
fix(iota-indexer): Get chain_identifier
from chain_identifier
table
#6876
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
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 4 Skipped Deployments
|
While debugging, I noticed that the This happens because the global Indexer tests involving the chain identifier need to take this into account. The issue can be reproduced when running the existing #[test]
fn get_chain_identifier() {
let ApiTestSetup {
runtime,
cluster,
store,
client,
} = ApiTestSetup::get_or_init();
runtime.block_on(async move {
indexer_wait_for_checkpoint(store, 1).await;
let fullnode_chain_identifier = cluster.rpc_client().get_chain_identifier().await.unwrap();
let indexer_chain_identifier = client.get_chain_identifier().await.unwrap();
assert_eq!(fullnode_chain_identifier, indexer_chain_identifier)
});
}
#[test]
fn get_chain_identifier_with_custom_setup() {
let runtime = tokio::runtime::Runtime::new().unwrap();
runtime.block_on(async move {
let (cluster, store, client) = &start_test_cluster_with_read_write_indexer(
Some("test_get_chain_identifier_with_custom_setup"),
None,
None,
)
.await;
indexer_wait_for_checkpoint(store, 1).await;
let fullnode_chain_identifier = cluster.rpc_client().get_chain_identifier().await.unwrap();
let indexer_chain_identifier = client.get_chain_identifier().await.unwrap();
assert_eq!(fullnode_chain_identifier, indexer_chain_identifier);
})
} Only one of the tests will pass:
It's not an issue for this PR, however it indicates that we need to be aware of these globals when testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description of change
The current implementation of
ReadApi::get_chain_identifier
depends onIndexerReader::get_checkpoint
to obtain the chain identifier. However, this approach fails when pruning is enabled, as the genesis checkpoint may no longer be available. To address this, the method should instead useIndexerReader::get_chain_identifier
, which retrieves the chain identifier directly from thechain_identifier
table.Links to any relevant issues
Fixes #6156
Type of change
How the change has been tested
Describe the tests that you ran to verify your changes.
Make sure to provide instructions for the maintainer as well as any relevant configurations.
There is an existing
ReadApi::get_chain_identifier
test.Furthermore, an additional test was added
ReadApi::get_chain_identifier_with_pruning_enabled
to test with pruning configuration.Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure)
The unchecked test classes have been left out as they are not relevant for this change.
Change checklist
Tick the boxes that are relevant to your changes, and delete any items that are not.
Release Notes