Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade fuels-rs sdk to 0.70 #6851

Merged
merged 42 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3cfe7e2
forc-wallet 0.11 -> 0.12
zees-dev Jan 22, 2025
48b9a1f
fuel-vm 0.58 -> 0.59
zees-dev Jan 22, 2025
cd27764
fuels-rs 0.66.10 -> 0.70
zees-dev Jan 22, 2025
fc8174d
fuels-core 0.40 -> 0.41
zees-dev Jan 22, 2025
ec62e02
fuel-abi-types 0.7 -> 0.8
zees-dev Jan 22, 2025
5279f4b
test sdk-harness version updates
zees-dev Jan 22, 2025
480580c
cargo.lock updates
zees-dev Jan 22, 2025
c5916cb
trait get_asset_inputs_for_amount fn migration from Account to ViewOn…
zees-dev Jan 22, 2025
40969d9
base asset id retrieval updated - using concensus params from provider
zees-dev Jan 22, 2025
1288304
tx builder checked tx into_ready use None blockheight - no expiry
zees-dev Jan 22, 2025
665af0b
print_instruction impl for ECOP and EPAR opcodes
zees-dev Jan 22, 2025
46a6d06
removed unused derivateive dependency
zees-dev Jan 22, 2025
36134c0
updated sdk-harness Cargo.lock
zees-dev Jan 22, 2025
d7e04ed
fuel core upd; 0.41.0 -> 0.41.2
zees-dev Jan 24, 2025
ad7bf6e
sdk-harness: fuel core upd; 0.41.0 -> 0.41.2
zees-dev Jan 24, 2025
e976b9e
addressed test failures due to base asset id
zees-dev Jan 24, 2025
a73828f
updated broken test; needs validation
zees-dev Jan 27, 2025
dc3ba67
fixed sdk harness cargo.lock
zees-dev Jan 28, 2025
4aacbad
Merge branch 'master' into zees/sdk-0.77
sdankel Jan 30, 2025
fa70116
fuel core client upd 0.41.2 -> 0.41.4
zees-dev Jan 30, 2025
8da8f39
sdk-harness fuel core client upd 0.41.2 -> 0.41.4
zees-dev Jan 30, 2025
97baf67
fixed tests which required burning explicitly enabled
zees-dev Jan 30, 2025
638f378
fixed input_message_msg_sender_from_contract; deployer actually deplo…
zees-dev Jan 30, 2025
bdf3f6f
fixed get_contracts; deployment_wallet performs the contract deployment
zees-dev Jan 30, 2025
675f8d9
fixed setup_output_predicate helper function
zees-dev Jan 30, 2025
ad62962
can_get_witness_in_tx_blob - removed unused witness var
zees-dev Jan 30, 2025
e7117e7
fixed can_get_input_type
zees-dev Jan 30, 2025
230568a
fixed can_get_tx_input_coin_owner
zees-dev Jan 30, 2025
363b9b8
fixed can_get_input_coin_predicate
zees-dev Jan 30, 2025
8e26367
fixed can_get_input_message_recipient
zees-dev Jan 30, 2025
0afb874
fixed can_get_input_message_nonce
zees-dev Jan 30, 2025
3710488
fixed can_get_input_message_witness_index
zees-dev Jan 30, 2025
f5e69a9
fixed can_get_input_message_data_length
zees-dev Jan 30, 2025
1f7ef08
fixed can_get_input_message_predicate_length
zees-dev Jan 30, 2025
e17804f
fixed can_get_input_message_data
zees-dev Jan 30, 2025
6d77bad
fixed can_get_input_message_data_with_offset
zees-dev Jan 30, 2025
3420350
fixed can_get_input_message_predicate
zees-dev Jan 30, 2025
b721224
fixed can_get_output_count_in_tx_upload
zees-dev Jan 30, 2025
dd01af5
fixed can_get_output_count_in_tx_blob
zees-dev Jan 30, 2025
f0850fd
updating transitive fuel core deps; 0.41.0 -> 0.41.4
zees-dev Jan 30, 2025
d4ae5ba
fix last tests
hal3e Jan 31, 2025
f647c3d
Merge branch 'master' into zees/sdk-0.77
zees-dev Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
702 changes: 405 additions & 297 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,31 +79,31 @@ sway-ir-macros = { path = "sway-ir/sway-ir-macros", version = "0.66.6" }
#

# Dependencies from the `fuel-abi-types` repository:
fuel-abi-types = "0.7"
fuel-abi-types = "0.8"

