-
Notifications
You must be signed in to change notification settings - Fork 70
perf(levm): refactor CacheDB
to use more efficient APIs
#3259
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
base: main
Are you sure you want to change the base?
Changes from all commits
6b037ce
4f3687c
258a787
b1c47d4
26978aa
49c53f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
use crate::errors::DatabaseError; | ||
use bytes::Bytes; | ||
pub use cache::CacheDB; | ||
use ethrex_common::{ | ||
Address, H256, U256, | ||
types::{Account, ChainConfig}, | ||
}; | ||
use std::collections::HashMap; | ||
|
||
pub mod cache; | ||
pub mod gen_db; | ||
|
||
pub type CacheDB = HashMap<Address, Account>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we not deleted all CacheDB references in this PR? What's the point of even having this type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type alias can hint about the intention of the field/type. Having just a hashmap you only know that there's a mapping from addresses to accounts, but not its intention. |
||
|
||
pub trait Database: Send + Sync { | ||
fn get_account(&self, address: Address) -> Result<Account, DatabaseError>; | ||
fn get_storage_value(&self, address: Address, key: H256) -> Result<U256, DatabaseError>; | ||
|
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.
Is it bad if we replace this behavior with
self.backup_account_info()?
.Just wanted to know your opinion on this, maybe you think it is better to have the behavior more explicit here instead of having it in a VM method.