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

refactor(sync): fetch blocks in batches #189

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -29,7 +29,7 @@
bytes: Vec<u8>,
}

impl Into<TxIdAndSize<EraTxId>> for Transaction {

Check failure on line 32 in src/submit/grpc/mod.rs

View workflow job for this annotation

GitHub Actions / Lint Rust

an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
fn into(self) -> TxIdAndSize<EraTxId> {
TxIdAndSize(
EraTxId(self.era, self.hash.to_vec()),
Expand All @@ -38,7 +38,7 @@
}
}

impl Into<EraTxBody> for Transaction {

Check failure on line 41 in src/submit/grpc/mod.rs

View workflow job for this annotation

GitHub Actions / Lint Rust

an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
fn into(self) -> EraTxBody {
EraTxBody(self.era, self.bytes)
}
Expand Down Expand Up @@ -84,6 +84,7 @@
let mut pull = sync::pull::Stage::new(
config.peer_addresses[0].clone(),
config.peer_magic,
50,
sync::pull::Intersection::Tip,
);

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
Loading