Skip to content

eth_sendRawTransactionConditional L2 RPC endpoint#13762

Closed
oac1771 wants to merge 3 commits intoparadigmxyz:mainfrom
oac1771:main
Closed

eth_sendRawTransactionConditional L2 RPC endpoint#13762
oac1771 wants to merge 3 commits intoparadigmxyz:mainfrom
oac1771:main

Conversation

@oac1771
Copy link

@oac1771 oac1771 commented Jan 10, 2025

This is a draft pr for 13488.

So far I just implemented a blanket implementation of L2EthApiExtServer without using the ConditionalOptions. Im not exactly sure how to extract the information from the bytes argument to check against condition. I think I am missing something and would definitely love a push in the right direction.

@hamdiallam
Copy link
Contributor

Here's an example of the api implementation in op-geth: https://github.com/ethereum-optimism/op-geth/blob/optimism/internal/sequencerapi/api.go

How about i'll create the backing implementation for this feature in the block builder and you can finish off the api in the file I referenced. I would recommend familiarizing yourself with that handler

@oac1771
Copy link
Author

oac1771 commented Jan 10, 2025

Sounds great

Copy link
Collaborator

@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.

this is a bit more complex because we need a custom add to pool function because we need to integrate this into the op pool tx (related #13806)

Comment on lines +23 to +28
#[async_trait::async_trait]
impl<T> L2EthApiExtServer for T
where
T: FullEthApi,
jsonrpsee_types::error::ErrorObject<'static>: From<T::Error>,
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can't implement this default like this because we need to actually handle the conditionals.

can we start with a new helper type in

name = "reth-optimism-rpc"

instead, that wraps P: Pool?

like struct L2TransactionConditional<P>{ pool: P}

Copy link
Contributor

@hamdiallam hamdiallam Jan 20, 2025

Choose a reason for hiding this comment

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

Based on the impl in op-geth, we don't check the conditional in the pool since that means repeated state checks as transactions are reinserted in the pool.

Instead we check the conditional at the rpc layer preemptively to the pool and at the block building process. The transaction has a mutable rejected field, set by the that is used to drive eviction in the mempool (also being used in the interop feature)

still wrapping my head around the different modules integrate with each other in this code. If a similar mutable approach is possible with OpTransactionSigned or if there is a nicer idiomatic way for the payload builder to better surface a list of non-included tx that should be evicted the mempool

Copy link
Collaborator

Choose a reason for hiding this comment

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

let's start with my suggestion and I'll leave more instructions once we have that placeholder

Copy link
Contributor

Choose a reason for hiding this comment

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

oh nice I didn't see #13806, I was making the same exact change to OpPooledTransaction to manage some external state. Let me pull that in.

I'll create a separate PR (hopefully tomorrow) so we can discuss from there separately from there. Can you briefly elaborate on why we'd need L2TransactionConditional<P> { pool: P }? I'm not fully following a change to the api. In the draft I have I simply have an Option<TransactionConditional> field on OpTransactionSigned so afaik pool api should have to be wrapped at all since the pool transactions are already typed.

Unless you were thinking OpSignedTransaction is untouched and the pool has a separate submission api for these txs.

I think a draft a small diff in the optimism crate will help clarify. Will get this out super soon!

Copy link
Contributor

Choose a reason for hiding this comment

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

hey @mattsse, I opened this brief draft PR #13926 with a few comments/questions.

Would appreciate your thoughts and I can dig into an implementation from there

Copy link
Collaborator

Choose a reason for hiding this comment

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

Unless you were thinking OpSignedTransaction is untouched and the pool has a separate submission api for these txs.

Sounds good, can you link a draft pr?

Copy link
Collaborator

Choose a reason for hiding this comment

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

as @mattsse says, the conditionals need to be handled and they are specific of the L2, so it won't be implemented in this place of the code anyway. perhaps you would like to close this pr and give it another go by implementing https://github.com/paradigmxyz/reth/pull/13762/files#r1921021197 @oac1771 , unless @hamdiallam has already started with it?

@emhane emhane added A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation labels Feb 8, 2025
@emhane
Copy link
Collaborator

emhane commented Feb 8, 2025

sorry, just saw this is superseded by #14311, nvm @hamdiallam

@emhane emhane closed this Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-op-reth Related to Optimism and op-reth A-rpc Related to the RPC implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants