Move static OnceCell ChainIdentifier into AuthorityState #20680
+38
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As part of fixing flakey graphql tests, I observed an inconsistency in how the fullnode rpc in TestCluster was reporting chain_identifier. The nodes wrote
0.chk
to file with a particular checkpoint digest->chain_id, but the rpc would report a different chain_id. Conspicuously, the chain_id was the same across tests.The issue stemmed from using a global static OnceCell. This global state meant that if the
test_simple_client_validator_cluster
test did not set thechain_id
, then it would fail. I suppose there might be some production issues as well, for example if someone were to run multiple nodes in the same process to different networks.To address, I moved chain_identifier into AuthorityState, and modified SuiNode to explicitly pass the chain_identifier to components that need it, which is basically just StateSnapshotUploader today.
By eagerly setting
chain_identifier
, we can also simplify some logic around existing callsitesTest plan
Existing tests pass
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.