Releases: FuelLabs/fuels-rs
v0.49.0
What's Changed
- bug: fix for memory issue by @segfault-magnet in #1066
- feat: add retry mechanism by @Salka1988 in #1035
- chore(deps): remove unused deps, add corresponding CI check by @Br1ght0ne in #1140
- fix(ci): ignore testnet_hello_world test by @Br1ght0ne in #1143
- feat: pull tx param defaults from network by @MujkicA in #1121
- docs: use correct method names by @hal3e in #1146
- refactor: use
TxStatus
to map revert errors by @hal3e in #1142 - feat: check deploy tx status by @hal3e in #1145
- test: encode large unsigned integers by @iqdecay in #1150
- chore(docs): use variables for docs.rs links by @Br1ght0ne in #1098
- feat: return Enums containing heap types at depth 1 by @iqdecay in #1106
- feat: bump
forc
to0.46.0
by @hal3e in #1148 - bug: unused generic type parameters by @segfault-magnet in #1136
- feat: securely zero out
SecretKey
s from memory by @Br1ght0ne in #1161 - feat: return
str
from contracts by @hal3e in #1159 - Bump versions to 0.49.0 by @digorithm in #1162
Full Changelog: v0.48.0...v0.49.0
v0.48.0
What's Changed
- chore: remove
non_snake_case
warning for configurables by @hal3e in #1110 - feat: return result from
call_data!
by @hal3e in #1112 - feat: update tests to beta-4 by @MujkicA in #1119
- chore: bump
forc
to0.45.0
by @hal3e in #1109 - feat!: autoload storage slots by @segfault-magnet in #1120
- docs: add CONTRIBUTING.md by @paplo75 in #1103
- feat: use
REG_CGAS
as default forwarded gas by @hal3e in #1122 - fix!: predicate cost estimation by @hal3e in #1124
- Bump versions to 0.48.0 by @digorithm in #1131
New Contributors
Full Changelog: v0.47.0...v0.48.0
Breaking changes and new features
Predicate gas estimation fix
Recently, we've had an issue with estimating gas in predicates. This release fixes it but introduces some small API changes: calculate_base_amount_with_fee()
now returns an Option<64>
. We also went from fn fee_checked_from_tx(&self, params: &ConsensusParameters) -> Option<TransactionFee>;
to fn fee_checked_from_tx(&self, params: &ConsensusParameters) -> Result<Option<TransactionFee>>;
Storage slots autoload
Automatic Loading of Storage Slots: Storage slots are now autoloaded by default to simplify and optimize the integration process. Should you wish to opt-out, an option is readily available.
When the StorageConfiguration
indicates that autoload should be enabled, Contract::load_from
will attempt to find the storage slots file within the same directory as the contract binary. This ensures a seamless experience without needing additional configuration in typical setups.
Enhancements related to this feature:
Guided Error Handling: The SDK will generate an error if the storage slots file is missing. In this scenario, you will be given guidance to source the required file or deactivate the autoload feature to help the user.
Priority Configuration: Users can still manually configure storage slots in StorageConfiguration. This manual configuration will precede the default settings autoloaded from the storage slots file.
Bug Fix: Rectified an error exposed by the autoload feature. Previously, the system did not properly account for storage slots during the computation of the heap data offset for predicates. This has now been addressed.
Breaking Changes:
Updated Storage Configuration Interface: As you know, modifications have been made to the storage configuration interface. Please review the documentation to understand these changes and adjust your setups accordingly.
Behavioural Adjustments with Autoloading: Since storage slots are now autoloaded by default, some users may notice differences in system behaviour. Assessing this feature in your context is important to ensure it aligns with your project's requirements.
This is how the usage around storage slots look like:
#[tokio::test]
async fn storage_slots_override() -> Result<()> {
{
// ANCHOR: storage_slots_override
use fuels::{programs::contract::Contract, tx::StorageSlot};
let slot_override = StorageSlot::new([1; 32].into(), [2; 32].into());
let storage_config =
StorageConfiguration::default().add_slot_overrides([slot_override]);
let load_config =
LoadConfiguration::default().with_storage_configuration(storage_config);
let _: Result<Contract> = Contract::load_from("...", load_config);
// ANCHOR_END: storage_slots_override
}
{
// ANCHOR: storage_slots_disable_autoload
use fuels::programs::contract::Contract;
let storage_config = StorageConfiguration::default().with_autoload(false);
let load_config =
LoadConfiguration::default().with_storage_configuration(storage_config);
let _: Result<Contract> = Contract::load_from("...", load_config);
// ANCHOR_END: storage_slots_disable_autoload
}
Ok(())
}
v0.47.0
What's Changed
- chore: remove forc patch branch by @hal3e in #1083
- separate send_transaction and get_receipts by @Salka1988 in #1073
- chore: check doc links for private items in CI by @Br1ght0ne in #1095
- style!: unify string type names by @iqdecay in #1090
- style!: rename 'set_' to 'with_' by @MujkicA in #1096
- feat!: resolve witness indexes automatically by @hal3e in #1069
- fix: validate multi-calls wrt to heap types by @hal3e in #1100
- chore: replace deprecated
chrono
functions by @hal3e in #1111 - fix: pull max gas from provider by @MujkicA in #1115
- Bump versions to 0.47.0 by @digorithm in #1116
Full Changelog: v0.46.0...v0.47.0
Breaking changes
*_set
methods renamed to *_with
Some *_set
methods were renamed to *_with
to reflect better the ownership model they follow.
For instance, this:
let configuration = LoadConfiguration::default()
.set_storage_configuration(storage_configuration)
.set_salt(salt);
// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
.set_gas_price(0)
.set_gas_limit(1_000_000)
.set_maturity(0);
Becomes:
let configuration = LoadConfiguration::default()
.with_storage_configuration(storage_configuration)
.with_salt(salt);
// Optional: Configure deployment parameters
let tx_parameters = TxParameters::default()
.with_gas_price(0)
.with_gas_limit(1_000_000)
.with_maturity(0);
As well as
set_contract_ids
->with_contract_ids
set_gas_forwarded
->with_gas_forwarded
CallParameters::default().set_amount(deposit_amount).set_asset_id(base_asset_id);
->CallParameters::default().with_amount(deposit_amount).with_asset_id(base_asset_id);
set_consensus_parameters(consensus_parameters);
->with_consensus_parameters(consensus_parameters);
So, when migrating to this version, some things will break, and to fix it is easy: rename these methods with set
in them to with
, and it should work seamlessly.
String types
Sway's String
type is equivalent to the Rust String
. This change was impossible before because the String name was already taken for statically-sized strings, now called StringArray
s.
This only affects you if you use ParamType
s directly: ParamType::String(len)
is now ParamType::StringArray(len)
and ParamType::StdString
is now ParamType::String
.
Sending transactions doesn't return receipts anymore, only the transaction ID
send_transaction(&tx)
used to wait for the transaction to be completed and then it would return the receipts. That's not the case anymore; Now, it returns the transactions ID and then you use this ID to query for the receipts:
let receipts = self.try_provider()?.send_transaction(&tx).await?;
Becomes
let tx_id = self.try_provider()?.send_transaction(&tx).await?;
let receipts = provider.get_receipts(&tx_id).await?;
This allows more flexibility to send transactions asynchronously and then grab the receipts if needed.
v0.46.0
What's Changed
- chore: make get_contract_balances return AssetId and add provider.chain_id() by @MujkicA in #1075
- chore: bump rust and deps versions by @hal3e in #1084
- chore: derive Default for SizedAsciiString by @ra0x3 in #1086
- Bump versions to 0.46.0 by @digorithm in #1087
Full Changelog: v0.45.1...v0.46.0
v0.45.1
What's Changed
- fix: string slice token conversion by @IGI-111 in #1079
- chore:
impl AsRef<[u8]> for SizedAsciiString
by @ra0x3 in #1080 - feat: add
build_tx
toScriptCallHandler
by @hal3e in #1076 - Bump versions to 0.45.1 by @digorithm in #1081
Full Changelog: v0.45.0...v0.45.1
v0.45.0
What's Changed
- chore: use
fuel-asm
instead offuel-vm
by @hal3e in #1032 - feat!: add support for string slices by @IGI-111 in #1044
- docs: fix broken links by @hal3e in #1056
- refactor(fuels): add test for more types in scripts by @Br1ght0ne in #1027
- feat: macro recompile trigger by @segfault-magnet in #1061
- docs: fix
low_level_call
anchor by @hal3e in #1072 - feat: improve missing log decoder error by @hal3e in #1070
- feat(fuels-core): add CoinType::owner() by @Br1ght0ne in #1057
- feat!: add
String
support by @iqdecay in #1042 - ci: add docs workflow by @sarahschwartz in #1068
- feat: make message input w data persist when covering fees by @MujkicA in #1074
- feat!: upgrade
fuel-core
tov0.20.1
by @xgreenx in #1053 - chore: impl Ser + Deser + Hash for SizedAsciiString by @ra0x3 in #1077
- Bump versions to 0.45.0 by @digorithm in #1078
New Contributors
Full Changelog: v0.44.0...v0.45.0
New features
Support for Sway's dynamic string and string slices type;
Usage example:
let contract_methods = contract_instance.methods();
{
let resp = contract_methods.return_dynamic_string().call().await?.value;
assert_eq!(resp, "Hello World");
}
{
let _resp = contract_methods
.accepts_dynamic_string(String::from("Hello World"))
.call()
.await?;
}
See the documentation for more details.
Automatic macro recompile
This means abigen!
and setup_program_test!
macros can now detect file changes.
Improve log decoder error
The log decoder error object now has a data
field.
Support for fuel-core
0.20
This means support for the upcoming beta-4
release of the network.
v0.44.0
What's Changed
- Important: this release drops the support to the beta-3 network. To continue interacting with beta-3 nodes, use previous versions. This release supports the upcoming beta-4 release.
- refactor: remove setter from account trait by @MujkicA in #1004
- chore: update sign_and_verify test by @MujkicA in #1003
- feat: implement
AsRef<[u8]>
forIdentity
type by @iqdecay in #1006 - chore: rename
fn_args_layout
tofn_params_layout
inrustfmt.toml
by @kayagokalp in #994 - docs: show example of block time travel by @iqdecay in #985
- docs: match folders with navigation by @sarahschwartz in #1010
- feat!: add output variable estimation for
ScriptCallHandler
by @MujkicA in #976 - chore: remove unused file by @hal3e in #1015
- ci: use nextest by @segfault-magnet in #1016
- feat: add
WalletUnlocked
toprelude
by @Salka1988 in #1021 - ci: add back doctest testing by @segfault-magnet in #1024
- docs: show README.md for fuels on crates.io by @Br1ght0ne in #1026
- feat: add
U256
support by @hal3e in #1014 - bug: reexport fuel_tx::Output by @segfault-magnet in #1030
- docs: update testnet to beta-3 version by @Salka1988 in #1022
- fix: export
TxPointer
,UtxoId
andNonce
by @hal3e in #1038 - feat: add
LogDecoder
getter for script instances by @hal3e in #1036 - feat: improve transaction builder error by @hal3e in #1037
- test: implement tests over
Bytes
type by @iqdecay in #1041 - feat: add support for DbType::RocksDb by @Salka1988 in #998
- ci: auto setup of PRs and issues by @digorithm in #724
- deps: upgrade
fuel-core
andfuel-vm
crates versions by @iqdecay in #997 - chore: remove pr automation by @hal3e in #1051
- Bump version to 0.44.0 by @Dentosal in #1045
New Contributors
Full Changelog: v0.43.0...v0.44.0
New features and breaking changes
Transaction dependencies estimation for script calls
Similar to the same feature for contract calls. This introduces a breaking change: TxDependencyExtension
needs to be in scope to use append_variable_outputs
and append_contract
.
Support for U256
type
Missing types in the prelude and re-exports
Some types were missing from the main umbrella crate. These were added to it so now you can pull these from fuels
. Types like fuel_tx::Output
, TxPointer
, UtxoId
, Nonce
, and more.
New LogDecoder
getter for script instances
Improved error messages for the transaction builder
Support for configuring the client's RocksDB through the SDK
#[tokio::test]
#[cfg(any(not(feature = "fuel-core-lib"), feature = "rocksdb"))]
async fn create_or_use_rocksdb() -> Result<()> {
use fuels::prelude::*;
use std::path::PathBuf;
// ANCHOR: create_or_use_rocksdb
let provider_config = Config {
database_path: PathBuf::from("/tmp/.spider/db"),
database_type: DbType::RocksDb,
..Config::local_node()
};
// ANCHOR_END: create_or_use_rocksdb
launch_custom_provider_and_get_wallets(Default::default(), Some(provider_config), None)
.await;
Ok(())
}
v0.41.1
v0.43.0
What's Changed
- feat: add
Into
forAddress
andContractId
fn arguments by @hal3e in #967 - chore: impl default for identity by @ra0x3 in #977
- ci: bump forc version by @iqdecay in #988
- chore!: merge
fuels-types
andfuels-core
by @hal3e in #956 - refactor: path of
WalletUnlocked
infuels::accounts
by @Salka1988 in #987 - chore: re-export more
fuel-tx
types by @ra0x3 in #969 - fix: create message type based on data length by @hal3e in #993
- feat: use SDK type for tx in TransactionResponse by @MujkicA in #960
- chore: use
#[allow(dead_code)]
in forc projects by @hal3e in #991 - chore: set
fuel-core
to0.18.2
by @hal3e in #996 - deps: bump fuel-abi-types to v0.3.0 by @kayagokalp in #990
- Bump versions to 0.43.0 by @digorithm in #1002
New Contributors
Full Changelog: v0.42.0...v0.43.0
Breaking changes
No more .into()
when passing contract IDs or addresses to contract methods
Before:
let response = contract_methods
.transfer_coins_to_output(1_000_000, contract_id.into(), address.into())
.append_variable_outputs(1)
.call()
.await?;
After:
let response = contract_methods
.transfer_coins_to_output(1_000_000, contract_id, address)
.append_variable_outputs(1)
.call()
.await?;
v0.42.0
What's Changed
- refactor!: unify type import path by @iqdecay in #934
- feat!: add predicate configurables by @hal3e in #935
- Add predicate code getter by @MujkicA in #941
- chore: reorganize and bump external dependencies by @hal3e in #943
- chore: update
sway
to0.38.0
andfuel-core
to0.17.11
by @xgreenx in #947 - docs: add section comments for devrel by @sarahschwartz in #946
- chore: bump
syn
to2.0
by @hal3e in #957 - feat: add trimming utilities to
SizedAsciiString
by @iqdecay in #955 - chore: default-features warnings on cargo nightly by @Salka1988 in #963
- chore: make api around Salt consistent by @MujkicA in #964
- bug: reexport lost fuels::tx::Output under fuels::types::output::Output by @segfault-magnet in #961
- feat!: add
u128
support by @hal3e in #972 - feat: add gas estimation to script calls by @MujkicA in #973
- feat(contracts): add tx_id to FuelCallResponse by @Br1ght0ne in #734
- feat:
low level call
support by @Salka1988 in #958 - Extend codeowners list by @digorithm in #979
- refactor!: update
sway
andfuel-core
to0.18.1
by @xgreenx in #950 - Bump versions to 0.42.0 by @digorithm in #983
Full Changelog: v0.41.0...v0.42.0
Breaking changes
Types import path changes
- Use
fuels::types::input::Input
instead offuels::tx::input
- Use
fuels::types::coin::Coin
instead offuels::client::schema::coin::Coin
andfuels::tx::Output::Coin
- Use
fuels::types::AssetId
instead offuels::client::schema::AssetId
andfuels::tx::AssetId
- Use
fuels::tx::UtxoId
instead offuels::client::schema::UtxoId
- Use
fuels::types::coin::CoinStatus
instead offuels::client::schema::coin::CoinStatus
- Use
fuels::types::resource::Resource
instead offuels::client::schema::resource::Resource
- Use
fuels_types::types::Bytes32
instead offuel_tx::Bytes32
Configurables for predicates
abigen!(Predicate(
name = "MyPredicate",
abi = "packages/fuels/tests/predicates/predicate_configurables/out/debug/predicate_configurables-abi.json"
));
let new_struct = StructWithGeneric {
field_1: 32u8,
field_2: 64,
};
let new_enum = EnumWithGeneric::VariantTwo;
let configurables = MyPredicateConfigurables::new()
.set_STRUCT(new_struct.clone())
.set_ENUM(new_enum.clone());
let predicate_data = MyPredicateEncoder::encode_data(8u8, true, new_struct, new_enum);
let mut predicate: Predicate = Predicate::load_from(
"tests/predicates/predicate_configurables/out/debug/predicate_configurables.bin",
)?
.with_data(predicate_data)
.with_configurables(configurable);
fuel-core @ 0.18
changes
Note that some of these changes are subject to subsequent changes in future UX improvements.
- Signing the transaction and predicate id generation requires
ChainId
(ConsensusParameters
). - Now, tokens should be transferred to the contract first, and after you can transfer them via
SMO
or another transfer. So in some tests, we first need to transfer money to the contract. - The
produce_blocks
function is updated and doesn't requireTimeParameters
. - Removed redundant usage of
MessageId
. Now the identifier of the message is aNonce
. - Removed
Output::Message
. Now you don't need to specify it in the outputs. Because of thatSMO
opcode doesn't require a message output index. - The proof API is updated with a new design: FuelLabs/fuel-core#1046. To prove the block at height
X
, you need at least a committedX + 1
block. Predicate::set_provider
now returns aResult
because it can fail if the "new" provider has different consensus parameters than the consensus parameters used previouslyPredicate
can be loaded with a provider usingload_from_with_provider
andfrom_code_and_provider
. Thefrom_code
andload_from
remain and use the defaultConsensusParameters
value.Provider::new
now takes aConsensusParameters
argument, so we can avoid changing the API of downstream clients.setup_test_client
now returnsConsensusParameters
of the client. This was either this orsetup_test_provider
would have to change, and the former is much less used than the latter.