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

chore: add full abi coder tests #3349

Open
wants to merge 66 commits into
base: master
Choose a base branch
from

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Oct 21, 2024

Summary

  • We have added a fully featured contract (abi-contract) that takes fixed inputs and returns an expected value.
    • As @nedsalk mentioned, Sway performs some precompilation.
  • We have implemented tests for each of the contract functions, and we are currently using our existing encoding package, @fuel-ts/abi-coder.
    • This setup will enable us to swap out the Interface for our newly refactored package with complete confidence and no risk of regression.
  • I have introduced a new custom Vitest matcher, toEqualBn, to simplify the validation of returned BN values.

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Torres-ssf
Torres-ssf previously approved these changes Nov 21, 2024
Copy link
Contributor

@danielbate danielbate left a comment

Choose a reason for hiding this comment

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

Woah, great work! Few comments

packages/fuel-gauge/src/abi/vitest.matcher.ts Show resolved Hide resolved
Comment on lines +107 to +108
// propC4: Vec<StructD<u16, u16, StructF<bool>>>,
// propC5: Vec<StructD<u32, u32, StructF<Vec<StructG>>>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for leaving

packages/fuel-gauge/src/abi/abi-coder.test.ts Show resolved Hide resolved
packages/fuel-gauge/src/abi/abi-coder.test.ts Show resolved Hide resolved
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
64.12%(+0%) 69.69%(+0.03%) 72.66%(+0%) 64.56%(+0%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/transaction-request/transaction-request.ts 88.57%
(+0%)
78.08%
(+1.37%)
84%
(+0%)
88.81%
(+0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants