diff --git a/full-node/db/sov-db/src/lib.rs b/full-node/db/sov-db/src/lib.rs index 02aa5585e..b1e99aec4 100644 --- a/full-node/db/sov-db/src/lib.rs +++ b/full-node/db/sov-db/src/lib.rs @@ -15,8 +15,8 @@ pub mod ledger_db; pub mod rocks_db_config; /// Defines the tables used by the Sovereign SDK. pub mod schema; -/// Implements a wrapper around RocksDB meant for storing rollup state. This is primarily used -/// as the backing store for the JMT. +/// Implements a wrapper around [RocksDB](https://rocksdb.org/) meant for storing rollup state. +/// This is primarily used as the backing store for the [JMT(JellyfishMerkleTree)](https://docs.rs/jmt/latest/jmt/). pub mod state_db; /// Implements a wrapper around RocksDB meant for storing state only accessible diff --git a/full-node/db/sov-db/src/state_db.rs b/full-node/db/sov-db/src/state_db.rs index 49739e2aa..bff3ad889 100644 --- a/full-node/db/sov-db/src/state_db.rs +++ b/full-node/db/sov-db/src/state_db.rs @@ -74,19 +74,6 @@ impl StateDB { } } - /// Store an item in the database, given a key, a key hash, a version, and a value - pub fn update_db( - &self, - key: StateKey, - key_hash: KeyHash, - value: Option>, - next_version: Version, - ) -> anyhow::Result<()> { - self.put_preimage(key_hash, &key)?; - self.db.put::(&(key, next_version), &value)?; - Ok(()) - } - /// Increment the `next_version` counter by 1. pub fn inc_next_version(&self) { let mut version = self.next_version.lock().unwrap(); @@ -134,7 +121,7 @@ impl TreeReader for StateDB { fn get_rightmost_leaf( &self, ) -> anyhow::Result> { - todo!() + todo!("StateDB does not support [`TreeReader::get_rightmost_leaf`] yet") } } @@ -149,7 +136,7 @@ impl TreeWriter for StateDB { self.db .get::(&key_hash.0)? .ok_or(anyhow::format_err!( - "Could not find preimage for key hash {key_hash:?}" + "Could not find preimage for key hash {key_hash:?}. Has `StateDB::put_preimage` been called for this key?" ))?; self.db.put::(&(key_preimage, *version), value)?; } @@ -214,8 +201,6 @@ pub mod arbitrary { impl proptest::arbitrary::Arbitrary for FallibleArbitraryStateDB { type Parameters = (); - type Strategy = LazyJust FallibleArbitraryStateDB>; - fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy { fn gen() -> FallibleArbitraryStateDB { FallibleArbitraryStateDB { @@ -231,6 +216,8 @@ pub mod arbitrary { } LazyJust::new(gen) } + + type Strategy = LazyJust FallibleArbitraryStateDB>; } }