Skip to content

Commit 8c62555

Browse files
committed
feat: cli command to verify proof
1 parent 508ccb1 commit 8c62555

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

batcher/aligned/src/main.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::io::Write;
55
use std::path::PathBuf;
66
use std::str::FromStr;
77

8+
use aligned_sdk::agg_mode;
89
use aligned_sdk::communication::serialization::cbor_deserialize;
910
use aligned_sdk::core::types::FeeEstimationType;
1011
use aligned_sdk::core::{
@@ -78,6 +79,8 @@ pub enum AlignedCommands {
7879
name = "get-user-amount-of-queued-proofs"
7980
)]
8081
GetUserAmountOfQueuedProofs(GetUserAmountOfQueuedProofsArgs),
82+
#[clap(about = "", name = "verify-agg-proof")]
83+
VerifyProofInAggMode(VerifyProofInAggModeArgs),
8184
}
8285

8386
#[derive(Parser, Debug)]
@@ -280,6 +283,29 @@ pub struct GetUserAmountOfQueuedProofsArgs {
280283
network: NetworkArg,
281284
}
282285

286+
#[derive(Parser, Debug)]
287+
#[command(version, about, long_about = None)]
288+
pub struct VerifyProofInAggModeArgs {
289+
#[arg(
290+
name = "Ethereum RPC provider url",
291+
long = "rpc_url",
292+
default_value = "https://ethereum-holesky-rpc.publicnode.com"
293+
)]
294+
eth_rpc_url: String,
295+
#[arg(
296+
name = "Ethereum Beacon client url",
297+
long = "beacon_url",
298+
default_value = "http://100.90.212.34:5052"
299+
)]
300+
beacon_client_url: String,
301+
#[arg(name = "Proof Hash", long = "proof-hash")]
302+
proof_hash: String,
303+
#[clap(flatten)]
304+
network: NetworkArg,
305+
#[arg(name = "From which block to start", long = "from-block")]
306+
from_block: Option<u64>,
307+
}
308+
283309
#[derive(Args, Debug)]
284310
#[group(multiple = false)]
285311
pub struct PrivateKeyType {
@@ -732,6 +758,28 @@ async fn main() -> Result<(), AlignedError> {
732758
);
733759
return Ok(());
734760
}
761+
AlignedCommands::VerifyProofInAggMode(args) => {
762+
match agg_mode::is_proof_verified_in_aggregation_mode(
763+
args.proof_hash,
764+
args.network.into(),
765+
args.eth_rpc_url,
766+
args.beacon_client_url,
767+
args.from_block.unwrap_or(0),
768+
)
769+
.await
770+
{
771+
Ok(res) => {
772+
if res {
773+
info!("Proof verified on proof {}", "");
774+
} else {
775+
error!("Proof verification failed!")
776+
}
777+
}
778+
Err(e) => error!("Error while trying to verify proof {:?}", e),
779+
}
780+
781+
return Ok(());
782+
}
735783
}
736784

737785
Ok(())

0 commit comments

Comments
 (0)