Skip to content
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

feat(conductor)!: add sequencer chain_id validation #1197

Closed

Conversation

eoroshiba
Copy link
Contributor

Summary

Added configured sequencer chain_id check against remote.

Background

This is to prevent the conductor from connecting to the wrong sequencer network.

Changes

Added sequencer chain ID configuration option for specifying expected sequencer chain ID.

Added check to ensure configured and remote chain IDs match within sequencer reader run_until_stopped() function.

Added function to retrieve the remote sequencer chain ID and check against configured chain ID. This function retrieves the remote chain ID from the sequencer network genesis file.

Testing

Added new sequencer test file to allow access to sequencer without needing to mount anything other than the genesis file. This includes a test to ensure failure on mismatched chain IDs.

Breaking Changelist

  • Added ASTRIA_CONDUCTOR_SEQUENCER_CHAIN_ID

Related Issues

Part of #986

@eoroshiba eoroshiba requested review from a team as code owners June 19, 2024 18:21
@github-actions github-actions bot added the conductor pertaining to the astria-conductor crate label Jun 19, 2024
sequencer::CancellationToken,
};

async fn mount_genesis(mock_http: &MockServer, sequencer_chain_id: &str) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the existing helpers::mount_genesis function instead of this? since this is only used in the chain-id mismatch test, you can just set the sequencer_chain_id in the builder to a different value than the default set in helpers::mount_genesis.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be mistaken, but I believe helpers::mount_genesis is only available to tests/blackbox. I created the test file within src/sequencer so that the functionality of the chain ID check could be tested without doing all the other necessary mounts/calls for the full conductor. Would you prefer to move this to the tests/blackbox folder and perform the mounts so that it can utilize helpers::mount_genesis?

eoroshiba and others added 2 commits June 25, 2024 19:03
@eoroshiba eoroshiba closed this Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conductor pertaining to the astria-conductor crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants