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: Validate genesis block in executor config #40

Merged

Conversation

slowli
Copy link
Contributor

@slowli slowli commented Nov 23, 2023

What ❔

Validate genesis block self-consistency and correspondence to storage when an Executor is created.

Why ❔

Allows not to accidentally break a node due to misconfiguration.

anyhow::ensure!(
node_config.gossip.key == node_key.public(),
"config.gossip.key = {:?} doesn't match the secret key {:?}",
node_config.gossip.key,
node_key
);

// While justifications may differ among nodes for an arbitrary block, we assume that
// the genesis block has a hardcoded justification.
let first_block = storage.first_block(ctx).await.context("first_block")?;
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'm not entirely sure whether it's valid for a storage to contain blocks before the genesis block. IMO, it makes reasoning about the storage more difficult, so the current check disallows it.

@brunoffranca brunoffranca merged commit 606440a into main Nov 23, 2023
4 checks passed
@brunoffranca brunoffranca deleted the aov-bft-380-validate-genesis-block-in-executor-config branch November 23, 2023 14:47
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.

3 participants