diff --git a/packages/fuels-accounts/src/lib.rs b/packages/fuels-accounts/src/lib.rs index 4b85d2b16f..97faf8e878 100644 --- a/packages/fuels-accounts/src/lib.rs +++ b/packages/fuels-accounts/src/lib.rs @@ -406,7 +406,7 @@ mod tests { assert_eq!(signature, tx_signature); // Check if the signature is what we expect it to be - assert_eq!(signature, Signature::from_str("df91e8ae723165f9a28b70910e3da41300da413607065618522f3084c9f051114acb1b51a836bd63c3d84a1ac904bf37b82ef03973c19026b266d04872f170a6")?); + assert_eq!(signature, Signature::from_str("d7027be16db0aada625ac8cd438f9b6187bd74465495ba39511c1ad72b7bb10af4ef582c94cc33433f7a1eb4f2ad21c471473947f5f645e90924ba273e2cee7f")?); // Recover the address that signed the transaction let recovered_address = signature.recover(&message)?; diff --git a/packages/fuels-accounts/src/provider.rs b/packages/fuels-accounts/src/provider.rs index ab56813277..4666210800 100644 --- a/packages/fuels-accounts/src/provider.rs +++ b/packages/fuels-accounts/src/provider.rs @@ -12,7 +12,7 @@ use fuel_tx::{AssetId, ConsensusParameters, Receipt, ScriptExecutionResult, TxId use fuel_types::{Address, Bytes32, ChainId, MessageId, Nonce}; use fuel_vm::state::ProgramState; use fuels_core::{ - constants::{BASE_ASSET_ID, DEFAULT_GAS_ESTIMATION_TOLERANCE, MAX_GAS_PER_TX}, + constants::{BASE_ASSET_ID, DEFAULT_GAS_ESTIMATION_TOLERANCE}, types::{ bech32::{Bech32Address, Bech32ContractId}, block::Block, @@ -527,7 +527,7 @@ impl Provider { let tolerance = tolerance.unwrap_or(DEFAULT_GAS_ESTIMATION_TOLERANCE); // Remove limits from an existing Transaction for accurate gas estimation - let dry_run_tx = Self::generate_dry_run_tx(tx.clone()); + let dry_run_tx = self.generate_dry_run_tx(tx.clone()); let gas_used = self .get_gas_used_with_tolerance(dry_run_tx.clone(), tolerance) .await?; @@ -551,9 +551,10 @@ impl Provider { } // Remove limits from an existing Transaction to get an accurate gas estimation - fn generate_dry_run_tx(tx: T) -> T { - // Simulate the contract call with MAX_GAS_PER_TX to get the complete gas_used - tx.clone().with_gas_limit(MAX_GAS_PER_TX).with_gas_price(0) + fn generate_dry_run_tx(&self, tx: T) -> T { + // Simulate the contract call with max gas to get the complete gas_used + let max_gas_per_tx = self.consensus_parameters.max_gas_per_tx; + tx.clone().with_gas_limit(max_gas_per_tx).with_gas_price(0) } // Increase estimated gas by the provided tolerance diff --git a/packages/fuels-core/src/utils/constants.rs b/packages/fuels-core/src/utils/constants.rs index 8880059863..23673d4287 100644 --- a/packages/fuels-core/src/utils/constants.rs +++ b/packages/fuels-core/src/utils/constants.rs @@ -6,7 +6,7 @@ pub const WORD_SIZE: usize = core::mem::size_of::(); // ANCHOR: default_tx_parameters pub const DEFAULT_GAS_PRICE: u64 = 0; -pub const DEFAULT_GAS_LIMIT: u64 = 100_000_000; +pub const DEFAULT_GAS_LIMIT: u64 = 10_000_000; pub const DEFAULT_MATURITY: u32 = 0; // ANCHOR_END: default_tx_parameters @@ -17,5 +17,3 @@ pub const BASE_ASSET_ID: AssetId = AssetId::BASE; // ANCHOR_END: default_call_parameters pub const DEFAULT_GAS_ESTIMATION_TOLERANCE: f64 = 0.2; -pub const GAS_PRICE_FACTOR: u64 = 1_000_000_000; -pub const MAX_GAS_PER_TX: u64 = 100_000_000;