-
Notifications
You must be signed in to change notification settings - Fork 132
feat(l2): add serde to AuthorizationTuple fields #5339
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
Conversation
Lines of code reportTotal lines added: Detailed view |
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 custom serde deserializers to AuthorizationTuple fields to enable JavaScript compatibility through the L2 Hub. The deserializers handle both hexadecimal and decimal string representations, addressing parsing failures when JavaScript sends values like "0x0" instead of numeric types.
Key changes:
- Added
deser_hex_or_dec_strdeserializers to U256 fields (chain_id, y_parity, r_signature, s_signature) - Added
deser_hex_or_dec_strdeserializer withdefaultattribute to the nonce field (u64) - Minor whitespace fix in genesis file
Reviewed Changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/common/types/tx_fields.rs | Added serde deserializers to all AuthorizationTuple fields to parse both hex and decimal string formats |
| fixtures/genesis/l2.json | Added missing newline at end of file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
**Motivation** Add serde to specific fields of `AuthorizationTuple` **Description** To use the [L2 Hub](https://github.com/lambdaclass/ethrex_l2_hub), we need to parse the fields of AuthorizationTuple to make them compatible with JavaScript. ``` Details: Invalid Ethex L2 message: Failed to parse request into ethrex_SendTransaction: invalid type: string "0x0", expected u64 Version: [email protected] at getContractError (chunk-7ZVOX3I3.js?v=69061873:218:10) at writeContract (chunk-UOLTLXVA.js?v=69061873:587:11) at async signUp (passkeyAccounts.ts:55:16) at async handleSignUp (AccountCard.tsx:28:46)Caused by: TransactionExecutionError: RPC Request failed. ``` --------- Co-authored-by: Manuel Iñaki Bilbao <[email protected]>
**Motivation** Add serde to specific fields of `AuthorizationTuple` **Description** To use the [L2 Hub](https://github.com/lambdaclass/ethrex_l2_hub), we need to parse the fields of AuthorizationTuple to make them compatible with JavaScript. ``` Details: Invalid Ethex L2 message: Failed to parse request into ethrex_SendTransaction: invalid type: string "0x0", expected u64 Version: [email protected] at getContractError (chunk-7ZVOX3I3.js?v=69061873:218:10) at writeContract (chunk-UOLTLXVA.js?v=69061873:587:11) at async signUp (passkeyAccounts.ts:55:16) at async handleSignUp (AccountCard.tsx:28:46)Caused by: TransactionExecutionError: RPC Request failed. ``` --------- Co-authored-by: Manuel Iñaki Bilbao <[email protected]>
Motivation
Add serde to specific fields of
AuthorizationTupleDescription
To use the L2 Hub, we need to parse the fields of AuthorizationTuple to make them compatible with JavaScript.