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 #1435

Closed

Conversation

danielbate
Copy link
Contributor

@danielbate danielbate commented Nov 15, 2023

Status

Test Suites: 250 passed, 250 total
Tests:       17 skipped, 1422 passed, 1439 total

New Test Scenarios

New isolated tests are being done at:

  • packages/fuel-gauge/src/small-bytes.test.ts

Failing tests

  • @nedsalk apps/docs-snippets/src/guide/contracts/configurable-constants.test.ts
  • @danielbate apps/docs-snippets/src/guide/scripts/script-with-configurable.test.ts
  • apps/docs-snippets/src/guide/types/options.test.ts
  • apps/docs-snippets/src/guide/types/tuples.test.ts
  • @nedsalk apps/docs-snippets/src/guide/types/vector.test.ts

  • @nedsalk packages/abi-coder/test/interface.test.ts

  • @nedsalk packages/fuel-gauge/src/advanced-logging.test.ts
  • @danielbate packages/fuel-gauge/src/configurable-contract.test.ts
  • packages/fuel-gauge/src/contract.test.ts
  • packages/fuel-gauge/src/coverage-contract.test.ts
  • @danielbate packages/fuel-gauge/src/predicate/predicate-configurables.test.ts
  • @Torres-ssf packages/fuel-gauge/src/predicate/predicate-with-contract.test.ts
  • @danielbate packages/fuel-gauge/src/script-with-configurable.test.ts
  • packages/fuel-gauge/src/script-with-vectors.test.ts
  • packages/fuel-gauge/src/vector-types.test.ts
  • @nedsalk packages/fuel-gauge/src/vectors.test.ts

Internal Docs

This is the summary of the new encoding/decoding scheme:

/**
* These options relates only to:
* - NumberCoder (u8, u16, u32)
* - BooleanCoder
*
* 1) isSmallBytes (default=false)
*
* Describes how many bytes it will ocuppy:
*
* false — occupies 8 bytes (default), and should be used when underneath:
* • standalone
* • tuple
* • struct
*
* true — occupies 1 byte, and should be used when underneath:
* • array
* • vector
* • enum
*
*
* 2) isRightPadded (default=false)
*
* Used only when `isSmallBytes` is FALSE.
*
* Describes how the padding should happen:
*
* false —— left padded (default), and should be used when underneath:
* • standalone
* • array
* • vector
* • enum
* • only one function argument
*
* true —— right padded, and should be used when underneath:
* • struct
* • tuple
* • multiple function arguments
*
*/

Copy link
Contributor

github-actions bot commented Nov 16, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
86.47% (+0.07% 🔼)
5830/6742
🟡 Branches
70.52% (+0.41% 🔼)
885/1255
🟡 Functions
77.23% (+0.07% 🔼)
963/1247
🟢 Lines
86.44% (+0.07% 🔼)
5580/6455
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / utilities.ts
97.44% (-1.05% 🔻)
88.89% (-5.23% 🔻)
93.33% (+1.67% 🔼)
97.1% (-1.29% 🔻)
🟢
... / abi-coder.ts
92.5%
84% (-2.96% 🔻)
87.5%
92.41% (+0.1% 🔼)

Test suite run success

1422 tests passing in 250 suites.

Report generated by 🧪jest coverage report action from 82b53fa

@danielbate danielbate changed the base branch from master to beta-5 November 16, 2023 16:51
@danielbate danielbate marked this pull request as ready for review November 21, 2023 08:52
Copy link
Member

@arboleya arboleya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

This PR should not be merged yet.
Please, don't resolve this conversation.

@arboleya arboleya marked this pull request as draft November 21, 2023 09:32
@nedsalk nedsalk self-requested a review November 21, 2023 10:38
@Torres-ssf Torres-ssf marked this pull request as ready for review November 28, 2023 15:39
@danielbate
Copy link
Contributor Author

Closing as this work is included in #1407 so the source of truth review should be there

@danielbate danielbate closed this Nov 28, 2023
@danielbate danielbate deleted the db/feat/represent-small-values-as-single-bytes branch February 22, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Representation of small values as single bytes
4 participants