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

dev: refactor decode_legacy_tx for consistency with typed transactions #979

Closed
enitrat opened this issue Sep 26, 2024 · 9 comments · Fixed by #1012
Closed

dev: refactor decode_legacy_tx for consistency with typed transactions #979

enitrat opened this issue Sep 26, 2024 · 9 comments · Fixed by #1012
Assignees
Labels
enhancement New feature or request ODHack8

Comments

@enitrat
Copy link
Contributor

enitrat commented Sep 26, 2024

Refactor this function two explicitly split the two steps, as performed in decode_enveloped_typed_transaction

  1. The first step where, like in decode_enveloped_typed_transaction, we get rlp_decoded_data from decoding the encoded_tx_data and perform various checks on it
  2. The second step where we decode_fields to build the TxLegacy instance.

The decode_fields part must be moved to crates/utils/src/eth_transaction/legacy.cairo where, similarly to eip2930.cairo, we will implement a trait with the implementation of decode_fields

pub impl _impl of TxLegacyTrait {
    fn decode_fields(ref data: Span<RLPItem>) -> Result<TxLegacy, EthTransactionError> {
@enitrat enitrat added enhancement New feature or request ODHack8 labels Sep 26, 2024
@enitrat enitrat changed the title dev: refactor decode_legacy_tx to use for consistency with typed transactions dev: refactor decode_legacy_tx for consistency with typed transactions Sep 26, 2024
@stevencartavia
Copy link

🙋🏽‍♂️

@martinvibes
Copy link

martinvibes commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

hello i am a frontend dev and blockchain developer
please can i work on this issue :) and would love to be a contributor

How I plan on tackling this issue

Here’s a summarized version of the refactor task for decode_legacy_tx:

Locate decode_legacy_tx in the transaction.cairo file.
Split the function into two steps:
Decode the rlp_decoded_data and perform checks.
Move the field decoding into a separate function for building TxLegacy.
Move the decode_fields logic to legacy.cairo and implement a decoding trait for TxLegacy.
Update decode_legacy_tx to use the new trait and method.
Test the changes to ensure proper functionality.
Commit the refactor for review

@ooochoche
Copy link
Contributor

@enitrat Please can I take on this instead

@danielcdz
Copy link

danielcdz commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I'm Daniel Calderón!
I'm a passionate software engineer with over 3 years of experience, actively contributing to open-source projects through OnlyDust. I’m also a community moderator at Dojo Coding, where I help new developers get started with blockchain development.
Over the past few months, I've contributed to several Starknet projects, including cairo-vm-go by Nethermind. Currently, I’m a Cairo developer at ByteBuilders, working on ByteBeasts, a fully on-chain RPG game built using the Dojo Engine framework.
My expertise spans full-stack development, with a focus on backend, frontend, and smart contract development in blockchain ecosystems.

How I plan on tackling this issue

  • I will follow this as guide to accomplish this task
  • Move decode_fieldsto crates/utils/src/eth_transaction/legacy.cairo
  • Refactor the function into two steps as you mentioned
  • Ensure all is working after the changes
  • I will follow the contribution guidelines through my work from the commits naming and so on to upload a PR in less than 2 days, If I get stuck at some point I will request help through a draft PR

@ShantelPeters

This comment was marked as abuse.

@enitrat
Copy link
Contributor Author

enitrat commented Sep 30, 2024

@ooochoche how are things going?

@ooochoche
Copy link
Contributor

@enitrat I should be done within the next 48hrs

@enitrat
Copy link
Contributor Author

enitrat commented Oct 3, 2024

Hi @ooochoche, it's been a week now - if you do not have any time to allocate to this, please let this be worked on by other contributors

@ooochoche
Copy link
Contributor

I am creating a PR now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ODHack8
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants