Skip to content

Commit

Permalink
Upgrade to fuel-core 0.18.1 and fuels-rs 0.41 (FuelLabs#4525)
Browse files Browse the repository at this point in the history
The PR fixes breakings changes from the `fuel-core 0.18.1` and `fuels-rs
0.41`.

- The `__smo` is reworked and doesn't require an output index because we
removed the `Output::Message` variant.
- Replaced the old deploy API with a new one, `Contract::deploy` ->
`Contract::load_from().deploy()`.
- The signing of the transaction and predicate id calculation requires
`ChainId` now. It breaks the API in some places. In tests, I used the
default chain id, but from the `forc` perspective we need to add the
ability to specify it.
- `fuels-signers` was renamed into `fuels-accounts`.
- We reworked `fuel_tx::Input` and now each variant of the enum has a
named type.
- Replaced all unsafe code from `fuel-crypto` with safe analog.
- On the `fuel-tx`/`fuel-core` side now, there is a difference in
whether the message contains data. If data is empty, it is `MessageCoin`
that acts like a `Coin`(has the same rules during execution). If the
data field is not empty, then it is a retryable message(or
`MessageData`). Messages like this can't be used to pay a transaction
fee, and if the execution fails, the message is not consumed(you can use
it again in the next transactions). More about them you can read in
FuelLabs/fuel-core#946. Also, the API changed
for resources and not it is `Coins` again. Because of that, some tests
now require messages with empty data to be able to spend them.
- Removed redundant usage of `MessageId` and corresponding fields. Now
the identifier of the message is a `Nonce`.
- Removed `Output::Message`. Now you don't need to specify it in the
outputs. Because of that `SMO` opcode doesn't require a message output
index anymore.
- We unified block height(in some places it was `u32` in some `u64`) by
introducing the `BlockHeight` type.
- The `nonce` in the `Message` is a `Bytes32` now instead of
`u64`(affected `input_message_nonce` GTF).
- Reworked the handling of the `Intrinsic::Smo`. Previously `fuel-vm`
expected `smo(r1: receipt_and_message_ptr, r2: size_of_the_message, r3:
output_index, r4: amount)` but we updated that to be `smo(r1:
receipt_ptr, r2: message_ptr, r3: size_of_the_message, r4: amount)` -
according to the specification.
- Removed `input_message_msg_id` GTF.
- Now tokens should be transferred to the contract first, and after you
can transfer them via `SMO` or another transfer. So in some tests first
we need to transfer money to the contract first.
- The `fuels-rs` now generates a separate structure for encoder
`{Contract_name}Encoder`.

This PR is based on the FuelLabs/fuels-rs#950
and causes cycle dependencies. The `fuels-rs` should be released first
and after we can apply it.

---------

Co-authored-by: Sophie Dankel <[email protected]>
Co-authored-by: iqdecay <[email protected]>
Co-authored-by: Kaya Gökalp <[email protected]>
  • Loading branch information
4 people authored May 31, 2023
1 parent 08c5bc1 commit 999410c
Show file tree
Hide file tree
Showing 74 changed files with 1,272 additions and 2,279 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ jobs:
runs-on: ubuntu-latest
services:
fuel-core:
image: ghcr.io/fuellabs/fuel-core:v0.17.8
image: ghcr.io/fuellabs/fuel-core:v0.18.1
ports:
- 4000:4000
steps:
Expand Down
Loading

0 comments on commit 999410c

Please sign in to comment.