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

Rework the ABI spec to use event tag hashes instead of integers as type ids #5954

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

Rework the ABI spec to use event tag hashes instead of integers as type ids #5954

IGI-111 opened this issue May 2, 2024 · 0 comments · Fixed by #6254
Assignees
Labels
ABI Everything to do the ABI, especially the JSON representation breaking May cause existing user code to break. Requires a minor or major release. compiler General compiler. Should eventually become more specific as the issue is triaged logging Related to logging (tracing, stdout, stderr, log-files)

Comments

@IGI-111
Copy link
Contributor

IGI-111 commented May 2, 2024

Change the ABI specification to use the event tag type definitions and their 64 bit hashes as type ids.

This change should also include a new versioning field for the ABI files that uses a semver string (this would be version 0.1.0.

As part of this change, LOG and LOGD receipts should no longer emit both a type id and an event hash but just the event hash (which is now also the type id).

@IGI-111 IGI-111 added compiler General compiler. Should eventually become more specific as the issue is triaged breaking May cause existing user code to break. Requires a minor or major release. ABI Everything to do the ABI, especially the JSON representation logging Related to logging (tracing, stdout, stderr, log-files) 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 breaking May cause existing user code to break. Requires a minor or major release. compiler General compiler. Should eventually become more specific as the issue is triaged logging Related to logging (tracing, stdout, stderr, log-files)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants