Skip to content

chore: Misc followups for block validation#1402

Merged
sergerad merged 10 commits intonextfrom
sergerad-validate-followup
Dec 3, 2025
Merged

chore: Misc followups for block validation#1402
sergerad merged 10 commits intonextfrom
sergerad-validate-followup

Conversation

@sergerad
Copy link
Collaborator

@sergerad sergerad commented Dec 1, 2025

Closes #1395.

Follows up comments from #1381.

@sergerad sergerad added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Dec 1, 2025
Copy link
Collaborator

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

Choose a reason for hiding this comment

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

Some minor suggestions around the errors, but the large strokes seem good.

I think this is good to go modulo the renaming and the concurrency suggestion.

body: BlockBody,
block_proof: BlockProof,
) -> Result<ProvenBlock, BuildBlockError> {
// SAFETY: The header and body are assumed valid and consistent with the proof.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This fn doesn't need to be async anymore. I'm actually surprised clippy doesn't complain about this but maybe we've disabled the lint.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would mean I have to wrap it in a future manually in the call chain, probably prefer to keep it in fn signature?

.and_then(|(proposed_block, header, body, block_proof)| async {self.construct_proven_block(proposed_block, header, body, block_proof)})

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've done it similarly in the batch builder

https://github.com/0xMiden/miden-node/blob/9460b4423f6274441975ced75453b121013cab1b/crates/block-producer/src/batch_builder/mod.rs#L181

Though I also did consider just saying screw it and keeping the async. I think its up to you, at the time I thought its worth indicating to the reader that the function is not async (e.g. it stood out to me on reading just the fn now).

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want it to be shorter, you can always leave the tuple in place

.and_then(|args| async {self.construct_proven_block(args.0, args.1, args.2, args.3)})

Its a pity rust doesn't have a spread operator so one could do args...

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@sergerad sergerad merged commit 41860a0 into next Dec 3, 2025
6 checks passed
@sergerad sergerad deleted the sergerad-validate-followup branch December 3, 2025 20:04
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.

follow up to validate and prove blocks #1381

4 participants