Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: gracefully handle unknown transaction variants #1499

Open
wants to merge 18 commits into
base: 0.67.0-dev2
Choose a base branch
from

Conversation

hal3e
Copy link
Contributor

@hal3e hal3e commented Sep 2, 2024

Closes #1477

Release notes

In this release, we:
will be added later

Summary

fuels-rs is using fuel-core-client to communicate with the node.

fuel-core-client:

  • added a new TransactoinType enum with an Unknown variant to fuel-core-client.
  • added Unknown variants to ConsensusParameters and all of its fields. cynic will fallback to this variant.

fuel-core PR: FuelLabs/fuel-core#2154

Checklist:

  • transaction: fuel-core-client

    • add new TransactionType with the Unknown variant in fuel-core-client
    • refactor fuels-rs
  • coin-type: fuels-rs

    • fuel-core-client already has an Unknown variant - refactor fuels-rs
  • consensus-parameters: fuel-core-client

    • add Unknown variants to all the version enums
    • refactor code
  • block and headers: fuel-core-client

    • add Unknown variants to all the version enums
    • refactor code

Breaking Changes

  • added Unknown variant to TransactionType and CoinType
  • get_message_proof now returns Result<Option<MessageProof>> instead of Result<Option<MessageProof>>

previously

let proof = provider
        .get_message_proof(&tx_id, &msg_nonce, None, Some(2))
        .await?
        .expect("failed to retrieve message proof");

now

let proof = provider
        .get_message_proof(&tx_id, &msg_nonce, None, Some(2))
        .await?;

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@hal3e hal3e added the breaking Introduces or requires breaking changes label Sep 2, 2024
@hal3e hal3e self-assigned this Sep 2, 2024
@hal3e hal3e changed the title Hal3e/unknown variants feat!: gracefully handle unknown transaction variants Sep 2, 2024
@digorithm
Copy link
Member

@hal3e, can you please sync the branch with master and then change the base branch from master to 0.67.0-dev?

@hal3e hal3e changed the base branch from master to 0.67.0-dev September 8, 2024 04:00
AurelienFT and others added 5 commits September 13, 2024 10:15
…ount` and `adjust_for_fee` from `Account` to `ViewOnlyAccount` (#1498)

# Release notes

In this release, we:

- Move `get_asset_outputs_for_amount` and `adjust_for_fee` from
`Account` to `ViewOnlyAccount`

# Summary

This PR moves `get_asset_outputs_for_amount`,
`get_asset_inputs_for_amount` and `adjust_for_fee` from `Account` to
`ViewOnlyAccount` trait. It seem that these two methods doesn't require
a full `Account` and so it give more flexibility in order to implement
them in other structures such as `Wallet`.

Now `Wallet` also implement these two methods. Before you were forced to
build a `WalletUnlocked` even if you don't use the `secret_key`.

# Breaking changes

This contains an API breaking change as some public trait as been
edited:

# Breaking Changes

The provider option flag `cacheUtxo` was renamed to `resourceCacheTTL`

```rust
// before
use fuels::acounts::Account;

wallet.get_asset_outputs_for_amount(...);
```

```rust
// after
use fuels::acounts::ViewOnlyAccount;

wallet.get_asset_outputs_for_amount(...);
```

# Checklist

- [x] All **changes** are **covered** by **tests** (or not applicable)
- [x] All **changes** are **documented** (or not applicable)
- [x] I **reviewed** the **entire PR** myself (preferably, on GH UI)
- [x] I **described** all **Breaking Changes** (or there's none)

---------

Co-authored-by: hal3e <git@hal3e.io>
Co-authored-by: Rodrigo Araújo <rod.dearaujo@gmail.com>
Co-authored-by: MujkicA <ahmedmujkic2@gmail.com>
@hal3e hal3e marked this pull request as ready for review September 20, 2024 10:30
@hal3e hal3e added the blocked label Sep 20, 2024
…ount` and `adjust_for_fee` from `Account` to `ViewOnlyAccount` (#1498)

# Release notes

In this release, we:

- Move `get_asset_outputs_for_amount` and `adjust_for_fee` from
`Account` to `ViewOnlyAccount`

# Summary

This PR moves `get_asset_outputs_for_amount`,
`get_asset_inputs_for_amount` and `adjust_for_fee` from `Account` to
`ViewOnlyAccount` trait. It seem that these two methods doesn't require
a full `Account` and so it give more flexibility in order to implement
them in other structures such as `Wallet`.

Now `Wallet` also implement these two methods. Before you were forced to
build a `WalletUnlocked` even if you don't use the `secret_key`.

# Breaking changes

This contains an API breaking change as some public trait as been
edited:

# Breaking Changes

The provider option flag `cacheUtxo` was renamed to `resourceCacheTTL`

```rust
// before
use fuels::acounts::Account;

wallet.get_asset_outputs_for_amount(...);
```

```rust
// after
use fuels::acounts::ViewOnlyAccount;

wallet.get_asset_outputs_for_amount(...);
```

# Checklist

- [x] All **changes** are **covered** by **tests** (or not applicable)
- [x] All **changes** are **documented** (or not applicable)
- [x] I **reviewed** the **entire PR** myself (preferably, on GH UI)
- [x] I **described** all **Breaking Changes** (or there's none)

---------

Co-authored-by: hal3e <git@hal3e.io>
Co-authored-by: Rodrigo Araújo <rod.dearaujo@gmail.com>
Co-authored-by: MujkicA <ahmedmujkic2@gmail.com>
@hal3e hal3e changed the base branch from 0.67.0-dev to 0.67.0-dev2 November 6, 2024 09:49
@hal3e hal3e removed the blocked label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Introduces or requires breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle unknown transaction variants gracefully (consensus params, tx types, block headers)
6 participants