# Dependencies from the `fuel-core` repository:
#
# Although ALL verions are "X.Y", we need the complete semver for
# fuel-core-client as the GitHub Actions workflow parses this value to pull down
# the correct tarball
fuel-core-client = { version = "0.40.0", default-features = false }
fuel-core-types = { version = "0.40", default-features = false }
fuel-core-client = { version = "0.41.4", default-features = false }
fuel-core-types = { version = "0.41", default-features = false }

# Dependencies from the `fuels-rs` repository:

fuels = "0.66.10"
fuels-core = "0.66.10"
fuels-accounts = "0.66.10"
fuels = "0.70"
fuels-core = "0.70"
fuels-accounts = "0.70"

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

# Dependencies from the `forc-wallet` repository:
forc-wallet = "0.11"
forc-wallet = "0.12"

#
# External dependencies
Expand All @@ -129,7 +129,6 @@ comrak = "0.28"
crossbeam-channel = "0.5"
dap = "0.4.1-alpha"
dashmap = "6.1"
derivative = "2.2"
devault = "0.2"
dialoguer = "0.11"
dirs = "5.0"
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-client/src/op/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use fuels::{
transaction_builders::{BuildableTransaction, VariableOutputPolicy},
},
};
use fuels_accounts::{provider::Provider, Account};
use fuels_accounts::{provider::Provider, Account, ViewOnlyAccount};
use pkg::BuiltPackage;
use std::time::Duration;
use std::{path::PathBuf, str::FromStr};
Expand Down
41 changes: 21 additions & 20 deletions forc-plugins/forc-client/src/util/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,14 @@ pub enum ForcClientAccount {

#[async_trait]
impl Account for ForcClientAccount {
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Result<Vec<Input>> {
match self {
ForcClientAccount::Wallet(wallet) => {
wallet
.get_asset_inputs_for_amount(asset_id, amount, excluded_coins)
.await
}
ForcClientAccount::KmsSigner(account) => {
account
.get_asset_inputs_for_amount(asset_id, amount, excluded_coins)
.await
}
}
}

fn add_witnesses<Tb: TransactionBuilder>(&self, tb: &mut Tb) -> Result<()> {
tb.add_signer(self.clone())?;

Ok(())
}
}

#[async_trait]
zees-dev marked this conversation as resolved.
Show resolved Hide resolved
impl ViewOnlyAccount for ForcClientAccount {
fn address(&self) -> &Bech32Address {
match self {
Expand All @@ -67,6 +48,26 @@ impl ViewOnlyAccount for ForcClientAccount {
ForcClientAccount::KmsSigner(account) => Ok(account.provider()),
}
}

async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
amount: u64,
excluded_coins: Option<Vec<CoinTypeId>>,
) -> Result<Vec<Input>> {
match self {
ForcClientAccount::Wallet(wallet) => {
wallet
.get_asset_inputs_for_amount(asset_id, amount, excluded_coins)
.await
}
ForcClientAccount::KmsSigner(account) => {
account
.get_asset_inputs_for_amount(asset_id, amount, excluded_coins)
.await
}
}
}
}

#[async_trait]
Expand Down
7 changes: 4 additions & 3 deletions forc-plugins/forc-client/src/util/aws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ impl Signer for AwsSigner {
}
}

