diff --git a/crates/threshold-signature-server/Cargo.toml b/crates/threshold-signature-server/Cargo.toml index c04cce9f9..104d844f5 100644 --- a/crates/threshold-signature-server/Cargo.toml +++ b/crates/threshold-signature-server/Cargo.toml @@ -84,6 +84,7 @@ ethers-core ="2.0.14" schnorrkel ={ version="0.11.4", default-features=false, features=["std"] } schemars ={ version="0.8.21" } subxt-signer="0.35.3" +tdx-quote ={ git="https://github.com/entropyxyz/tdx-quote", features=["mock"] } # Note: We don't specify versions here because otherwise we run into a cyclical dependency between # `entropy-tss` and `entropy-testing-utils` when we try and publish the `entropy-tss` crate. diff --git a/crates/threshold-signature-server/src/validator/api.rs b/crates/threshold-signature-server/src/validator/api.rs index 2c022eb95..7a1b78d74 100644 --- a/crates/threshold-signature-server/src/validator/api.rs +++ b/crates/threshold-signature-server/src/validator/api.rs @@ -374,7 +374,7 @@ pub async fn attest( pub async fn attest( State(app_state): State, input: Bytes, -) -> Result<(StatusCode, String), ValidatorErr> { +) -> Result<(StatusCode, Bytes), ValidatorErr> { let nonce = input[..].try_into()?; let rpc = get_rpc(&app_state.configuration.endpoint).await?; @@ -401,5 +401,5 @@ pub async fn attest( let quote = tdx_quote::Quote::mock(signing_key.clone(), input_data.0); // Here we would submit an attest extrinsic to the chain - but for now we just include it in the // response - Ok((StatusCode::OK, format!("{:?}", quote))) + Ok((StatusCode::OK, Bytes::from(quote.as_bytes().to_vec()))) } diff --git a/crates/threshold-signature-server/src/validator/tests.rs b/crates/threshold-signature-server/src/validator/tests.rs index e74556cff..a3dfd3d1c 100644 --- a/crates/threshold-signature-server/src/validator/tests.rs +++ b/crates/threshold-signature-server/src/validator/tests.rs @@ -262,11 +262,18 @@ async fn test_attest() { initialize_test_logger().await; clean_tests(); - // let cxt = test_node_process_testing_state(false).await; + let _cxt = test_node_process_testing_state(false).await; let (_validator_ips, _validator_ids) = spawn_testing_validators(false).await; let client = reqwest::Client::new(); - let res = - client.post(format!("http://127.0.0.1:3001/attest")).body(Vec::new()).send().await.unwrap(); - println!("{:?}", res.text().await); + let res = client + .post(format!("http://127.0.0.1:3001/attest")) + .body([0; 32].to_vec()) + .send() + .await + .unwrap(); + assert_eq!(res.status(), 200); + let quote = res.bytes().await.unwrap(); + // This verifies the signature in the quote + tdx_quote::Quote::from_bytes("e).unwrap(); }