Skip to content

Commit

Permalink
chore: bump fuels-rs to v0.64.0, fuel-core to v0.28.0 (#6187)
Browse files Browse the repository at this point in the history
## Description

Bumps fuel-rs to v0.64.0 to support fuel-core v0.28.0. No need to cut a
release for now, as we probably want to bump to v0.30.0. That is blocked
for now as sdk v0.65.0 is not released yet.
  • Loading branch information
kayagokalp authored Jun 27, 2024
1 parent 8d0ef70 commit 012244d
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 181 deletions.
94 changes: 47 additions & 47 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ exclude = [

[workspace.dependencies]
# Dependencies from the `fuel-core` repository:
fuel-core-client = { version = "0.27.0", default-features = false }
fuel-core-types = { version = "0.27.0", default-features = false }
fuel-core-client = { version = "0.28.0", default-features = false }
fuel-core-types = { version = "0.28.0", default-features = false }

# Dependencies from the `fuel-vm` repository:
fuel-asm = "0.50.0"
fuel-crypto = "0.50.0"
fuel-types = "0.50.0"
fuel-tx = "0.50.0"
fuel-vm = "0.50.0"
fuel-asm = "0.52.0"
fuel-crypto = "0.52.0"
fuel-types = "0.52.0"
fuel-tx = "0.52.0"
fuel-vm = "0.52.0"

# Dependencies from the `fuels-rs` repository:
fuels-core = "0.63.0"
fuels-accounts = "0.63.0"
fuels-core = "0.64.0"
fuels-accounts = "0.64.0"

# Dependencies from the `forc-wallet` repository:
forc-wallet = "0.8.0"
forc-wallet = "0.8.1"

# Dependencies from the `fuel-abi-types` repository:
fuel-abi-types = "0.5.0"
Expand Down
16 changes: 7 additions & 9 deletions forc-plugins/forc-client/src/util/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use fuel_tx::{
};
use fuels_accounts::provider::Provider;
use fuels_core::{
constants::DEFAULT_GAS_ESTIMATION_BLOCK_HORIZON, types::transaction_builders::DryRunner,
constants::DEFAULT_GAS_ESTIMATION_BLOCK_HORIZON, types::transaction::ScriptTransaction,
};

fn no_spendable_input<'a, I: IntoIterator<Item = &'a Input>>(inputs: I) -> bool {
Expand Down Expand Up @@ -47,15 +47,13 @@ pub(crate) async fn get_script_gas_used(mut tx: Script, provider: &Provider) ->
let max_gas = tx.max_gas(consensus_params.gas_costs(), consensus_params.fee_params()) + 1;
// Increase `script_gas_limit` to the maximum allowed value.
tx.set_script_gas_limit(max_gas_per_tx - max_gas);
let script_tx = ScriptTransaction::from(tx);

get_gas_used(Transaction::Script(tx), provider).await
}

/// Returns gas_used for an arbitrary tx, by doing dry run with the provided `Provider`.
pub(crate) async fn get_gas_used(tx: Transaction, provider: &Provider) -> Result<u64> {
let tolerance = 0.1;
let gas_used = provider.dry_run_and_get_used_gas(tx, tolerance).await?;
Ok(gas_used)
let estimated_tx_cost = provider
.estimate_transaction_cost(script_tx, Some(tolerance), None)
.await?;
Ok(estimated_tx_cost.gas_used)
}

/// Returns an estimation for the max fee of `Create` transactions.
Expand Down Expand Up @@ -99,7 +97,7 @@ pub(crate) async fn get_estimated_max_fee(
let tx = Transaction::from(tx);

let tx_status = client
.dry_run_opt(&[tx], Some(false))
.dry_run(&[tx])
.await
.map(|mut status_vec| status_vec.remove(0))?;
let total_fee = match tx_status.result {
Expand Down
3 changes: 2 additions & 1 deletion forc-plugins/forc-client/src/util/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ impl<Tx: Buildable + field::Witnesses + Send> TransactionBuilderExt<Tx> for Tran
let wallet = Wallet::from_address(Bech32Address::from(address), Some(provider));

let amount = 1_000_000;
let filter = None;
let inputs: Vec<_> = wallet
.get_spendable_resources(asset_id, amount)
.get_spendable_resources(asset_id, amount, filter)
.await?
.into_iter()
.map(|coin_type| match coin_type {
Expand Down
8 changes: 5 additions & 3 deletions forc-test/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ use rand::{Rng, SeedableRng};

use tx::Receipt;

use vm::interpreter::InterpreterParams;
use vm::interpreter::{InterpreterParams, MemoryInstance};
use vm::state::DebugEval;
use vm::state::ProgramState;

/// An interface for executing a test within a VM [Interpreter] instance.
#[derive(Debug, Clone)]
pub struct TestExecutor {
pub interpreter: Interpreter<MemoryStorage, tx::Script, NotSupportedEcal>,
pub interpreter: Interpreter<MemoryInstance, MemoryStorage, tx::Script, NotSupportedEcal>,
pub tx: vm::checked_transaction::Ready<tx::Script>,
pub test_entry: PkgTestEntry,
pub name: String,
Expand Down Expand Up @@ -118,9 +118,11 @@ impl TestExecutor {
.map_err(|e| anyhow::anyhow!("{e:?}"))?;

let interpreter_params = InterpreterParams::new(gas_price, &consensus_params);
let memory_instance = MemoryInstance::new();
let interpreter = Interpreter::with_storage(memory_instance, storage, interpreter_params);

Ok(TestExecutor {
interpreter: Interpreter::with_storage(storage, interpreter_params),
interpreter,
tx,
test_entry: test_entry.clone(),
name,
Expand Down
Loading

0 comments on commit 012244d

Please sign in to comment.