Skip to content

Commit

Permalink
Fix low-hanging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Apr 18, 2024
1 parent 45be29a commit 05b4ded
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions beacon_node/beacon_chain/tests/block_verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ async fn block_gossip_verification() {

harness
.chain
.process_gossip_blob(gossip_verified)
.process_gossip_blob(gossip_verified, || Ok(()))
.await
.expect("should import valid gossip verified blob");
}
Expand Down Expand Up @@ -1155,7 +1155,7 @@ async fn verify_block_for_gossip_slashing_detection() {
.unwrap();
harness
.chain
.process_gossip_blob(verified_blob)
.process_gossip_blob(verified_blob, || Ok(()))
.await
.unwrap();
}
Expand Down
28 changes: 18 additions & 10 deletions beacon_node/http_api/tests/broadcast_validation_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub async fn gossip_invalid() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string())
);
}

Expand Down Expand Up @@ -277,7 +277,7 @@ pub async fn consensus_invalid() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string())
);
}

Expand Down Expand Up @@ -488,8 +488,12 @@ pub async fn equivocation_invalid() {
/* mandated by Beacon API spec */
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
let eth2::Error::ServerMessage(err) = error_response else {
panic!("unexpected error: {error_response:?}");
};
assert_eq!(
err.message,
"BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string()
);
}

Expand Down Expand Up @@ -560,7 +564,7 @@ pub async fn equivocation_consensus_early_equivocation() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(Slashable)".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: Slashable".to_string())
);
}

Expand Down Expand Up @@ -786,7 +790,7 @@ pub async fn blinded_gossip_invalid() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string())
);
}

Expand Down Expand Up @@ -967,7 +971,7 @@ pub async fn blinded_consensus_invalid() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string())
);
}

Expand Down Expand Up @@ -1110,8 +1114,12 @@ pub async fn blinded_equivocation_invalid() {
/* mandated by Beacon API spec */
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 })".to_string())
let eth2::Error::ServerMessage(err) = error_response else {
panic!("unexpected error: {error_response:?}");
};
assert_eq!(
err.message,
"BAD_REQUEST: NotFinalizedDescendant { block_parent_root: 0x0000000000000000000000000000000000000000000000000000000000000000 }".to_string()
);
}

Expand Down Expand Up @@ -1178,7 +1186,7 @@ pub async fn blinded_equivocation_consensus_early_equivocation() {
assert_eq!(error_response.status(), Some(StatusCode::BAD_REQUEST));

assert!(
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: BlockError(Slashable)".to_string())
matches!(error_response, eth2::Error::ServerMessage(err) if err.message == "BAD_REQUEST: Slashable".to_string())
);
}

Expand Down

0 comments on commit 05b4ded

Please sign in to comment.