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

Add Sway program type to ABI JSON #5151

Closed
arboleya opened this issue Sep 28, 2023 · 0 comments · Fixed by #6254
Closed

Add Sway program type to ABI JSON #5151

arboleya opened this issue Sep 28, 2023 · 0 comments · Fixed by #6254
Assignees
Labels
ABI Everything to do the ABI, especially the JSON representation compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request

Comments

@arboleya
Copy link
Member

We need this to distinguish the program type solely based on the ABI:

With this, we won't need to outsource the task of informing program types to our users anymore.

While this is not the end of the world, it makes the experience a bit more cumbersome.

This seems like an easy addition and shares a similar mindset with:

@arboleya arboleya added the enhancement New feature or request label Oct 13, 2023
@IGI-111 IGI-111 added compiler General compiler. Should eventually become more specific as the issue is triaged ABI Everything to do the ABI, especially the JSON representation labels May 7, 2024
IGI-111 pushed a commit to FuelLabs/fuel-specs that referenced this issue Jul 13, 2024
[#5151](FuelLabs/sway#5151)
[#5952](FuelLabs/sway#5952)
[#5954](FuelLabs/sway#5954)

Adds specification for how hashes based ids are generated from a string
representation of types.

Updates `json-abi-format.md` with versions, program type, and hash based
ids.

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

### After merging, notify other teams

[Add or remove entries as needed]

- [ ] [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?
IGI-111 pushed a commit to FuelLabs/fuel-specs that referenced this issue Jul 24, 2024
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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ABI Everything to do the ABI, especially the JSON representation compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants