Skip to content

Commit 0db74d2

Browse files
committed
builder: gracefully handle unsupported forks
1 parent 38b2f31 commit 0db74d2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

mev-build-rs/src/auctioneer/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn prepare_submission(
8383
blobs_bundle: to_blobs_bundle(payload.sidecars())?,
8484
signature,
8585
}),
86-
other => unreachable!("fork {other} is not reachable from this type"),
86+
fork => return Err(Error::UnsupportedFork(fork)),
8787
};
8888
Ok(submission)
8989
}

mev-build-rs/src/compat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ethereum_consensus::{
33
crypto::{KzgCommitment, KzgProof},
44
primitives::{Bytes32, ExecutionAddress},
55
ssz::prelude::{ByteList, ByteVector, SimpleSerializeError, U256},
6-
Error as ConsensusError, Fork,
6+
Fork,
77
};
88
use mev_rs::types::{BlobsBundle, ExecutionPayload};
99
use reth::primitives::{Address, BlobTransactionSidecar, Bloom, SealedBlock, B256};
@@ -69,7 +69,7 @@ pub fn to_execution_payload(value: &SealedBlock, fork: Fork) -> Result<Execution
6969
};
7070
Ok(ExecutionPayload::Deneb(payload))
7171
}
72-
fork => Err(Error::Consensus(ConsensusError::UnsupportedFork(fork))),
72+
fork => Err(Error::UnsupportedFork(fork)),
7373
}
7474
}
7575

mev-build-rs/src/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use alloy_signer_wallet::WalletError;
2-
use ethereum_consensus::Error as ConsensusError;
2+
use ethereum_consensus::{Error as ConsensusError, Fork};
33
use reth::payload::error::PayloadBuilderError;
44
use thiserror::Error;
55

66
#[derive(Error, Debug)]
77
pub enum Error {
8+
#[error("fork {0} is not supported for this operation")]
9+
UnsupportedFork(Fork),
810
#[error(transparent)]
911
Consensus(#[from] ConsensusError),
1012
#[error(transparent)]

0 commit comments

Comments
 (0)