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

fix: remove concurrent block fetch in inputbox #276

Merged
merged 1 commit into from
Jan 23, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Changed installation paths in the Docker image. Now all the binaries are installed in /usr/bin
instead of /opt/cartesi/bin.
- Changed the base Docker image to debian-bookworm instead cartesi/server-manager.
- Removed concurrent block fetch in foldable `InputBox`.

## [1.2.0]

Expand Down
1 change: 0 additions & 1 deletion offchain/Cargo.lock

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

1 change: 0 additions & 1 deletion offchain/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ async-trait.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
eth-state-fold-types = { workspace = true, features = ["ethers"] }
eth-state-fold.workspace = true
futures.workspace = true
im = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["rc"] }
serde_json.workspace = true
Expand Down
19 changes: 6 additions & 13 deletions offchain/types/src/foldables/input_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,16 @@ async fn fetch_all_new_inputs<
let contract = InputBox::new(*contract_address, Arc::clone(&provider));

// Retrieve `InputAdded` events
let inputs_futures: Vec<_> = contract
let input_events = contract
.input_added_filter()
.query_with_meta()
.await
.context("Error querying for input added events")?
.into_iter()
.map(|(e, meta)| Input::build_input(env, e, meta, &block_opt))
.collect();
.context("Error querying for input added events")?;

let inputs_results = futures::future::join_all(inputs_futures).await;

let inputs = {
let inputs: Result<Vec<Input>, _> =
inputs_results.into_iter().collect();

inputs?
};
let mut inputs = Vec::with_capacity(input_events.len());
for (event, meta) in input_events {
inputs.push(Input::build_input(env, event, meta, &block_opt).await?);
}

Ok(inputs)
}
Expand Down
Loading