Skip to content

Commit

Permalink
cargo clippy, sort, test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Nov 13, 2023
1 parent d81a918 commit c4defe0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ url = "2.4.1"
reqwest = { version = "0.11.22", features = ["json"] }
# [features]# load-test = ["goose", "reqwest", "once_cell", "toml"]


[[bin]]
name = "tree-availability-service"
path = "bin/tree_availability_service.rs"
Expand Down
3 changes: 1 addition & 2 deletions bin/load_test/goose_functions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ pub async fn assert_response(
?expect_some,
"Inclusion proof response did not match expectation"
);
} else {
}
}
} else {
tracing::warn!(
?identity,
Expand Down
16 changes: 5 additions & 11 deletions bin/load_test/shadow_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ use world_tree::tree::{Hash, PoseidonTree};
use crate::utils::Profile;
use crate::SHADOW_TREE;

pub type ShadowTreeError =
TreeAvailabilityError<Provider<ThrottledProvider<ethers::providers::Http>>>;

pub struct ShadowWorldTree<M: Middleware> {
pub tree_data: Arc<TreeData>,
pub tree_updater: Arc<TreeUpdater<M>>,
Expand Down Expand Up @@ -98,16 +101,7 @@ impl Default for ShadowWorldTree<Provider<ThrottledProvider<Http>>> {

pub async fn initialize_shadow_tree(
profile: &Profile,
) -> eyre::Result<
JoinHandle<
Result<
(),
TreeAvailabilityError<
Provider<ThrottledProvider<ethers::providers::Http>>,
>,
>,
>,
> {
) -> eyre::Result<JoinHandle<Result<(), ShadowTreeError>>> {
let http_provider =
ethers::providers::Http::new(Url::parse(&profile.rpc_endpoint)?);

Expand All @@ -134,7 +128,7 @@ pub async fn initialize_shadow_tree(
// Sync to head
let tree_data = &shadow_tree.tree_data;
let tree_updater = &shadow_tree.tree_updater;
tree_updater.sync_to_head(&tree_data).await?;
tree_updater.sync_to_head(tree_data).await?;

let handles = shadow_tree.spawn();

Expand Down
2 changes: 1 addition & 1 deletion bin/load_test/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ where
D: serde::Deserializer<'de>,
{
let str = <String>::deserialize(deserializer)?;
Ok(H160::from_str(&str).map_err(serde::de::Error::custom)?)
H160::from_str(&str).map_err(serde::de::Error::custom)
}

pub fn read_config(file_path: &str) -> eyre::Result<Config> {
Expand Down
2 changes: 1 addition & 1 deletion src/tree/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use axum::{middleware, Json};
use axum_middleware::logging;
use ethers::providers::Middleware;
use ethers::types::H160;
use semaphore::identity;

use semaphore::lazy_merkle_tree::Canonical;
use serde::{Deserialize, Serialize};
use tokio::task::JoinHandle;
Expand Down
4 changes: 2 additions & 2 deletions src/tree/tree_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ impl TreeData {
tracing::info!(?identity, ?latest_root, "Getting inclusion proof");

if let Some(proof) = Self::proof(&tree, identity) {
return Some(InclusionProof::new(latest_root, proof, None));
Some(InclusionProof::new(latest_root, proof, None))
} else {
tracing::warn!(
?identity,
?root,
"Identity not in tree at root"
);
return None;
None
}
}
}
Expand Down

0 comments on commit c4defe0

Please sign in to comment.