Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
fix: clippy (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak authored Oct 24, 2023
1 parent 5c6279c commit c583247
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions crates/primitives/fee/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,6 @@ pub static VM_RESOURCE_FEE_COSTS: [(&str, FixedU128); 7] = [
("ec_op_builtin", FixedU128::from_inner(10_240_000_000_000_000_000)),
];

#[cfg(test)]
mod vm_resource_fee_costs {
use super::{FixedU128, HashMap, VM_RESOURCE_FEE_COSTS};

#[test]
fn check_values_as_floats() {
let hm = HashMap::from(VM_RESOURCE_FEE_COSTS);

assert_eq!(hm.get("n_steps"), Some(FixedU128::from_float(0.01)).as_ref());
assert_eq!(hm.get("pedersen_builtin"), Some(FixedU128::from_float(0.32)).as_ref());
assert_eq!(hm.get("range_check_builtin"), Some(FixedU128::from_float(0.16)).as_ref());
assert_eq!(hm.get("ecdsa_builtin"), Some(FixedU128::from_float(20.48)).as_ref());
assert_eq!(hm.get("bitwise_builtin"), Some(FixedU128::from_float(0.64)).as_ref());
assert_eq!(hm.get("poseidon_builtin"), Some(FixedU128::from_float(0.32)).as_ref());
assert_eq!(hm.get("ec_op_builtin"), Some(FixedU128::from_float(10.24)).as_ref());
}
}

/// Gets the transaction resources.
pub fn compute_transaction_resources<S: State + StateChanges>(
state: &S,
Expand Down Expand Up @@ -226,3 +208,21 @@ pub fn calculate_l1_gas_by_vm_usage(

Ok(vm_l1_gas_usage)
}

#[cfg(test)]
mod vm_resource_fee_costs {
use super::{FixedU128, HashMap, VM_RESOURCE_FEE_COSTS};

#[test]
fn check_values_as_floats() {
let hm = HashMap::from(VM_RESOURCE_FEE_COSTS);

assert_eq!(hm.get("n_steps"), Some(FixedU128::from_float(0.01)).as_ref());
assert_eq!(hm.get("pedersen_builtin"), Some(FixedU128::from_float(0.32)).as_ref());
assert_eq!(hm.get("range_check_builtin"), Some(FixedU128::from_float(0.16)).as_ref());
assert_eq!(hm.get("ecdsa_builtin"), Some(FixedU128::from_float(20.48)).as_ref());
assert_eq!(hm.get("bitwise_builtin"), Some(FixedU128::from_float(0.64)).as_ref());
assert_eq!(hm.get("poseidon_builtin"), Some(FixedU128::from_float(0.32)).as_ref());
assert_eq!(hm.get("ec_op_builtin"), Some(FixedU128::from_float(10.24)).as_ref());
}
}

0 comments on commit c583247

Please sign in to comment.