diff --git a/src/api/client.rs b/src/api/client.rs index 1f53413..0dd1456 100644 --- a/src/api/client.rs +++ b/src/api/client.rs @@ -13,6 +13,7 @@ use crate::api::models::{ VerifyResponse, }; use crate::solana_program::get_program_pda; +use crate::{get_genesis_hash, MAINNET_GENESIS_HASH}; // URL for the remote server pub const REMOTE_SERVER_URL: &str = "https://verify.osec.io"; @@ -120,6 +121,10 @@ pub async fn send_job_with_uploader_to_remote( uploader: &Pubkey, ) -> anyhow::Result<()> { // Check that PDA exists before sending job + let genesis_hash = get_genesis_hash(connection)?; + if genesis_hash != MAINNET_GENESIS_HASH { + return Err(anyhow!("Remote verification only works with mainnet. Please omit the --remote flag to verify locally.")); + } get_program_pda(connection, program_id, Some(uploader.to_string())).await?; let client = Client::builder() diff --git a/src/main.rs b/src/main.rs index a8393b2..9f871ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -219,6 +219,7 @@ async fn main() -> anyhow::Result<()> { ) .subcommand(SubCommand::with_name("remote") .about("Send a command to a remote machine") + .setting(AppSettings::SubcommandRequiredElseHelp) .subcommand(SubCommand::with_name("get-status") .about("Get the verification status of a program") .arg(Arg::with_name("program-id") diff --git a/src/solana_program.rs b/src/solana_program.rs index 9aae93f..bfad56f 100644 --- a/src/solana_program.rs +++ b/src/solana_program.rs @@ -342,7 +342,7 @@ pub async fn get_program_pda( )) } else { Err(anyhow!( - "PDA not found for {:?} and uploader {:?}", + "PDA not found for {:?} and uploader {:?}. Make sure you've uploaded the PDA to mainnet.", program_id, signer_pubkey ))