Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoopmann committed Oct 2, 2023
1 parent c1842cc commit 9786f13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use clap::Parser;
use reth::cli::Cli;
use reth_block_validator::ValidationCliExt;


fn main() {
Cli::<ValidationCliExt>::parse().run().unwrap();
}

34 changes: 18 additions & 16 deletions tests/it/http.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
use reth::providers::test_utils::NoopProvider;
use reth_block_validator::ValidationApi;
use jsonrpsee::{core::error::Error, http_client::HttpClientBuilder, server::ServerBuilder};
use reth::providers::test_utils::NoopProvider;
use reth_block_validator::rpc::{ValidationApiClient, ValidationApiServer, ValidationRequestBody};




use reth_block_validator::ValidationApi;

const VALIDATION_REQUEST_BODY: &str = include_str!("../../tests/data/single_payload.json");

#[tokio::test(flavor = "multi_thread")]
async fn test_call_admin_functions_ws() {
let server_addr = start_server().await;
let uri = format!("http://{}", server_addr);
let client = HttpClientBuilder::default().build(&uri).unwrap();
let validation_request_body: ValidationRequestBody = serde_json::from_str(VALIDATION_REQUEST_BODY).unwrap();
let result = ValidationApiClient::validate_builder_submission_v2(&client, validation_request_body.clone()).await;
let expected_message =
format!("Block parent [hash:{:?}] is not known.", validation_request_body.execution_payload.parent_hash);
let uri = format!("http://{}", server_addr);
let client = HttpClientBuilder::default().build(&uri).unwrap();
let validation_request_body: ValidationRequestBody =
serde_json::from_str(VALIDATION_REQUEST_BODY).unwrap();
let result = ValidationApiClient::validate_builder_submission_v2(
&client,
validation_request_body.clone(),
)
.await;
let expected_message = format!(
"Block parent [hash:{:?}] is not known.",
validation_request_body.execution_payload.parent_hash
);
let error_message = get_call_error_message(result.unwrap_err()).unwrap();
assert_eq!(error_message, expected_message);

}

async fn start_server() -> std::net::SocketAddr {
let server = ServerBuilder::default().build("127.0.0.1:0").await.unwrap();
let addr = server.local_addr().unwrap();
let addr = server.local_addr().unwrap();
let provider = NoopProvider::default();
let api = ValidationApi::new(provider);
let server_handle = server.start(api.into_rpc());
let server_handle = server.start(api.into_rpc());

tokio::spawn(server_handle.stopped());
tokio::spawn(server_handle.stopped());

addr
}
Expand Down
1 change: 0 additions & 1 deletion tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mod http;

fn main() {}

0 comments on commit 9786f13

Please sign in to comment.