Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(validator_node): new state store implementation using RocksDB #1192

Draft
wants to merge 30 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d539851
initial boilerplate
mrnaveira Oct 24, 2024
3b49566
basic blocks_insert
mrnaveira Oct 24, 2024
ca51cca
basic blocks_get
mrnaveira Oct 25, 2024
91bcde4
Merge branch 'development' of https://github.com/tari-project/tari-da…
mrnaveira Oct 25, 2024
83eaf3f
block model
mrnaveira Oct 25, 2024
e5f03b9
new config option for database type
mrnaveira Oct 28, 2024
9228cef
workaround for an abstract state store
mrnaveira Oct 29, 2024
9ed5ec7
transaction_pool basic model
mrnaveira Oct 29, 2024
ac84ae8
allow column families for blocks
mrnaveira Nov 7, 2024
9e64441
implement all vn state store write ops
mrnaveira Nov 8, 2024
0aaac73
implement all vn state store read ops
mrnaveira Nov 8, 2024
489029a
Merge branch 'development' of https://github.com/tari-project/tari-da…
mrnaveira Nov 8, 2024
e1949e1
fix conflicts
mrnaveira Nov 12, 2024
2e650f6
implement transaction_pool_get_for_blocks
mrnaveira Nov 18, 2024
e409419
fix transaction_pool_add_pending_update implementation
mrnaveira Nov 19, 2024
759de7a
complete confirm_all_transitions unit test
mrnaveira Nov 20, 2024
c8f78a8
new storage_tests crate
mrnaveira Nov 20, 2024
9f4e227
implement and test basic block operations
mrnaveira Nov 21, 2024
a67971c
test block operations related to parents
mrnaveira Nov 25, 2024
63fe49e
blocks_get_all_by_parent
mrnaveira Nov 25, 2024
bbf8794
blocks_get_parent_chain
mrnaveira Nov 25, 2024
15a48bd
blocks_get_all_ids_by_height
mrnaveira Nov 25, 2024
bc535e4
blocks_get_genesis_for_epoch
mrnaveira Nov 25, 2024
ce81c58
blocks_get_last_n_in_epoch
mrnaveira Nov 25, 2024
26fb604
blocks_get_all_between
mrnaveira Nov 25, 2024
3ebeddc
blocks_get_any_with_epoch_range
mrnaveira Nov 25, 2024
7b4136d
blocks_get_paginated
mrnaveira Nov 26, 2024
66e0abc
blocks_get_total_leader_fee_for_epoch
mrnaveira Nov 26, 2024
5bc676c
filtered_blocks_get_count
mrnaveira Nov 26, 2024
e8610a4
finished implenting and testing block operations
mrnaveira Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 164 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ members = [
"dan_layer/indexer_lib",
"dan_layer/p2p",
"dan_layer/rpc_state_sync",
"dan_layer/state_store_rocksdb",
"dan_layer/state_store_sqlite",
"dan_layer/state_tree",
"dan_layer/storage_sqlite",
"dan_layer/storage",
"dan_layer/storage_tests",
"dan_layer/tari_bor",
"dan_layer/template_abi",
"dan_layer/template_builtin",
Expand Down Expand Up @@ -94,6 +96,7 @@ tari_networking = { path = "networking/core" }
tari_rpc_framework = { path = "networking/rpc_framework" }
tari_rpc_macros = { path = "networking/rpc_macros" }
tari_state_store_sqlite = { path = "dan_layer/state_store_sqlite" }
tari_state_store_rocksdb = { path = "dan_layer/state_store_rocksdb" }
tari_state_tree = { path = "dan_layer/state_tree" }
tari_swarm = { path = "networking/swarm" }
tari_template_abi = { version = "0.7", path = "dan_layer/template_abi" }
Expand Down Expand Up @@ -233,6 +236,9 @@ quote = "1.0.7"
rand = "0.8.5"
rayon = "1.7.0"
reqwest = "0.11.16"
# TODO: use the next release (the one after 0.22.0) when available
# https://github.com/rust-rocksdb/rust-rocksdb/issues/881
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1cf906dc4087f06631820f13855e6b27bd21b972" }
semver = "1.0"
serde = { version = "1.0", default-features = false }
serde_json = "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
# The relative path to store persistent data (default = "data/validator_node")
#data_dir = "data/validator_node"

# The type of database ("rocksdb" or "sqlite") to use (default = "rocksdb")
#database_type = "rocksdb"

# JSON-RPC listener address (default = "127.0.0.1:18200")
#json_rpc_address = "127.0.0.1:18200"

Expand Down
12 changes: 6 additions & 6 deletions applications/tari_dan_app_utilities/src/base_layer_scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ use crate::template_manager::interface::{TemplateManagerError, TemplateManagerHa

const LOG_TARGET: &str = "tari::dan::base_layer_scanner";

pub fn spawn<TAddr: NodeAddressable + 'static>(
pub fn spawn<TAddr: NodeAddressable + 'static, TStore: StateStore + Send + 'static>(
global_db: GlobalDb<SqliteGlobalDbAdapter<TAddr>>,
base_node_client: GrpcBaseNodeClient,
epoch_manager: EpochManagerHandle<TAddr>,
template_manager: TemplateManagerHandle,
shutdown: ShutdownSignal,
consensus_constants: ConsensusConstants,
shard_store: SqliteStateStore<TAddr>,
shard_store: TStore,
scan_base_layer: bool,
base_layer_scanning_interval: Duration,
validator_node_sidechain_id: Option<RistrettoPublicKey>,
Expand Down Expand Up @@ -101,7 +101,7 @@ pub fn spawn<TAddr: NodeAddressable + 'static>(
})
}

