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

Refactor rollup initialization #1714

Merged
merged 30 commits into from
Jan 25, 2025
Merged

Refactor rollup initialization #1714

merged 30 commits into from
Jan 25, 2025

Conversation

rakanalh
Copy link
Contributor

@rakanalh rakanalh commented Jan 15, 2025

Description

Problem we have right now is that config along with a lot of other dependencies go through
main -> rollup -> client (sequencer, fullnode ..etc) -> da_block_handler

So introducing a component in DA block handler that requires a piece of config or a dependency as an example, would require updating the whole flow all the way to that point.

This PR changes this by running RPC & DA block handler as services along side the client (sequencer, fullnode ..etc) not from within. This makes initialization much easier.

What's been done?

  • RPC server is now generalized and is part of common
  • Main initializes some dependencies
  • Each node's crate would be responsible for instantiating the services and returning them (runner, l1 block handler and RPC module (if any))
  • Rollup / mod.rs would also help out the designated crate to provide configs / dependencies needed.
  • Main spawns services (the runner, L1 block handler, RPC server)

The above makes it easier to pass configs / dependencies towards fullnode's L1 block handler or RPC without having those configs / dependencies go through the runner.

TODO

  • Fix clippy

@rakanalh rakanalh added the T - enhancement New feature or request label Jan 15, 2025
Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

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

left my initial comments, will need to read rollup/mod.rs a bit more in detail.

crates/common/src/da.rs Outdated Show resolved Hide resolved
crates/common/src/da.rs Outdated Show resolved Hide resolved
crates/common/src/rpc/server.rs Show resolved Hide resolved
bin/citrea/src/cli.rs Outdated Show resolved Hide resolved
bin/citrea/src/rollup/mod.rs Show resolved Hide resolved
bin/citrea/src/rollup/mod.rs Outdated Show resolved Hide resolved
bin/citrea/src/rollup/mod.rs Outdated Show resolved Hide resolved
- L1BlockHandler for all node types has been moved
- RPC server is started for batch prover

Remaining:
- Update spawning RPC server for sequencer / light client
This consistently calls `build_services` which return all services that
a specific node would need to spawn using the task manager.
bin/citrea/src/cli.rs Outdated Show resolved Hide resolved
@rakanalh rakanalh marked this pull request as ready for review January 20, 2025 12:16
@auto-assign auto-assign bot requested a review from kpp January 20, 2025 12:16
@rakanalh rakanalh requested review from jfldde and eyusufatik January 20, 2025 12:18
crates/common/src/da.rs Outdated Show resolved Hide resolved
@rakanalh rakanalh requested a review from jfldde January 22, 2025 12:05
Copy link
Member

@ercecan ercecan left a comment

Choose a reason for hiding this comment

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

LGTM, I also agree on @jfldde comment for Storage struct to hold optional mmrdb

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

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

I hope this doesn't break anything. please launch different type of nodes on testnet on your computer. and look out for logs.

bin/citrea/src/main.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 73.16076% with 197 lines in your changes missing coverage. Please review.

Project coverage is 77.5%. Comparing base (ab43fab) to head (fc8ed59).
Report is 3 commits behind head on nightly.

Files with missing lines Patch % Lines
bin/citrea/src/cli.rs 0.0% 41 Missing ⚠️
crates/light-client-prover/src/services.rs 0.0% 40 Missing ⚠️
bin/citrea/src/main.rs 0.0% 30 Missing ⚠️
bin/citrea/src/rollup/mod.rs 82.2% 28 Missing ⚠️
crates/light-client-prover/src/rpc.rs 0.0% 21 Missing ⚠️
crates/common/src/rpc/server.rs 78.1% 12 Missing ⚠️
crates/common/src/da.rs 81.6% 11 Missing ⚠️
crates/light-client-prover/src/da_block_handler.rs 0.0% 5 Missing ⚠️
crates/sequencer/src/rpc.rs 87.1% 5 Missing ⚠️
bin/citrea/src/rollup/bitcoin.rs 0.0% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
Files with missing lines Coverage Δ
crates/batch-prover/src/da_block_handler.rs 75.0% <100.0%> (+1.0%) ⬆️
crates/batch-prover/src/lib.rs 100.0% <100.0%> (ø)
crates/batch-prover/src/metrics.rs 100.0% <ø> (ø)
crates/batch-prover/src/rpc.rs 64.6% <100.0%> (+17.2%) ⬆️
crates/batch-prover/src/runner.rs 84.1% <100.0%> (-1.8%) ⬇️
crates/common/src/rpc/mod.rs 96.8% <ø> (ø)
crates/fullnode/src/da_block_handler.rs 71.9% <100.0%> (-0.1%) ⬇️
crates/fullnode/src/lib.rs 100.0% <100.0%> (ø)
crates/light-client-prover/src/metrics.rs 0.0% <ø> (ø)
crates/sequencer/src/commitment/mod.rs 86.7% <100.0%> (ø)
... and 21 more

... and 14 files with indirect coverage changes

@rakanalh
Copy link
Contributor Author

rakanalh commented Jan 23, 2025

I hope this doesn't break anything. please launch different type of nodes on testnet on your computer. and look out for logs.

I ran both full node & batch prover, they are both syncing without issues.
Full node:

./target/debug/citrea --network testnet --da-layer bitcoin --rollup-config-path resources/configs/testnet/rollup_config.toml --genesis-paths resources/genesis/testnet

Batch Prover:

PARALLEL_PROOF_LIMIT=1 ./target/debug/citrea --network testnet --da-layer bitcoin --batch-prover resources/configs/testnet/prover_config.toml --rollup-config-path resources/configs/testnet/prover_rollup_config.toml --genesis-paths resources/genesis/testnet

image

@rakanalh rakanalh merged commit 36cbf7e into nightly Jan 25, 2025
14 of 15 checks passed
@rakanalh rakanalh deleted the rakanalh/refactor-rollup branch January 25, 2025 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T - enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants