-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…1856) Related issues: - Untracked While testing the feature for sending `Block` versions over GraphQL, we discovered that the current approach to GraphQL type versioning doesn't work as expected. Using `async-graphql::Union` is poorly suited for versioning because: - union types cannot define multiple variants with the same inner types (e.g., you cannot define a union with `V1(Version), V2(Version), ...`) - union types are designed to represent sum types/disjoint union types (e.g., `HeavyOperation` and `LightOperation` where the type must be one or the other) This prevents us from defining a second version. I.e., ``` #[derive(Union)] pub enum ConsensusParametersVersion { V1(Version), V2(Version), } ``` will fail to compile, preventing us from releasing new versions. The solution is to use `async-graphql::Enum`. `Enum` writes the enum in the SDL as a real enum. This allows us to reuse types within variants or provide empty variants. This is better suited for versioning. This will allow us to define future versions easily: ``` #[derive(Enum)] pub enum ConsensusParametersVersion { V1, V2, } ``` This change must be used to patch `0.24` and `0.25`. Once these versions are updated: - We must update the image in the dev cluster - SDK teams must update their versions to include the fix - Sway team must be updated to use new `fuels-rs` ## Checklist - [x] Breaking changes are clearly marked as such in the PR description and changelog - [ ] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [x] I have reviewed the code myself - [ ] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else?
- Loading branch information
Brandon Vrooman
authored
Apr 24, 2024
1 parent
88a2ce7
commit f7bd84e
Showing
6 changed files
with
74 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.