Skip to content

fix!: use TransactionRequest in Network impl#525

Merged
mattsse merged 24 commits intomainfrom
yash/rm-OpTxReq
Jun 24, 2025
Merged

fix!: use TransactionRequest in Network impl#525
mattsse merged 24 commits intomainfrom
yash/rm-OpTxReq

Conversation

@yash-atreya
Copy link
Copy Markdown
Contributor

@yash-atreya yash-atreya commented May 20, 2025

Motivation

Ref alloy-rs/alloy#2478

OpTransactionRequest is a wrapper around TransactionRequest.

It doesn't implement TransactionBuilder4844 (It shouldn't). But this makes it incompatible with ProviderBuilder default constructor new

Solution

  • Remove OpTransactionRequest
  • Move related From conversions
  • Use TransactionRequest in network impl

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya changed the title Yash/rm op tx req fix!: use TransactionRequest in Network impl May 20, 2025
@yash-atreya yash-atreya self-assigned this May 20, 2025
@yash-atreya yash-atreya moved this to In Progress in Alloy May 20, 2025
@yash-atreya yash-atreya marked this pull request as ready for review May 20, 2025 16:52
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

smol nits

I think this is reasonable, no reason to introduce a new txrequest type here really because most of the server apis are restricted to TransactionRequest, so even if this does allow configuring 4844 fields, this seems fine

@yash-atreya yash-atreya requested review from emhane and mattsse May 21, 2025 14:32
@yash-atreya yash-atreya moved this from In Progress to Ready for Review in Alloy May 21, 2025
@yash-atreya yash-atreya added the A-consensus Area: consensus crate label May 21, 2025
@yash-atreya yash-atreya added the C-breaking Category: Breaking changes label May 21, 2025
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

mostly questions

# compat
alloy-network = { workspace = true, optional = true }
alloy-rpc-types-eth = { workspace = true, optional = true }
alloy-rpc-types-eth.workspace = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should not be mandatory here

Copy link
Copy Markdown
Contributor Author

@yash-atreya yash-atreya Jun 24, 2025

Choose a reason for hiding this comment

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

This is due to the impl From for TransactionRequest conversion being moved to their respective files after removal of OpTransactionRequest.

These conversions are:

  1. impl From<TxDeposit> for TransactionRequest in deposit.rs

  2. impl From<OpTxEnvelope> for TransactionRequest in envelope.rs

  3. impl From<OpTypedTransaction> for TransactionRequest in typed.rs

We need these now because of trait bounds on the Network::TransactionRequest associated type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

then this should be feature gated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we need this conversion in this pr?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was implemeted for OpTransactionRequest:

impl From<TxDeposit> for OpTransactionRequest {

After removing that, implemented similar conversion for TransactionRequest

let tx = OpTypedTransaction::Eip1559(tx);
Ok(tx)
}
EthereumTypedTransaction::Eip4844(tx) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why do we have this here?
this isn't supported, unclear why we need to handle this case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can remove it. It is being handled on main. Just ported it here. See: #525 (comment)

It's equivalent to build_typed_tx currently on main https://github.com/alloy-rs/op-alloy/blob/main/crates/rpc-types/src/transaction/request.rs#L104-L117 which doesn't return an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed 5b35d0e

# compat
alloy-network = { workspace = true, optional = true }
alloy-rpc-types-eth = { workspace = true, optional = true }
alloy-rpc-types-eth.workspace = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

then this should be feature gated

@github-project-automation github-project-automation bot moved this from In Progress to Reviewed in Alloy Jun 24, 2025
@mattsse mattsse added this pull request to the merge queue Jun 24, 2025
@mattsse
Copy link
Copy Markdown
Member

mattsse commented Jun 24, 2025

fyi @RomanHodulak

Merged via the queue into main with commit 621e58d Jun 24, 2025
21 checks passed
@mattsse mattsse deleted the yash/rm-OpTxReq branch June 24, 2025 10:35
@github-project-automation github-project-automation bot moved this from In Review to Done in Project Tracking Jun 24, 2025
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Jun 24, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jun 25, 2025
…ionRequest` of `Optimism` (#557)

## Motivation

The change #525 introduced ambiguity of
`alloy_network::TransactionBuilder` implementation for
`TransactionRequest`, being implemented twice once for `Ethereum` and
once for `Optimism`. This then requires fully qualified syntax to
differentiate.

## Solution

Bring back `OpTransactionRequest`

## PR Checklist

- [ ] Added Tests
- [ ] Added Documentation
- [ ] Breaking changes
@grandizzy grandizzy moved this from Done to Completed in Alloy Jul 8, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 21, 2026
<!--
Thank you for your Pull Request. Please provide a description above and
review
the requirements below.

Bug fixes and new features should include tests.

Contributors guide:
https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md

The contributors guide includes instructions for running rustfmt and
building the
documentation.
-->

<!-- ** Please select "Allow edits from maintainers" in the PR Options
** -->

## Motivation

Ref alloy-rs/alloy#2478

`OpTransactionRequest` is a wrapper around `TransactionRequest`.

It doesn't implement `TransactionBuilder4844` (It shouldn't). But this
makes it incompatible with `ProviderBuilder` default constructor `new`

<!--
Explain the context and why you're making that change. What is the
problem
you're trying to solve? In some cases there is not a problem and this
can be
thought of as being the motivation for your change.
-->

## Solution

- Remove OpTransactionRequest
- Move related `From` conversions 
- Use TransactionRequest in network impl

<!--
Summarize the solution and provide any necessary context needed to
understand
the code change.
-->

## PR Checklist

- [ ] Added Tests
- [ ] Added Documentation
- [ ] Breaking changes

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-consensus Area: consensus crate A-network Area: network crate C-breaking Category: Breaking changes

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

4 participants