pub struct BaseLayerScanner<TAddr> {
pub struct BaseLayerScanner<TAddr, TStore> {
global_db: GlobalDb<SqliteGlobalDbAdapter<TAddr>>,
last_scanned_height: u64,
last_scanned_tip: Option<FixedHash>,
Expand All @@ -112,7 +112,7 @@ pub struct BaseLayerScanner<TAddr> {
template_manager: TemplateManagerHandle,
shutdown: ShutdownSignal,
consensus_constants: ConsensusConstants,
state_store: SqliteStateStore<TAddr>,
state_store: TStore,
scan_base_layer: bool,
base_layer_scanning_interval: Duration,
has_attempted_scan: bool,
Expand All @@ -121,15 +121,15 @@ pub struct BaseLayerScanner<TAddr> {
burnt_utxo_sidechain_id: Option<PublicKey>,
}

impl<TAddr: NodeAddressable + 'static> BaseLayerScanner<TAddr> {
impl<TAddr: NodeAddressable + 'static, TStore: StateStore> BaseLayerScanner<TAddr, TStore> {
pub fn new(
global_db: GlobalDb<SqliteGlobalDbAdapter<TAddr>>,
base_node_client: GrpcBaseNodeClient,
epoch_manager: EpochManagerHandle<TAddr>,
template_manager: TemplateManagerHandle,
shutdown: ShutdownSignal,
consensus_constants: ConsensusConstants,
state_store: SqliteStateStore<TAddr>,
state_store: TStore,
scan_base_layer: bool,
base_layer_scanning_interval: Duration,
validator_node_sidechain_id: Option<PublicKey>,
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_indexer/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub async fn spawn_services(
shutdown.clone(),
consensus_constants,
// TODO: Remove coupling between scanner and shard store
SqliteStateStore::connect(&format!(
SqliteStateStore::<PeerAddress>::connect(&format!(
"sqlite://{}",
config.indexer.data_dir.join("unused-shard-store.sqlite").display()
))?,
Expand Down
2 changes: 2 additions & 0 deletions applications/tari_validator_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ tari_rpc_state_sync = { workspace = true }
tari_bor = { workspace = true, default-features = true }
tari_consensus = { workspace = true }
tari_state_store_sqlite = { workspace = true }
tari_state_store_rocksdb = { workspace = true }
tari_state_tree = { workspace = true }
tari_networking = { workspace = true }
tari_rpc_framework = { workspace = true }
tari_template_builtin = { workspace = true }
Expand Down
Loading