Skip to content

Commit

Permalink
Adds concrete types distinction to JSON ABI. (#599)
Browse files Browse the repository at this point in the history
FuelLabs/sway#5151
FuelLabs/sway#5952
FuelLabs/sway#5954

[Rendered
file](https://github.com/FuelLabs/fuel-specs/blob/882a860a4aa11ba8c6f91085a0ab4d483c6ce3fb/src/abi/json-abi-format.md)

With the changes proposed in this PR, functions,loggedTypes,
messagesTypes and configurables will only rely on hash based ids of
concrete types.

This change is required because types on the types arrays can be
abstract types, so the hash based ids could not include the generic
parameters of the concrete types used.

For instance a method with two args, `Option<u64>` and `Option<u32>`,
would generate two distinct hash based ids based on `sha256("enum
std::option::Option<u64>")` and `sha256("enum
std::option::Option<u32>")`, but there was a single type for Option.

With the proposed changes we can now have multiple hash based ids for
generic types, while still having access to the same generated types as
the new `concreteTypes` map easily to the `typesMetadata` (old `types`).

### Before requesting review
- [x] I have reviewed the code myself

### After merging, notify other teams

- [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/)
- [ ] [Typescript SDK](https://github.com/FuelLabs/fuels-ts/)
- [ ] [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
esdrubal authored Jul 24, 2024
1 parent 63844b5 commit b095eb2
Showing 1 changed file with 183 additions and 342 deletions.
Loading

0 comments on commit b095eb2

Please sign in to comment.