Skip to content

Validator block backup#2232

Open
sergerad wants to merge 5 commits into
sergerad-validator-modulesfrom
sergerad-validator-block-bkp
Open

Validator block backup#2232
sergerad wants to merge 5 commits into
sergerad-validator-modulesfrom
sergerad-validator-block-bkp

Conversation

@sergerad

@sergerad sergerad commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Stacked PR.

Relates to #2169.

Validator storing blocks via run-node.sh:

/tmp/validator 
➜ ls blocks/0000/
block_00000000.dat	block_00000002.dat	block_00000004.dat	block_00000006.dat	block_00000008.dat
block_00000001.dat	block_00000003.dat	block_00000005.dat	block_00000007.dat	block_00000009.dat

@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jun 10, 2026
@sergerad sergerad marked this pull request as ready for review June 10, 2026 04:33
@sergerad sergerad marked this pull request as draft June 10, 2026 07:25
@sergerad sergerad removed the request for review from Mirko-von-Leipzig June 10, 2026 07:25
@sergerad sergerad marked this pull request as ready for review June 11, 2026 01:00
let genesis_block_path = genesis_block_directory.join(GENESIS_BLOCK_FILENAME);
fs_err::write(&genesis_block_path, block_bytes).context("failed to write genesis block")?;

let _ = BlockStore::bootstrap(data_directory.to_path_buf().join("blocks"), &genesis_block)?;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Mirko-von-Leipzig I was wondering if we should use the store crate's DataDirectory struct for this but there is a discrepancy between the db filepaths atm (validator.sqlite3 vs miden-store.sqlite3).

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 have been wondering if we can't clean things up somehow.. At the moment its not quite an easy split, so maybe what you've got here is fine and we shouldn't force coupling between things that aren't literally the same thing.

We could mimic the struct here with the differences? Or create the struct with a configurable service name e.g. node and validator which would be used to infer the sqlite3 filestem?

But I think lets keep them separate 🤷 They want to store different things over time so maybe its best to keep them decoupled.

Comment on lines +199 to +201
// Ignore errors; we don't want to fail the block validation if the block cannot be backed
// up. The span of the function will record any errors that occur during backup.
let _ = self.save_block(&signed_block).await;

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'm not too sure about this. Since this is expected to act as a guaranteed block backup system, I think this must fail?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

As long as we are happy to halt the chain on this basis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog This PR does not require an entry in the `CHANGELOG.md` file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants