Skip to content

Commit 336abcd

Browse files
authored
feat: bump fuel-core to 0.42.0 (#1628)
# Release notes In this release, we: - Bumped `fuel-core` to `0.42.0` - Added support for simulating calls at specific block height # Breaking Changes - **Error Variant Renaming:** - The transaction `Reason` error variant previously named `Reverted` in transaction errors is now renamed to `Failure`. - The associated `revert_id` field is now an `Option<u64>` rather than a plain `u64`. - **Usage:** Update pattern matches and error handling to check for `Error::Transaction(Reason::Failure { .. })` and handle the optional `revert_id` accordingly. - **Execution Simulation API Changes:** - The simulation execution mode has changed from enum variants to a struct with helper functions: - Replace **`Execution::Realistic`** with **`Execution::realistic()`**. - Replace **`Execution::StateReadOnly`** with **`Execution::state_read_only()`**. - To simulate at a specific block height, chain the call with `.at_height(height)`. Note that the node needs to support historical execution. - The `dry_run_opt` method's `utxo_validation` argument changed to `Option<bool>` and a new argument `at_height: Option<BlockHeight>` is added. - The method **`determine_missing_contracts`** no longer accepts an optional parameter; it is now called without arguments and will determine all missing contracts in one simulation. - **`tx_status` changes** - The `Revert` variant has been replaced by the `Failure` variant. - New variants have been added: `PreconfirmationSuccess` and `PreconfirmationFailure`. - The `revert_id` type changed to `Option<u64>` - **Usage:** Update your pattern matching and error handling logic. - **Amount Type Updates:** - Functions across accounts, wallets, predicates, and providers have switched from using `u64` to `u128` for asset amounts. - **Usage:** Modify function calls (e.g., `get_asset_inputs_for_amount`, `adjust_for_fee`, etc.) to pass amounts as `u128` (or convert them using `.into()` if needed). - **Node Configuration Adjustments:** - The `NodeConfig` struct now includes a new boolean field: `historical_execution`. - **Usage:** To use `historical_execution` launch a node (with `rocksdb` enabled) and the `historical_execution` flag set.
1 parent 3f84ea3 commit 336abcd

File tree

31 files changed

+721
-326
lines changed

31 files changed

+721
-326
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
CARGO_TERM_COLOR: always
1717
DASEL_VERSION: https://github.com/TomWright/dasel/releases/download/v2.3.6/dasel_linux_amd64
1818
RUSTFLAGS: "-D warnings"
19-
FUEL_CORE_VERSION: 0.41.7
19+
FUEL_CORE_VERSION: 0.42.0
2020
FUEL_CORE_PATCH_BRANCH: ""
2121
FUEL_CORE_PATCH_REVISION: ""
2222
RUST_VERSION: 1.85.0

Cargo.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,23 @@ testcontainers = { version = "0.23", default-features = false }
9595
k256 = { version = "0.13", default-features = false }
9696

9797
# Dependencies from the `fuel-core` repository:
98-
fuel-core = { version = "0.41.7", default-features = false, features = [
98+
fuel-core = { version = "0.42.0", default-features = false, features = [
9999
"wasm-executor",
100100
] }
101-
fuel-core-chain-config = { version = "0.41.7", default-features = false }
102-
fuel-core-client = { version = "0.41.7", default-features = false }
103-
fuel-core-poa = { version = "0.41.7", default-features = false }
104-
fuel-core-services = { version = "0.41.7", default-features = false }
105-
fuel-core-types = { version = "0.41.7", default-features = false }
101+
fuel-core-chain-config = { version = "0.42.0", default-features = false }
102+
fuel-core-client = { version = "0.42.0", default-features = false }
103+
fuel-core-poa = { version = "0.42.0", default-features = false }
104+
fuel-core-services = { version = "0.42.0", default-features = false }
105+
fuel-core-types = { version = "0.42.0", default-features = false }
106106

107107
# Dependencies from the `fuel-vm` repository:
108-
fuel-asm = { version = "0.59.1" }
109-
fuel-crypto = { version = "0.59.1" }
110-
fuel-merkle = { version = "0.59.1" }
111-
fuel-storage = { version = "0.59.1" }
112-
fuel-tx = { version = "0.59.1" }
113-
fuel-types = { version = "0.59.1" }
114-
fuel-vm = { version = "0.59.1" }
108+
fuel-asm = { version = "0.60.0" }
109+
fuel-crypto = { version = "0.60.0" }
110+
fuel-merkle = { version = "0.60.0" }
111+
fuel-storage = { version = "0.60.0" }
112+
fuel-tx = { version = "0.60.0" }
113+
fuel-types = { version = "0.60.0" }
114+
fuel-vm = { version = "0.60.0" }
115115

116116
# Workspace projects
117117
fuels = { version = "0.71.0", path = "./packages/fuels", default-features = false }

docs/src/calling-contracts/simulation.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
Sometimes you want to simulate a call to a contract without changing the state of the blockchain. This can be achieved by calling `.simulate` instead of `.call` and passing in the desired execution context:
44

5-
* `.simulate(Execution::Realistic)` simulates the transaction in a manner that closely resembles a real call. You need a wallet with base assets to cover the transaction cost, even though no funds will be consumed. This is useful for validating that a real call would succeed if made at that moment. It allows you to debug issues with your contract without spending gas.
5+
* `.simulate(Execution::realistic())` simulates the transaction in a manner that closely resembles a real call. You need a wallet with base assets to cover the transaction cost, even though no funds will be consumed. This is useful for validating that a real call would succeed if made at that moment. It allows you to debug issues with your contract without spending gas.
66

77
```rust,ignore
88
{{#include ../../../examples/contracts/src/lib.rs:simulate}}
99
```
1010

11-
* `.simulate(Execution::StateReadOnly)` disables many validations, adds fake gas, extra variable outputs, blank witnesses, etc., enabling you to read state even with an account that has no funds.
11+
* `.simulate(Execution::state_read_only())` disables many validations, adds fake gas, extra variable outputs, blank witnesses, etc., enabling you to read state even with an account that has no funds.
1212

1313
```rust,ignore
1414
{{#include ../../../examples/contracts/src/lib.rs:simulate_read_state}}
1515
```
16+
17+
If the node supports historical execution (the node is using `rocksdb` and the `historical_execution` flag has been set), then both execution types can be chained with `at_height` to simulate the call at a specific block height.
18+
19+
```rust,ignore
20+
{{#include ../../../examples/contracts/src/lib.rs:simulate_read_state_at_height}}
21+
```

docs/src/calling-contracts/tx-dependency-estimation.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ As mentioned in previous chapters, you can specify the external contract and add
1414
{{#include ../../../examples/contracts/src/lib.rs:dependency_estimation_manual}}
1515
```
1616

17-
But this requires you to know the contract ID of the external contract and the needed number of output variables. Alternatively, by chaining `.estimate_tx_dependencies()` instead, the dependencies will be estimated by the SDK and set automatically. The optional parameter is the maximum number of simulation attempts:
17+
But this requires you to know the contract ID of the external contract and the needed number of output variables. Alternatively, by chaining
18+
19+
- `.with_variable_output_policy(VariableOutputPolicy::EstimateMinimum)` and
20+
- `.determine_missing_contracts()`
21+
22+
the dependencies will be estimated by the SDK and set automatically.
1823

1924
```rust,ignore
2025
{{#include ../../../examples/contracts/src/lib.rs:dependency_estimation}}
2126
```
2227

23-
The minimal number of attempts corresponds to the number of external contracts and output variables needed and defaults to 10.
24-
25-
> **Note:** `estimate_tx_dependencies()` can also be used when working with script calls or multi calls. `estimate_tx_dependencies()` does not currently resolve the dependencies needed for logging from an external contract. For more information, see [here](./logs.md). If no resolution was found after exhausting all simulation attempts, the last received error will be propagated. The same will happen if an error is unrelated to transaction dependencies.
28+
> **Note:** Both `with_variable_output_policy` and `determine_missing_contracts` can also be used when working with script calls or multi calls. `determine_missing_contracts()` will not enable logging from an external contract. For more information, see [here](./other-contracts.md).

0 commit comments

Comments
 (0)