Skip to content

chore: Validator block backup and key check#2230

Open
sergerad wants to merge 7 commits into
nextfrom
sergerad-validator-startup
Open

chore: Validator block backup and key check#2230
sergerad wants to merge 7 commits into
nextfrom
sergerad-validator-startup

Conversation

@sergerad

@sergerad sergerad commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #2207.

Changelog

[[entry]]
scope       = "validator"
impact      = "added"
description = "Blocks are now persisted locally, acting as a guaranteed backup"

[[entry]]
scope       = "validator"
impact      = "added"
description = "Signing key is checked for consistency against latest block on start up"

@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jun 10, 2026

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, LGTM.

Once this stack is in, we should consider what key rotation might look like. Probably possible with this method as well, but maybe we want to keep a history of the public keys we've used in a separate table.. but also maybe not. Likely depends on what comes out of the TEE/privacy/multiple validators discussions.

Comment thread bin/validator/src/server/validator_service/mod.rs
@sergerad sergerad changed the title chore: Validator key check on start chore: Validator block backup and key check Jun 11, 2026
@sergerad sergerad removed the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jun 11, 2026

@Mirko-von-Leipzig Mirko-von-Leipzig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

for item in secrets.as_account_files(&genesis_state) {
let AccountFileWithName { account_file, name } = item?;
let account_path = accounts_directory.join(name);
let account_path = dirs.accounts_dir().expect("bootstrap directories").join(name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should restrict DataDirectory to only handle the data directory. As in, not be an enum.

Account output directory and genesis output directory are a separate matter. We could simplify these into a single --output-directory argument? Though that would be a technically breaking change right now, so maybe we punt on that, though we can prepare for it so long by making this a single struct.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can be cleaned up in a follow up PR.


/// Creates a validator database seeded with a genesis block whose `validator_key` is the public key
/// of `key`. Returns the database handle and the genesis block header.
async fn setup_db_with_genesis(key: &SigningKey) -> (miden_node_db::Db, BlockStore, BlockHeader) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be better if this used the actual bootstrapping method to prevent drift. I think that's already possible now? We could even add that as a method to the actual object instead, that does the temp dir stuff etc.

This can be done in a follow up PR though.

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.

Validator should guard against misconfigured key

2 participants