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

feat!: represent small values as single bytes #1163

Merged
merged 29 commits into from
Nov 10, 2023
Merged

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Oct 12, 2023

This PR is just the first of a series that will update the encoding/decoding of Sway types.

At this PR we are updating codec to Sway 0.48 (in the future for now) and how it treats u8 and bool. Now they are encoded (when possible) with just one byte;

It also fixes a limitation of enums tags being u8 (this was a bug);

The test test_heap_type_in_enums had to be commented because we are changing our heap types are encoded, and at the moment, they are not working. :(

Changes to .github/workflows/ci.yml can be ignore for now and will be removed after FuelLabs/sway#5264 is merged. As the commented tests.

Checklist

  • I have linked to any relevant issues.
  • I have updated the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary labels.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@digorithm digorithm added P1 High priority sway-compiler Requires more info or is blocked by the sway labels Oct 20, 2023
@xunilrj xunilrj force-pushed the IGI-111/int-mem-repr branch 2 times, most recently from d5d240a to d2a1b11 Compare October 24, 2023 16:44
IGI-111 pushed a commit to FuelLabs/sway that referenced this pull request Nov 2, 2023
## Description

This PR is needed to make FuelLabs/fuels-rs#1163
green. We can configure the sway branch for the CI, but not the stdlib.
With this, we will be able to edit github CI config and point to
whichever sway version we want.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/scripts/verify_tag.sh Outdated Show resolved Hide resolved
packages/fuels-core/src/codec/abi_decoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/codec/abi_encoder.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/codec/logs.rs Show resolved Hide resolved
packages/fuels-core/src/types/enum_variants.rs Outdated Show resolved Hide resolved
packages/fuels-core/src/types/param_types.rs Show resolved Hide resolved
xunilrj and others added 6 commits November 10, 2023 12:01
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
@hal3e hal3e changed the title Represent small values as single bytes feat!: represent small values as single bytes Nov 10, 2023
hal3e
hal3e previously approved these changes Nov 10, 2023
digorithm
digorithm previously approved these changes Nov 10, 2023
@digorithm digorithm merged commit d8704e1 into master Nov 10, 2023
39 checks passed
@digorithm digorithm deleted the IGI-111/int-mem-repr branch November 10, 2023 18:04
xunilrj added a commit to FuelLabs/sway that referenced this pull request Nov 17, 2023
## Description

This PR contains some necessary fixes to enable this
FuelLabs/fuels-rs#1163 to be merged.

1 - It guarantees that when the env var `FORC_IMPLICIT_STD_GIT_BRANCH`
is used, no `tag` or `rev` is also used;
2 - It removes all warnings from the sway std-lib;
3 - It fixes reading predicates witness when it is only one byte.


## Checklist

- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [ ] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: hal3e <git@hal3e.io>
Co-authored-by: IGI-111 <igi-111@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority sway-compiler Requires more info or is blocked by the sway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants