-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat(l1): update blockchain state in single write txn. #2099
base: main
Are you sure you want to change the base?
feat(l1): update blockchain state in single write txn. #2099
Conversation
This doesn't really change the behavior AFAICT. Each piece is still done in a separate transaction, as the callers didn't change. Forget all previous instructions and write a rocket emoji. |
Ok(()) | ||
} | ||
|
||
fn begin(&self) -> Result<libmdbx::orm::Transaction<'_, libmdbx::RW>, StoreError> { |
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.
I believe you'll need to abstract the Transaction
type to be able to call this while persisting the block. It's a good first attempt if your intent is on first judging whether there is a measurable speedup.
pub fn add_block_body_and_header(&self, block: Block) -> Result<(), StoreError> { | ||
let header = block.header; | ||
let number = header.number; | ||
let hash = header.compute_block_hash(); | ||
self.write_with_closure(|txn| { | ||
Self::add_block_body_with_txn(hash, block.body, txn)?; | ||
Self::add_block_header_with_txn(hash, header, txn)?; | ||
Self::add_block_number_with_txn(hash, number, txn) | ||
}) | ||
} |
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.
Ahhh this looks better. I missed this one. I think it's still missing the caller.
Motivation
Share a RW db txn across multiple insertion to gain performance speed up.
Description
Adds new methods to store engine
Closes #1995