#[async_trait]
impl ViewOnlyAccount for AwsSigner {
fn address(&self) -> &Bech32Address {
&self.bech
Expand All @@ -249,10 +250,7 @@ impl ViewOnlyAccount for AwsSigner {
fn try_provider(&self) -> Result<&Provider> {
Ok(&self.provider)
}
}

#[async_trait]
impl Account for AwsSigner {
async fn get_asset_inputs_for_amount(
&self,
asset_id: AssetId,
Expand All @@ -267,3 +265,6 @@ impl Account for AwsSigner {
.collect::<Vec<Input>>())
}
}

#[async_trait]
impl Account for AwsSigner {}
5 changes: 3 additions & 2 deletions forc-plugins/forc-client/src/util/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,13 @@ pub(crate) async fn select_account(
let wallet_path = default_wallet_path();
let accounts = collect_user_accounts(&wallet_path, password)?;
let account_balances = collect_account_balances(&accounts, provider).await?;
let base_asset_id = provider.base_asset_id();
let consensus_parameters = provider.consensus_parameters().await?;
let base_asset_id = consensus_parameters.base_asset_id();

let total_balance = account_balances
.iter()
.flat_map(|account| account.values())
.sum::<u64>();
.sum::<u128>();
if total_balance == 0 {
let first_account = accounts
.get(&0)
Expand Down
20 changes: 11 additions & 9 deletions forc-plugins/forc-client/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ async fn test_non_owner_fails_to_set_target() {
SecretKey::from_str(forc_client::constants::DEFAULT_PRIVATE_KEY).unwrap();
let owner_wallet =
WalletUnlocked::new_from_private_key(owner_secret_key, Some(provider.clone()));
let base_asset_id = provider.base_asset_id();
let consensus_parameters = provider.consensus_parameters().await.unwrap();
let base_asset_id = consensus_parameters.base_asset_id();

// Fund attacker wallet so that it can try to make a set proxy target call.
owner_wallet
Expand Down Expand Up @@ -1052,7 +1053,8 @@ async fn deployed_predicate_call() {
));

let provider = Provider::connect(&node_url).await.unwrap();
let base_asset_id = *provider.base_asset_id();
let consensus_parameters = provider.consensus_parameters().await.unwrap();
let base_asset_id = consensus_parameters.base_asset_id();
let secret_key = SecretKey::from_str(forc_client::constants::DEFAULT_PRIVATE_KEY).unwrap();
let wallet_unlocked = WalletUnlocked::new_from_private_key(secret_key, Some(provider.clone()));
let loader_path = tmp_dir.path().join("out/deployed_predicate-loader.bin");
Expand All @@ -1074,32 +1076,32 @@ async fn deployed_predicate_call() {
wallet_unlocked
.transfer(
predicate.address(),
500,
base_asset_id,
2000,
zees-dev marked this conversation as resolved.
Show resolved Hide resolved
*base_asset_id,
TxPolicies::default(),
)
.await
.unwrap();

// Check predicate balance.
let balance = predicate.get_asset_balance(&base_asset_id).await.unwrap();
assert_eq!(balance, 500);
let balance = predicate.get_asset_balance(base_asset_id).await.unwrap();
assert_eq!(balance, 2000);

// Try to spend it
let amount_to_unlock = 300;
predicate
.transfer(
wallet_unlocked.address(),
amount_to_unlock,
base_asset_id,
*base_asset_id,
TxPolicies::default(),
)
.await
.unwrap();

// Check predicate balance again.
let balance = predicate.get_asset_balance(&base_asset_id).await.unwrap();
assert_eq!(balance, 200);
let balance = predicate.get_asset_balance(base_asset_id).await.unwrap();
assert_eq!(balance, 828);

node.kill().unwrap();
}
Expand Down
1 change: 1 addition & 0 deletions forc-test/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl TestExecutor {
gas_price,
consensus_params.gas_costs(),
consensus_params.fee_params(),
None,
)
.map_err(|e| anyhow::anyhow!("{e:?}"))?;

Expand Down
4 changes: 2 additions & 2 deletions forc-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl PackageWithDeploymentToTest {
.map(|(contract_id, tx)| {
// Transact the deployment transaction constructed for this contract dependency.
let tx = tx
.into_ready(gas_price, params.gas_costs(), params.fee_params())
.into_ready(gas_price, params.gas_costs(), params.fee_params(), None)
.unwrap();
interpreter.transact(tx).map_err(anyhow::Error::msg)?;
Ok(contract_id)
Expand All @@ -247,7 +247,7 @@ impl PackageWithDeploymentToTest {
&params,
);
let root_contract_tx = root_contract_tx
.into_ready(gas_price, params.gas_costs(), params.fee_params())
.into_ready(gas_price, params.gas_costs(), params.fee_params(), None)
.unwrap();
// Deploy the root contract.
interpreter
Expand Down
1 change: 0 additions & 1 deletion sway-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ repository.workspace = true

[dependencies]
clap = { workspace = true, features = ["derive"] }
derivative.workspace = true
dirs.workspace = true
either.workspace = true
ethabi.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions sway-core/src/asm_generation/finalized_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ fn print_instruction(op: &Instruction) {
Instruction::ECAL(x) => f("ECAL", x.unpack()),
Instruction::BSIZ(x) => f("BSIZ", x.unpack()),
Instruction::BLDD(x) => f("BLDD", x.unpack()),
Instruction::ECOP(x) => f("ECOP", x.unpack()),
Instruction::EPAR(x) => f("EPAR", x.unpack()),
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/src/e2e_vm_tests/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub(crate) fn runs_in_vm(

let tx = tb
.finalize_checked(block_height)
.into_ready(gas_price, params.gas_costs(), params.fee_params())
.into_ready(gas_price, params.gas_costs(), params.fee_params(), None)
.map_err(|e| anyhow::anyhow!("{e:?}"))?;

let mem_instance = MemoryInstance::new();
Expand Down
Loading
Loading