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(())
}