-
Notifications
You must be signed in to change notification settings - Fork 200
feat(v5): decode calls for LA and MAv2 #2258
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
base: moldy/v5-base
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
🌿 Documentation Preview
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds encoding and decoding functionality for transaction calls in both Light Account (LA) and Modular Account v2 (MAv2) implementations. The changes enable proper serialization and deserialization of single and batch transaction data.
Key Changes
- Introduced
decodeCallsmethod for both LA and MAv2 accounts to reverse the encoding process - Refactored LA encoding logic into separate utility functions (
encodeCallsLAanddecodeCallsLA) - Added special handling for MAv2 self-calls to avoid double-wrapping
- Added comprehensive tests for encoding/decoding single and batch transactions
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/smart-accounts/src/ma-v2/accounts/base.ts | Added decodeCalls method and self-call handling in encodeCalls |
| packages/smart-accounts/src/ma-v2/accounts/account.test.ts | Added tests for encoding/decoding single and batch transactions |
| packages/smart-accounts/src/light-account/registry.ts | Added LightAccountAbi type helper for ABI type inference |
| packages/smart-accounts/src/light-account/accounts/calldataCodec.ts | New file with LA-specific encoding/decoding utilities |
| packages/smart-accounts/src/light-account/accounts/base.ts | Refactored to use new encoding/decoding utility functions |
| packages/smart-accounts/src/light-account/accounts/account.test.ts | Added tests for encoding/decoding single and batch transactions |
| docs-site | Updated subproject commit reference |
packages/smart-accounts/src/light-account/accounts/account.test.ts
Outdated
Show resolved
Hide resolved
packages/smart-accounts/src/light-account/accounts/calldataCodec.ts
Outdated
Show resolved
Hide resolved
packages/smart-accounts/src/light-account/accounts/calldataCodec.ts
Outdated
Show resolved
Hide resolved
packages/smart-accounts/src/light-account/accounts/account.test.ts
Outdated
Show resolved
Hide resolved
|
|
||
| expect(decoded.length).toEqual(data.length); | ||
| expect(decoded[0].to.toLowerCase()).toEqual(data[0].to.toLowerCase()); | ||
| expect(decoded[0].value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete test assertion. The line expect(decoded[0].value); is checking for truthiness but lacks a matcher (like .toBe(0n) or .toBeDefined()). This test will always pass regardless of the actual value. Based on the encoding logic in calldataCodec.ts line 17 which always provides a value (calls[0].value ?? 0n), and the decoding logic on line 50 which includes the value when defined, this should be:
expect(decoded[0].value).toBe(0n);| expect(decoded[0].value); | |
| expect(decoded[0].value).toBe(0n); |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Pull Request Checklist
yarn test)sitefolder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change)yarn lint:check) and fix any issues? (yarn lint:write)PR-Codex overview
This PR focuses on enhancing the encoding and decoding functionality for transactions in the
smart-accountspackage, particularly for light accounts and modular accounts. It introduces new utility functions and modifies existing ones to support better handling of calls.Detailed summary
LightAccountAbitype to define account ABI based on type and version.encodeCallsLAanddecodeCallsLAfunctions for handling light account calls.encodeCallsanddecodeCallsmethods inbase.tsto utilize new utilities.encodeCallsfor modular accounts.