Skip to content

Releases: FuelLabs/fuels-rs

v0.53.0

29 Nov 23:06
2fe88f7
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.52.0...v0.53.0

Breaking changes

  • U256 is not supported anymore. If used in sway, the SDK will return a runtime error.

v0.52.0

28 Nov 00:55
721d0f5
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.51.0...v0.52.0

Breaking changes

  • ScriptTransactionBuilder and CreateTransactionBuilder do not have with_maturity and with_gas_price, (with_gas_limit). They are set through the with_tx_policies method;
  • Maturity is not set to 0 by default - instead, we use an Option<u64> and None if it was not set. This saves bytes as it is not serialized if None;
  • WitnessLimit is set to the size of all witnesses in the builder. If the user uses append_witnesses after finalizing the transaction, a new error will be returned that helps the user set the witness limit manually.

v0.51.0

20 Nov 15:40
041c48f
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.50.1...v0.51.0

Breaking changes

TxParameters are replaced with TxPolicies

The TxParameters, which were previously used to define transaction parameters, have been replaced with TxPolicies. This change signifies a shift in how transactions are specified and managed.

GasPrice and Maturity fields are optional

In the new system, the GasPrice and Maturity fields are no longer mandatory. This offers more flexibility in transaction creation, allowing these fields to be specified only when needed.

TxPolicies introduced new fields:

WitnessLimit

The WitnessLimit field in TxPolicies sets a limit on the maximum size of witnesses in bytes, introducing a new constraint on transaction witnesses.

MaxFee

The MaxFee field specifies the upper limit for the transaction fee that a user is willing to pay, providing a clear boundary for transaction costs.

ScriptGasLimit only limits script execution

Previously, ScriptGasLimit also limited the predicate execution time, but this is no longer the case. It's now solely used for limiting script execution. The MaxFee policy has been introduced to handle transaction cost limitations, and the GasLimit field has been removed from the Create transaction.

New WitnessLimit impacts max_gas and max_fee calculation

The introduction of WitnessLimit affects the calculation of max_gas and max_fee, particularly in Create transactions where it's the sole factor influencing these values.

Minimal gas charges for transaction ID calculation

Even the minimal gas charge now includes the cost of calculating the transaction ID, adding an additional fee component to every transaction.

Setting the GasPrice policy is mandatory for each transaction

Every transaction now requires a GasPrice policy to be set, making it a mandatory element in transaction creation.

Changes in GasLimit and MAX_GAS_PER_TX rules

With the removal of the GasLimit field from the Create transaction, the max_gas for any transaction must now be less than or equal to MAX_GAS_PER_TX. Transactions that do not adhere to this rule will fail.

Transaction rejection conditions

Transactions will be rejected if max_fee exceeds the specified policies.max_fee, or if witnessses_size is greater than the policies.witness_limit.

get_message_proof now uses Nonce

The function get_message_proof has shifted from using the message_id to now utilizing Nonce, altering its operational mechanism.

Predicates no longer use ChainId for address calculation

In predicates, the ChainId is no longer used for calculating addresses, indicating a change in the method of address derivation.

manual_blocks_enabled replaced with debug

In the local chain configuration, manual_blocks_enabled has been superseded by the debug option, reflecting a change in configuration parameters.

fee_checked_from_tx utilizes FeeParameters

The process of fee checking from transactions (fee_checked_from_tx) now employs FeeParameters, indicating a shift in the fee verification approach.

Refactoring of fuel_tx::ConsensusParameters

The fuel_tx::ConsensusParameters have undergone refactoring, which has implications for their usage and implementation.

Necessity of BuildableTransaction trait in transaction builder

When building a transaction with a transaction builder, the BuildableTransacion trait needs to be in scope, highlighting a requirement in the transaction construction process.

Default enabling of utxo_validation and manual_blocks

For test providers, utxo_validation and manual_blocks are now enabled by default, simplifying the setup process for testing environments.

Changes in node configuration: Replacing local_node with default

The node configuration no longer includes local_node. Instead, default is used (e.g., let node_config = Config::default();), reflecting a change in the configuration approach.

TransactionType no longer implements Transaction. Users need to match and extract the inner tx.

v0.50.1

08 Nov 08:26
dd5b6b2
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.49.0...v0.50.1

Breaking changes

Result returns

The following functions are now returning a Result object:

  • launch_provider_and_get_wallet()
  • launch_custom_provider_and_get_wallets()
  • setup_test_provider()
  • setup_test_client()

v0.49.0

10 Oct 21:06
626334a
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.48.0...v0.49.0

v0.48.0

11 Sep 20:51
1113751
Compare
Choose a tag to compare

What's Changed

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

30 Aug 14:57
bd3345e
Compare
Choose a tag to compare

What's Changed

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

  1. set_contract_ids -> with_contract_ids
  2. set_gas_forwarded -> with_gas_forwarded
  3. CallParameters::default().set_amount(deposit_amount).set_asset_id(base_asset_id); -> CallParameters::default().with_amount(deposit_amount).with_asset_id(base_asset_id);
  4. 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 StringArrays.

This only affects you if you use ParamTypes 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

15 Aug 19:39
d71c88f
Compare
Choose a tag to compare

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

14 Aug 14:54
ad6586f
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.45.0...v0.45.1

v0.45.0

09 Aug 21:09
0057ef0
Compare
Choose a tag to compare

What's Changed

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.