Skip to content

Commit

Permalink
feat: add verify_attestations function to client
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyfrederick committed Dec 9, 2024
1 parent aa13f51 commit 200e177
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/proof-of-sql-sdk/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use sxt_proof_of_sql_sdk_local::{
plan_prover_query_dory, prover::ProverResponse, verify_prover_response,
};

use crate::substrate::{verify_attestations_for_block, AttestationError};

/// Level of postprocessing allowed
///
/// Some postprocessing steps are expensive so we allow the user to control the level of postprocessing.
Expand Down Expand Up @@ -145,4 +147,21 @@ impl SxTClient {
_ => Err("Required postprocessing is not allowed. Please examine your query or change `PostprocessingLevel` using `SxTClient::with_postprocessing`".into()),
}
}

/// Verify attestations for a specific block number
///
/// This method uses the `verify_attestations_for_block` function to validate
/// attestations for a given block number.
///
/// # Arguments
///
/// * `block_number` - The block number for which attestations need to be verified.
///
/// # Returns
///
/// Returns `Ok(())` if all attestations are valid and consistent. Otherwise, it returns an
/// `AttestationError` describing the failure.
pub async fn verify_attestations(&self, block_number: u32) -> Result<(), AttestationError> {
verify_attestations_for_block(&self.substrate_node_url, block_number).await
}
}

0 comments on commit 200e177

Please sign in to comment.