Skip to content

Commit

Permalink
Eliminate clippy warnings (#2082)
Browse files Browse the repository at this point in the history
# Description
No more `clippy` warnings for now

# Changes
Also uses the latest `ethcontract`
  • Loading branch information
squadgazzz authored Nov 27, 2023
1 parent 4dfab53 commit fa8796c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cached = { version = "0.44", default-features = false }
chrono = { version = "0.4", default-features = false }
clap = { version = "4", features = ["derive", "env"] }
derivative = "2"
ethcontract = { version = "0.25.2", default-features = false, features = ["aws-kms"] }
ethcontract = { version = "0.25.4", default-features = false, features = ["aws-kms"] }
ethcontract-generate = { version = "0.25", default-features = false }
ethcontract-mock = { version = "0.25", default-features = false }
ethereum-types = "0.14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,30 @@ fn convert_to_quote_id_and_user_valid_to(
Ok((quote_id, user_valid_to))
}

/// The block from which to start indexing eth-flow events. Note that this
/// function is expected to be used at the start of the services and will panic
/// if it cannot retrieve the information it needs.
pub async fn determine_ethflow_indexing_start(
skip_event_sync_start: &Option<BlockNumberHash>,
ethflow_indexing_start: Option<u64>,
web3: &Web3,
chain_id: u64,
) -> BlockNumberHash {
if let Some(block_number_hash) = skip_event_sync_start {
return *block_number_hash;
}
if let Some(block_number) = ethflow_indexing_start {
return block_number_to_block_number_hash(web3, block_number.into())
.await
.expect("Should be able to find block at specified indexing start");
}
settlement_deployment_block_number_hash(web3, chain_id)
.await
.unwrap_or_else(|err| {
panic!("Should be able to find settlement deployment block. Error: {err}")
})
}

#[cfg(test)]
mod test {
use {
Expand Down Expand Up @@ -229,27 +253,3 @@ mod test {
assert_eq!(result.len(), 0);
}
}

/// The block from which to start indexing eth-flow events. Note that this
/// function is expected to be used at the start of the services and will panic
/// if it cannot retrieve the information it needs.
pub async fn determine_ethflow_indexing_start(
skip_event_sync_start: &Option<BlockNumberHash>,
ethflow_indexing_start: Option<u64>,
web3: &Web3,
chain_id: u64,
) -> BlockNumberHash {
if let Some(block_number_hash) = skip_event_sync_start {
return *block_number_hash;
}
if let Some(block_number) = ethflow_indexing_start {
return block_number_to_block_number_hash(web3, block_number.into())
.await
.expect("Should be able to find block at specified indexing start");
}
settlement_deployment_block_number_hash(web3, chain_id)
.await
.unwrap_or_else(|err| {
panic!("Should be able to find settlement deployment block. Error: {err}")
})
}
8 changes: 4 additions & 4 deletions crates/database/src/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ mod tests {
let post_interactions = read_order_interactions(&mut db, &order.uid, ExecutionTime::Post)
.await
.unwrap();
assert_eq!(*post_interactions.get(0).unwrap(), post_interaction_0);
assert_eq!(*post_interactions.first().unwrap(), post_interaction_0);
assert_eq!(*post_interactions.get(1).unwrap(), post_interaction_1);

let post_interaction_overwrite_0 = Interaction {
Expand All @@ -992,7 +992,7 @@ mod tests {
.await
.unwrap();
assert_eq!(
*post_interactions.get(0).unwrap(),
*post_interactions.first().unwrap(),
post_interaction_overwrite_0
);
assert_eq!(*post_interactions.get(1).unwrap(), post_interaction_1);
Expand Down Expand Up @@ -1061,7 +1061,7 @@ mod tests {
let pre_interactions = read_order_interactions(&mut db, &order.uid, ExecutionTime::Pre)
.await
.unwrap();
assert_eq!(*pre_interactions.get(0).unwrap(), pre_interaction_0);
assert_eq!(*pre_interactions.first().unwrap(), pre_interaction_0);
assert_eq!(*pre_interactions.get(1).unwrap(), pre_interaction_1);

let pre_interaction_overwrite_0 = Interaction {
Expand All @@ -1082,7 +1082,7 @@ mod tests {
.await
.unwrap();
assert_eq!(
*pre_interactions.get(0).unwrap(),
*pre_interactions.first().unwrap(),
pre_interaction_overwrite_0
);
assert_eq!(*pre_interactions.get(1).unwrap(), pre_interaction_1);
Expand Down
2 changes: 1 addition & 1 deletion crates/solver/src/settlement_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ mod tests {
.await
.map(|settlement| vec![settlement])
.unwrap();
let settlement = settlements.get(0).unwrap();
let settlement = settlements.first().unwrap();
let settlement_encoded = settlement
.clone()
.encode(InternalizationStrategy::SkipInternalizableInteraction);
Expand Down

0 comments on commit fa8796c

Please sign in to comment.