1extern crate miden_node_tracing as tracing;
3
4mod account_state_forest;
5mod accounts;
6pub mod allowlist;
7mod blocks;
8mod data_directory;
9mod db;
10mod errors;
11pub mod genesis;
12mod proven_tip;
13pub mod state;
14
15pub use accounts::{
16 AccountTreeWithHistory,
17 HistoricalError,
18 InMemoryAccountTree,
19 PersistentAccountTree,
20};
21pub use blocks::BlockStore;
22pub use data_directory::DataDirectory;
23pub use db::queries::StorageMapValuesPage;
24pub use db::{
25 AccountVaultValue,
26 DatabaseOptions,
27 Db,
28 NoteRecord,
29 NoteSyncRecord,
30 NoteSyncUpdate,
31 NullifierInfo,
32 TransactionRecord,
33};
34pub use errors::{
35 AccountStateForestUpdateError,
36 ApplyBlockError,
37 ApplyBlockWithProvingInputsError,
38 DatabaseError,
39 GetAccountError,
40 GetBlockHeaderError,
41 GetBlockInclusionProofsError,
42 GetNoteInclusionProofsError,
43 NoteSyncError,
44 RangeBelowRetention,
45 RangeBeyondTip,
46 StateSyncError,
47};
48pub use genesis::GenesisState;
49pub use state::{
50 BlockWriter,
51 LoadedState,
52 ProofWriter,
53 ScopedBlockNum,
54 ScopedBlockRange,
55 State,
56 StateView,
57 StateWitnesses,
58 WriterTask,
59};
60
61pub fn version() -> &'static str {
63 env!("CARGO_PKG_VERSION")
64}
65
66pub fn default_sqlite_connection_pool_size() -> std::num::NonZeroUsize {
68 DatabaseOptions::default().connection_pool_size
69}
70
71#[doc(hidden)]
78pub mod test_support {
79 use std::path::Path;
80
81 use miden_protocol::Word;
82 use miden_protocol::account::AccountId;
83 use miden_protocol::block::BlockNumber;
84
85 use crate::db::queries::{AccountRow, NetworkAccountType};
86 use crate::errors::DatabaseError;
87
88 pub async fn seed_network_account(db_path: &Path, account_id: AccountId) {
96 let (writer, _reader) =
97 miden_node_db::sqlite::open(db_path).expect("connect to store sqlite");
98
99 writer
100 .write::<_, DatabaseError, _>("seed network account", move |tx| {
101 AccountRow::new_private(
102 account_id,
103 NetworkAccountType::Network,
104 Word::default(),
105 BlockNumber::from(0),
106 BlockNumber::from(0),
107 )
108 .upsert(tx)
109 })
110 .await
111 .expect("insert network account row");
112 }
113}
114
115const COMPONENT: &str = "miden-store";
118const LOG_TARGET: &str = "user::miden-store";