extern crate miden_node_tracing as tracing;
miden_node_tracing::declare_targets! {
default: "miden::storage",
"miden_node_store::db" => "miden::storage::sqlite",
"miden_node_store::allowlist" => "miden::storage::sqlite",
"miden_node_store::accounts" => "miden::storage::rocksdb",
"miden_node_store::account_state_forest" => "miden::storage::rocksdb",
"miden_node_store::state::loader" => "miden::storage::rocksdb",
"miden_node_store::blocks" => "miden::storage::files",
}
mod account_state_forest;
mod accounts;
pub mod allowlist;
mod blocks;
mod data_directory;
mod db;
mod errors;
pub mod genesis;
mod proven_tip;
pub mod state;
pub use accounts::{
AccountTreeWithHistory,
HistoricalError,
InMemoryAccountTree,
PersistentAccountTree,
};
pub use blocks::BlockStore;
pub use data_directory::DataDirectory;
pub use db::queries::StorageMapValuesPage;
pub use db::{
AccountVaultValue,
DatabaseOptions,
Db,
NoteRecord,
NoteSyncRecord,
NoteSyncUpdate,
NullifierInfo,
TransactionRecord,
};
pub use errors::{
AccountStateForestUpdateError,
ApplyBlockError,
ApplyBlockWithProvingInputsError,
DatabaseError,
GetAccountError,
GetBlockHeaderError,
GetBlockInclusionProofsError,
GetNoteInclusionProofsError,
NoteSyncError,
RangeBelowRetention,
RangeBeyondTip,
StateSyncError,
};
pub use genesis::GenesisState;
pub use state::{
BlockWriter,
LoadedState,
ProofWriter,
ScopedBlockNum,
ScopedBlockRange,
State,
StateView,
StateWitnesses,
WriterTask,
};
pub fn version() -> &'static str {
env!("CARGO_PKG_VERSION")
}
pub fn default_sqlite_connection_pool_size() -> std::num::NonZeroUsize {
DatabaseOptions::default().connection_pool_size
}
#[doc(hidden)]
pub mod test_support {
use std::path::Path;
use miden_protocol::Word;
use miden_protocol::account::AccountId;
use miden_protocol::block::BlockNumber;
use crate::db::queries::{AccountRow, NetworkAccountType};
use crate::errors::DatabaseError;
pub async fn seed_network_account(db_path: &Path, account_id: AccountId) {
let (writer, _reader) =
miden_node_db::sqlite::open(db_path).expect("connect to store sqlite");
writer
.write::<_, DatabaseError, _>("seed network account", move |tx| {
AccountRow::new_private(
account_id,
NetworkAccountType::Network,
Word::default(),
BlockNumber::from(0),
BlockNumber::from(0),
)
.upsert(tx)
})
.await
.expect("insert network account row");
}
}