Skip to content

Commit

Permalink
fix: remove concurrent block fetch in inputbox
Browse files Browse the repository at this point in the history
  • Loading branch information
GCdePaula committed Jan 23, 2024
1 parent 20aa922 commit 6da9171
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
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

0 comments on commit 6da9171

Please sign in to comment.