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

Devise a definition to use in tags #5952

Open
Tracked by #5951
IGI-111 opened this issue May 2, 2024 · 0 comments
Open
Tracked by #5951

Devise a definition to use in tags #5952

IGI-111 opened this issue May 2, 2024 · 0 comments
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

Comments

@IGI-111
Copy link
Contributor

IGI-111 commented May 2, 2024

Create a standard for type definition strings to be used in event hashes.
This should include the full type information of the type, be deterministic and consistent, and include the names of enums and structs so as to distinguish between semantically different event with similar data shapes.

@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 2, 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
Projects
None yet
Development

No branches or pull requests

2 participants