-
Notifications
You must be signed in to change notification settings - Fork 30
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
Block import crate #232
Block import crate #232
Conversation
|
||
/// This needs to be called sequentially, it will apply the state diff to the db, verify the state root and save the block. | ||
/// This runs on the [`rayon`] threadpool however as it uses parallelism inside. | ||
pub fn verify_apply_inner( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the block storage in the database and the trie not be done in parallel? Is it too much load for the database?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats true we should do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't, because the db needs the block hash and global_state_root, and we don't have the global_state_root until we have computed the trie
we could overlap some of the db writes inside dc-db, like, everything except the actual block header which we could store last once we have the global state root, but this would make the interface between dc-db and block-import a mess i think
Each of these steps are parallelized internally, so I don't think we would see much of a perf change at all
I am adding a comment pointing to this potential improvement so that we can potentially investigate it deeper if we ever want to but I'm pretty sure this is not worth it
pls rebase @cchudant |
Coverage reportThe coverage rate is
Diff Coverage details (click to unfold)crates/node/src/service/l1.rs
crates/node/src/service/rpc/server.rs
crates/client/block_import/src/pre_validate.rs
crates/client/mempool/src/block_production.rs
crates/client/mempool/src/inner.rs
crates/client/block_import/src/verify_apply.rs
crates/node/src/util.rs
crates/primitives/transactions/src/compute_hash.rs
crates/client/rpc/src/methods/read/estimate_fee.rs
crates/primitives/transactions/src/from_starknet_core.rs
crates/client/rpc/src/methods/trace/simulate_transactions.rs
crates/client/sync/src/utils.rs
crates/node/src/service/sync.rs
crates/client/block_import/src/lib.rs
crates/client/mempool/src/close_block.rs
crates/client/sync/src/l2.rs
crates/primitives/class/src/compile.rs
crates/client/sync/src/lib.rs
crates/client/sync/src/fetch/mod.rs
crates/client/sync/src/fetch/fetchers.rs
crates/client/block_import/src/rayon.rs
crates/client/db/src/db_block_id.rs
crates/client/db/src/lib.rs
crates/client/db/src/class_db.rs
crates/client/rpc/src/mempool_provider.rs
crates/primitives/transactions/src/from_broadcasted_transaction.rs
crates/node/src/cli/mod.rs
crates/primitives/block/src/header.rs
crates/client/mempool/src/lib.rs
crates/client/block_import/src/verify_apply/contracts.rs
|
Closes #228 for now, as this takes most of the code from that pr except the pipeline.
I have a few commits on top of this one, which add a genesis provider that also uses the block import crate - i'm opening the pr without these for now so that @jbcaron can work on top of this without having to deal with broken code