Skip to content

Commit cd6e32c

Browse files
authored
docs(backend): add documentation to storage store types (#64)
Adds documentation to public storage store types (AccountStore, StorageStore, CodeStore) explaining their purpose, key/value semantics, and trait implementations.
1 parent 820a6ea commit cd6e32c

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

crates/storage/backend/src/accounts.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ use crate::{
1111
};
1212

1313
/// Account partition backed by commonware-storage.
14+
///
15+
/// Stores account state including nonce, balance, code hash, and generation number.
16+
/// Each account is keyed by its 20-byte address and encoded as a fixed 80-byte value
17+
/// using [`AccountEncoding`](kora_qmdb::AccountEncoding).
18+
///
19+
/// Implements [`QmdbGettable`] for reads and [`QmdbBatchable`] for batch writes.
20+
/// All writes are atomic and update the authenticated Merkle root.
1421
pub struct AccountStore {
1522
inner: StoreSlot<AccountDb>,
1623
}

crates/storage/backend/src/code.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ use crate::{
1111
};
1212

1313
/// Code partition backed by commonware-storage.
14+
///
15+
/// Stores contract bytecode keyed by the keccak256 hash of the code (code hash).
16+
/// Values are variable-length byte vectors containing the raw EVM bytecode.
17+
///
18+
/// Implements [`QmdbGettable`] for reads and [`QmdbBatchable`] for batch writes.
19+
/// All writes are atomic and update the authenticated Merkle root.
1420
pub struct CodeStore {
1521
inner: StoreSlot<CodeDb>,
1622
}

crates/storage/backend/src/storage.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ use crate::{
1313
};
1414

1515
/// Storage partition backed by commonware-storage.
16+
///
17+
/// Stores contract storage slots as key-value pairs. Keys are composite tuples of
18+
/// (address, generation, slot) encoded via [`StorageKey`], and values are 32-byte
19+
/// [`U256`] integers.
20+
///
21+
/// Implements [`QmdbGettable`] for reads and [`QmdbBatchable`] for batch writes.
22+
/// All writes are atomic and update the authenticated Merkle root.
1623
pub struct StorageStore {
1724
inner: StoreSlot<StorageDb>,
1825
}

0 commit comments

Comments
 (0)