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

fix: ensure tx forwarder is set #8664

Merged
merged 1 commit into from
Jun 7, 2024
Merged

fix: ensure tx forwarder is set #8664

merged 1 commit into from
Jun 7, 2024

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Jun 7, 2024

closes #8661

there is something like a race condition when the ethapi is created and modified with the tx forwarder we use for OP.

By the time the forwarded is set via the extend_rpc function the EthApi instance is already created for the engine_ endpoint, so the forwarder is never used...

This includes a hotfix and wraps the forwarder in an rwlock so that we can always set it.

this is not great, but this feature will soon be replaced with rpc middleware.
the overhead to acquire the read lock barely exists.

@mattsse mattsse requested a review from Rjected as a code owner June 7, 2024 01:46
@mattsse mattsse added C-bug An unexpected or incorrect behavior A-rpc Related to the RPC implementation A-op-reth Related to Optimism and op-reth labels Jun 7, 2024
@mattsse mattsse force-pushed the matt/fix-op-forwading branch from 6de035b to 5b7d2f5 Compare June 7, 2024 01:49
@@ -490,5 +499,5 @@ struct EthApiInner<Provider, Pool, Network, EvmConfig> {
/// The type that defines how to configure the EVM
evm_config: EvmConfig,
/// Allows forwarding received raw transactions
raw_transaction_forwarder: Option<Arc<dyn RawTransactionForwarder>>,
raw_transaction_forwarder: parking_lot::RwLock<Option<Arc<dyn RawTransactionForwarder>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

couldnt this be an arc<rwlock<_>> instead? no need to check if ethapi has been init already

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this type is already behind an arc

@mattsse mattsse added this pull request to the merge queue Jun 7, 2024
Merged via the queue into main with commit 04d3191 Jun 7, 2024
29 checks passed
@mattsse mattsse deleted the matt/fix-op-forwading branch June 7, 2024 10:21
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 C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

op-reth does not forward raw transactions to the Base mainnet sequencer
2 participants