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(builder): order sender error match by most specific first #929

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions crates/builder/src/sender/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,8 @@ impl From<ProviderError> for TxSenderError {
// Reth: https://github.com/paradigmxyz/reth/blob/8e4a917ec1aa70b3779083454ff2d5ecf6b44168/crates/rpc/rpc-eth-types/src/error/mod.rs#L624
// Erigon: https://github.com/erigontech/erigon/blob/96fabf3fd1a4ddce26b845ffe2b6cfb50d5b4b2d/txnprovider/txpool/txpoolcfg/txpoolcfg.go#L124
fn parse_known_call_execution_failed(e: &str) -> Option<TxSenderError> {
// DEVELOPER NOTE: ensure to put the most specific matches first
match &e.to_lowercase() {
// geth
x if x.contains("transaction underpriced") => Some(TxSenderError::Underpriced),
// erigon
x if x.contains("underpriced") => Some(TxSenderError::Underpriced),
// reth
x if x.contains("txpool is full") => Some(TxSenderError::Underpriced),
// geth. Reth & erigon don't have similar
x if x.contains("future transaction tries to replace pending") => {
Some(TxSenderError::Rejected)
Expand All @@ -283,6 +278,12 @@ fn parse_known_call_execution_failed(e: &str) -> Option<TxSenderError> {
x if x.contains("storage slot value condition not met") => {
Some(TxSenderError::ConditionNotMet)
}
// geth
x if x.contains("transaction underpriced") => Some(TxSenderError::Underpriced),
// reth
x if x.contains("txpool is full") => Some(TxSenderError::Underpriced),
// erigon
x if x.contains("underpriced") => Some(TxSenderError::Underpriced),
_ => None,
}
}
Loading