Skip to content

Commit 35b98fa

Browse files
authored
OFAC non critical error fix (#273)
## 📝 Summary This version considers the error from the relay "block rejected because of OFAC addresses" as non critical. ## 💡 Motivation and Context Without this change, non OFAC compliant builders would stop building blocks after sending a non-OFAC block to a OFAC complaint relay (flashbot's!). ## ✅ I have completed the following steps: * [X] Run `make lint` * [X] Run `make test` * [ ] Added tests (if applicable)
1 parent e11f170 commit 35b98fa

File tree

1 file changed

+17
-3
lines changed
  • crates/rbuilder/src/mev_boost

1 file changed

+17
-3
lines changed

crates/rbuilder/src/mev_boost/mod.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ const GZIP_CONTENT_ENCODING: &str = "gzip";
3131
const BUILDER_ID_HEADER: &str = "X-Builder-Id";
3232
const API_TOKEN_HEADER: &str = "X-Api-Token";
3333

34+
/// We don't have nice error codes for relay errors so we have to parse looking for substrings :(
35+
/// Simulation error base.
36+
const SIM_FAILED_SUBSTRING: &str = "simulation failed";
37+
/// Any error containing SIM_FAILED_SUBSTRING and any of SIM_FAILED_NON_CRITICAL_ERRORS is not critical so we should not stop block building.
38+
const SIM_FAILED_NON_CRITICAL_ERRORS: &[&str] = &[
39+
"blacklisted address", // Generated block is good but contains a blacklisted address. This happens if we don't use an OFAC blacklist but the relay does.
40+
"unknown ancestor",
41+
"missing trie node",
42+
];
43+
3444
// @Org consolidate with primitives::mev_boost
3545

3646
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
@@ -268,7 +278,8 @@ pub enum SubmitBlockErr {
268278
PayloadDelivered,
269279
#[error("Bid below floor")]
270280
BidBelowFloor,
271-
#[error("Simulation Error")]
281+
#[cfg_attr(not(feature = "redact-sensitive"), error("Simulation Error: {0}"))]
282+
#[cfg_attr(feature = "redact-sensitive", error("Simulation Error: [REDACTED]"))]
272283
SimError(String),
273284
#[error("RPC conversion Error")]
274285
/// RPC validates the submissions (eg: limit of txs) much more that our model.
@@ -540,8 +551,11 @@ impl RelayClient {
540551
}
541552
"block already received" => Err(SubmitBlockErr::BlockKnown),
542553
_ if msg.contains("read tcp") => Err(RelayError::ConnectionError.into()),
543-
_ if msg.contains("simulation failed") => {
544-
if msg.contains("unknown ancestor") | msg.contains("missing trie node") {
554+
_ if msg.contains(SIM_FAILED_SUBSTRING) => {
555+
if SIM_FAILED_NON_CRITICAL_ERRORS
556+
.iter()
557+
.any(|pat| msg.contains(*pat))
558+
{
545559
Err(RelayError::InternalError.into())
546560
} else {
547561
Err(SubmitBlockErr::SimError(msg.to_string()))

0 commit comments

Comments
 (0)