Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions crates/builder/src/validation/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum ValidationError {
PostExecution(String),
#[error("block state root mismatch: got {got}, expected {expected}")]
StateRootMismatch { got: B256, expected: B256 },
// Text matched by `BlockSimError::is_temporary`; changing it demotes builders.
#[error("parent state is not available")]
MissingParentState,
#[error("could not verify proposer payment")]
Expand Down
18 changes: 18 additions & 0 deletions crates/common/src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const BLOCK_ALREADY_KNOWN: &str = "block already known";
const BLOCK_TOO_OLD: &str = "block is too old, outside validation window";
const BLOCK_REQ_REORG: &str = "block requires a reorg";
const PARENT_BLOCK_NOT_FOUND: &str = "could not find parent block: parent block not found";
const NO_STATE_FOR_BLOCK: &str = "no state found for block";
const MISSING_PARENT_STATE: &str = "parent state is not available";

#[derive(Debug, Clone, Error)]
pub enum BlockSimError {
Expand Down Expand Up @@ -110,7 +112,9 @@ impl BlockSimError {
PARENT_NOT_FOUND => true,
PARENT_BLOCK_NOT_FOUND => true,
BLOCK_REQ_REORG => true,
MISSING_PARENT_STATE => true,
r if r.starts_with(MISSING_TRIE_NODE) => true,
r if r.starts_with(NO_STATE_FOR_BLOCK) => true,
_ => false,
},
BlockSimError::Timeout => true,
Expand Down Expand Up @@ -238,6 +242,20 @@ mod tests {
)
}

/// The parent state can be missing while the simulator lags or reorgs, so it must not demote.
#[test]
fn missing_parent_state_never_demotes() {
for reason in [
"no state found for block 0xf9d64b1e6815113d8a761cac2d094802520a082b19221dcbeff2940b469adb7d",
"parent state is not available",
] {
let err = BlockSimError::BlockValidationFailed(reason.to_string());

assert!(err.is_temporary(), "{err}");
assert!(!err.is_demotable(), "{err}");
}
}

/// A relay-side hydration failure is never the builder's fault, so it must not demote.
#[test]
fn relay_hydration_failure_never_demotes() {
Expand Down
Loading