Skip to content

Commit

Permalink
refactor(sync): fetch blocks in batches (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Apr 1, 2024
1 parent ce2e324 commit 37ba765
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 129 deletions.
110 changes: 58 additions & 52 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions src/bin/dolos/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub fn open_data_stores(config: &crate::Config) -> Result<Stores, Error> {
let wal = wal::Store::open(
rolldb_path.join("wal"),
config.rolldb.k_param.unwrap_or(1000),
config.rolldb.immutable_overlap.clone(),
)
.map_err(Error::storage)?;

Expand Down
1 change: 1 addition & 0 deletions src/bin/dolos/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct Cli {
pub struct RolldbConfig {
path: Option<std::path::PathBuf>,
k_param: Option<u64>,
immutable_overlap: Option<u64>,
}

#[derive(Deserialize)]
Expand Down
1 change: 1 addition & 0 deletions src/submit/grpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub fn pipeline(
let mut pull = sync::pull::Stage::new(
config.peer_addresses[0].clone(),
config.peer_magic,
50,
sync::pull::Intersection::Tip,
);

Expand Down
1 change: 0 additions & 1 deletion src/sync/ledger.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use gasket::framework::*;
use pallas::applying::{validate, Environment, UTxOs};
use pallas::ledger::configs::{byron, shelley};
use pallas::ledger::traverse::wellknown::GenesisValues;
use pallas::ledger::traverse::{Era, MultiEraBlock, MultiEraInput, MultiEraOutput};
use std::borrow::Cow;
use std::collections::HashMap;
Expand Down
3 changes: 2 additions & 1 deletion src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod roll;
pub struct Config {
pub peer_address: String,
pub network_magic: u64,
pub block_fetch_batch_size: Option<usize>,
pub network_id: u8,
pub phase1_validation_enabled: bool,
}
Expand Down Expand Up @@ -62,6 +63,7 @@ pub fn pipeline(
let mut pull = pull::Stage::new(
config.peer_address.clone(),
config.network_magic,
config.block_fetch_batch_size.unwrap_or(50),
pull_cursor,
);

Expand All @@ -72,7 +74,6 @@ pub fn pipeline(
info!(?cursor_ledger, "ledger cursor found");

let mut roll = roll::Stage::new(wal, cursor_chain, cursor_ledger);

let mut chain = chain::Stage::new(chain);
let mut ledger = ledger::Stage::new(ledger, byron, shelley, config.phase1_validation_enabled);

Expand Down
Loading

0 comments on commit 37ba765

Please sign in to comment.