diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 43bb0dab..e96896c7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -81,7 +81,7 @@ jobs: - name: "Set allowed lints" run: | if [ "${{ matrix.toolchain }}" == "nightly" ]; then - echo "ALLOWED=-A non_local_definitions -A clippy::too_long_first_doc_paragraph" >> $GITHUB_ENV + echo "ALLOWED=-A non_local_definitions -A clippy::too_long_first_doc_paragraph -A clippy::needless_return" >> $GITHUB_ENV else echo "ALLOWED=" >> $GITHUB_ENV fi diff --git a/starknet-accounts/src/account/declaration.rs b/starknet-accounts/src/account/declaration.rs index cca83010..0f07b5f8 100644 --- a/starknet-accounts/src/account/declaration.rs +++ b/starknet-accounts/src/account/declaration.rs @@ -486,8 +486,8 @@ where let gas_price = u64::from_le_bytes(gas_price_bytes[..8].try_into().unwrap()); - (((overall_fee + gas_price - 1) / gas_price) as f64 - * self.gas_estimate_multiplier) as u64 + (overall_fee.div_ceil(gas_price) as f64 * self.gas_estimate_multiplier) + as u64 } }; diff --git a/starknet-accounts/src/account/execution.rs b/starknet-accounts/src/account/execution.rs index c3f75f38..b94040ba 100644 --- a/starknet-accounts/src/account/execution.rs +++ b/starknet-accounts/src/account/execution.rs @@ -466,8 +466,8 @@ where let gas_price = u64::from_le_bytes(gas_price_bytes[..8].try_into().unwrap()); - ((((overall_fee + gas_price - 1) / gas_price) as f64) - * self.gas_estimate_multiplier) as u64 + ((overall_fee.div_ceil(gas_price) as f64) * self.gas_estimate_multiplier) + as u64 } }; diff --git a/starknet-accounts/src/factory/mod.rs b/starknet-accounts/src/factory/mod.rs index c72ab017..b893abc3 100644 --- a/starknet-accounts/src/factory/mod.rs +++ b/starknet-accounts/src/factory/mod.rs @@ -694,8 +694,8 @@ where let gas_price = u64::from_le_bytes(gas_price_bytes[..8].try_into().unwrap()); - ((((overall_fee + gas_price - 1) / gas_price) as f64) - * self.gas_estimate_multiplier) as u64 + ((overall_fee.div_ceil(gas_price) as f64) * self.gas_estimate_multiplier) + as u64 } }; diff --git a/starknet-accounts/tests/single_owner_account.rs b/starknet-accounts/tests/single_owner_account.rs index 808093f4..8b1eb038 100644 --- a/starknet-accounts/tests/single_owner_account.rs +++ b/starknet-accounts/tests/single_owner_account.rs @@ -355,7 +355,7 @@ async fn can_execute_eth_transfer_invoke_v3_inner( calldata: vec![Felt::from_hex("0x1234").unwrap(), Felt::ONE, Felt::ZERO], }]) .gas(100000) - .gas_price(800000000000000) + .gas_price(900000000000000) .send() .await .unwrap(); @@ -545,7 +545,7 @@ async fn can_declare_cairo1_contract_v3_inner( Felt::from_hex(&hashes.compiled_class_hash).unwrap(), ) .gas(100000) - .gas_price(800000000000000) + .gas_price(900000000000000) .send() .await .unwrap(); diff --git a/starknet-contract/tests/contract_deployment.rs b/starknet-contract/tests/contract_deployment.rs index 5720d100..d656776b 100644 --- a/starknet-contract/tests/contract_deployment.rs +++ b/starknet-contract/tests/contract_deployment.rs @@ -81,7 +81,7 @@ async fn can_deploy_contract_to_alpha_sepolia_with_invoke_v3() { let result = factory .deploy_v3(vec![Felt::ONE], Felt::from_bytes_be(&salt_buffer), true) .gas(100000) - .gas_price(800000000000000) + .gas_price(900000000000000) .send() .await;