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: added fixed based coders #3446

Closed

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Dec 4, 2024

Summary

  • This PR encompasses all the "fixed" length coders:
    • u8
    • u16
    • u32
    • u64
    • u256
    • b256
    • b512
    • bool
    • void

Breaking Changes

Note

These will need to be combined into the final PR (#3085)

  • Accessing underlying coders is now achieved through a convenient class, AbiEncoding.
// Before
import { NumberCoder, BigNumberCoder, B256Coder, B512Coder, VoidCoder, BooleanCoder } from '@fuel-ts/abi-coder';

const u8 = new NumberCoder('u8');
const u16 = new NumberCoder('u16');
const u32 = new NumberCoder('u32');
const u64 = new BigNumberCoder('u64');
const u256 = new BigNumberCoder('u256');
const b256 = new B256Coder();
const b512 = new B512Coder();
const boolCoder = new BooleanCoder();
const voidCoder = new VoidCoder();
// After
import { AbiEncoding } from '@fuel-ts/abi';

const u8 = AbiEncoding.v1.u8;
const u16 = AbiEncoding.v1.u16;
const u32 = AbiEncoding.v1.u32;
const u64 = AbiEncoding.v1.u64;
const u256 = AbiEncoding.v1.u256;
const b256 = AbiEncoding.v1.b256;
const b512 = AbiEncoding.v1.b512;
const boolCoder = AbiEncoding.v1.bool;
const voidCoder = AbiEncoding.v1.void;

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)

@petertonysmith94 petertonysmith94 added the feat Issue is a feature label Dec 4, 2024
@petertonysmith94 petertonysmith94 self-assigned this Dec 4, 2024
Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:34pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:34pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 6:34pm

Copy link

codspeed-hq bot commented Dec 4, 2024

CodSpeed Performance Report

Merging #3446 will degrade performances by 43.8%

Comparing ps/feat/abi-coder-phase-1 (93fb0b6) with ns/feat/abi-parser (fe56f53)

Summary

❌ 1 regressions
✅ 17 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark ns/feat/abi-parser ps/feat/abi-coder-phase-1 Change
should successfully transfer a single asset between wallets (x20 times) 61.6 ms 109.7 ms -43.8%

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

Successfully merging this pull request may close these issues.

1 participant