Skip to content

Commit

Permalink
Remove remnants for ETH feature
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpringle committed Sep 1, 2023
1 parent 5a5c028 commit 6148f80
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions firewood/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ fn get_sub_universe_from_empty_delta(
/// DB-wide metadata, it keeps track of the roots of the top-level tries.
#[derive(Debug)]
struct DbHeader {
/// The root node of the account model storage. (Where the values are [Account] objects, which
/// may contain the root for the secondary trie.)
acc_root: DiskAddress,
/// The root node of the generic key-value store.
kv_root: DiskAddress,
}
Expand All @@ -191,7 +188,6 @@ impl DbHeader {

pub fn new_empty() -> Self {
Self {
acc_root: DiskAddress::null(),
kv_root: DiskAddress::null(),
}
}
Expand All @@ -206,7 +202,6 @@ impl Storable for DbHeader {
size: Self::MSIZE,
})?;
Ok(Self {
acc_root: raw.as_deref()[..8].into(),
kv_root: raw.as_deref()[8..].into(),
})
}
Expand All @@ -217,7 +212,6 @@ impl Storable for DbHeader {

fn dehydrate(&self, to: &mut [u8]) -> Result<(), ShaleError> {
let mut cur = Cursor::new(to);
cur.write_all(&self.acc_root.to_le_bytes())?;
cur.write_all(&self.kv_root.to_le_bytes())?;
Ok(())
}
Expand Down Expand Up @@ -335,7 +329,7 @@ impl<S: ShaleStore<Node> + Send + Sync> DbRev<S> {

/// Check if the account exists.
pub fn exist<K: AsRef<[u8]>>(&self, key: K) -> Result<bool, DbError> {
Ok(match self.merkle.get(key, self.header.acc_root) {
Ok(match self.merkle.get(key, self.header.kv_root) {
Ok(r) => r.is_some(),
Err(e) => return Err(DbError::Merkle(e)),
})
Expand Down Expand Up @@ -731,13 +725,12 @@ impl Db {

let merkle = Merkle::new(Box::new(merkle_space));

if db_header_ref.acc_root.is_null() {
if db_header_ref.kv_root.is_null() {
let mut err = Ok(());
// create the sentinel node
db_header_ref
.write(|r| {
err = (|| {
r.acc_root = merkle.init_root()?;
r.kv_root = merkle.init_root()?;
Ok(())
})();
Expand Down

0 comments on commit 6148f80

Please sign in to comment.