Skip to content

feat(l1): add From for Transaction -> GenericTransaction #3227

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

sfroment
Copy link
Contributor

@sfroment sfroment commented Jun 19, 2025

Motivation

Adding an easy way to get a GenericTransaction from any Transaction

Description
Adding the 2 missing From and one for the enum
This will allow people who use the ethClient to make estimate_gas and eth_call request, more easily and maybe other request in the future might benefit from it

BTW I don't know which scope I shall use

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 14:23
@sfroment sfroment requested a review from a team as a code owner June 19, 2025 14:23
Copy link
Contributor

@Copilot Copilot AI left a 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 introduces conversion implementations to create a GenericTransaction from various Transaction types and adds initial unit tests for two of those conversions.

  • Implemented From<LegacyTransaction> and From<EIP2930Transaction> for GenericTransaction.
  • Added a blanket From<Transaction> implementation covering all enum variants.
  • Added unit tests for LegacyTransaction and EIP2930Transaction conversions.
Comments suppressed due to low confidence (1)

crates/common/types/transaction.rs:2971

  • Only LegacyTransaction and EIP2930Transaction conversions are tested. Add tests for EIP1559Transaction, EIP4844Transaction, EIP7702Transaction, and PrivilegedL2Transaction conversions to ensure full coverage.
    fn test_legacy_transaction_into_generic() {

@sfroment sfroment changed the title feat(levm): add From for Transaction -> GenericTransaction feat(core): add From for Transaction -> GenericTransaction Jun 19, 2025
Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

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

LGTM

@mpaulucci mpaulucci changed the title feat(core): add From for Transaction -> GenericTransaction feat(l1): add From for Transaction -> GenericTransaction Jul 14, 2025
@mpaulucci mpaulucci enabled auto-merge July 14, 2025 17:40
@mpaulucci mpaulucci added this pull request to the merge queue Jul 14, 2025
Merged via the queue into lambdaclass:main with commit 0532376 Jul 14, 2025
27 checks passed
d-roak pushed a commit to 1sixtech/ethrex that referenced this pull request Jul 17, 2025
…#3227)

**Motivation**

Adding an easy way to get a GenericTransaction from any Transaction
<!-- Why does this pull request exist? What are its goals? -->

**Description**
Adding the 2 missing From and one for the enum
This will allow people who use the ethClient to make estimate_gas and
eth_call request, more easily and maybe other request in the future
might benefit from it

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->


BTW I don't know which scope I shall use

Signed-off-by: Sacha Froment <[email protected]>
Co-authored-by: Martin Paulucci <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants