Skip to content

refactor(store): move sync and proving to block producer#2155

Open
Mirko-von-Leipzig wants to merge 7 commits into
nextfrom
mirko/move-sync
Open

refactor(store): move sync and proving to block producer#2155
Mirko-von-Leipzig wants to merge 7 commits into
nextfrom
mirko/move-sync

Conversation

@Mirko-von-Leipzig
Copy link
Copy Markdown
Collaborator

@Mirko-von-Leipzig Mirko-von-Leipzig commented May 28, 2026

This PR moves the replica sync and proof scheduling to the block-producer.

This leaves store as 99% State management, with no spawned tasks outside of the disk monitor which will be invoked manually by the CLI.

I've also added a name-task JoinSet wrapper for supervising tasks - this is fairly common across the code base.

I elected to this now because I found it made wiring up the CLI much easier since the store no longer has spawned tasks internally.

@Mirko-von-Leipzig Mirko-von-Leipzig added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label May 28, 2026
max_txs_per_batch: self.block_producer.batch.max_txs,
max_batches_per_block: self.block_producer.block.max_batches,
max_concurrent_proofs: self.block_producer.block.max_concurrent_proofs,
mempool_tx_capacity: self.block_producer.mempool.tx_capacity,
Copy link
Copy Markdown
Collaborator

@sergerad sergerad May 29, 2026

Choose a reason for hiding this comment

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

nit: Maybe the self.block_producer and Sequencer could use the same struct for these shared fields?

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.

I'm not quite sure how, unless you mean the block producer should own the clap representation directly?

I'd prefer not to do that since how we organise the CLI isn't necessarily how things work in the block producer, so I don't want to couple them.

Or put differently, ideally we would keep the code type separate from the interface boundary, in this case the CLI API.

Comment thread bin/node/src/commands/modes.rs Outdated
Comment thread bin/node/src/commands/modes.rs Outdated
Comment thread crates/block-producer/src/server/mod.rs
Comment thread crates/block-producer/src/server/mod.rs Outdated
Comment thread crates/block-producer/src/rpc_sync.rs Outdated
Copy link
Copy Markdown
Collaborator

@sergerad sergerad left a comment

Choose a reason for hiding this comment

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

LGTM just a nit and some dedupe we should be able to do in the comments.

block_store.commit_proof(next, &proof_bytes).await?;
proof_cache.push(next, ProofNotification::new(next, proof_bytes));
proven_tip.advance(next);
state.apply_proof(next, proof_bytes).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.

The docs of apply_proof needs an update, since the sequencers is using it too

Comment on lines +45 to +47
pub fn spawn(self) -> tokio::task::JoinHandle<anyhow::Result<()>> {
tokio::spawn(self.run())
}
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.

Is this being used?

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.

3 participants