From 941c5fe062ff283a23a081e9e5da0697714cd10e Mon Sep 17 00:00:00 2001 From: Daniel Savu <23065004+daniel-savu@users.noreply.github.com> Date: Thu, 14 Dec 2023 17:11:48 +0000 Subject: [PATCH] fixes --- rust/hyperlane-base/src/settings/signers.rs | 6 ++---- rust/utils/run-locally/src/invariants.rs | 2 +- rust/utils/run-locally/src/main.rs | 5 +++-- rust/utils/run-locally/src/solana.rs | 12 +++++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rust/hyperlane-base/src/settings/signers.rs b/rust/hyperlane-base/src/settings/signers.rs index 31704b901d9..c48de65f731 100644 --- a/rust/hyperlane-base/src/settings/signers.rs +++ b/rust/hyperlane-base/src/settings/signers.rs @@ -125,7 +125,7 @@ impl ChainSigner for fuels::prelude::WalletUnlocked { #[async_trait] impl BuildableWithSignerConf for Keypair { async fn build(conf: &SignerConf) -> Result { - let key = if let SignerConf::HexKey { key } = conf { + if let SignerConf::HexKey { key } = conf { let secret = SecretKey::from_bytes(key.as_bytes()) .context("Invalid sealevel ed25519 secret key")?; Ok( @@ -134,9 +134,7 @@ impl BuildableWithSignerConf for Keypair { ) } else { bail!(format!("{conf:?} key is not supported by sealevel")); - }; - println!("~~~ created sealevel keypair: {:?}", key); - key + } } } diff --git a/rust/utils/run-locally/src/invariants.rs b/rust/utils/run-locally/src/invariants.rs index 00a982823a7..6900210469c 100644 --- a/rust/utils/run-locally/src/invariants.rs +++ b/rust/utils/run-locally/src/invariants.rs @@ -12,7 +12,7 @@ use crate::{fetch_metric, ZERO_MERKLE_INSERTION_KATHY_MESSAGES}; // This number should be even, so the messages can be split into two equal halves // sent before and after the relayer spins up, to avoid rounding errors. -pub const SOL_MESSAGES_EXPECTED: u32 = 0; +pub const SOL_MESSAGES_EXPECTED: u32 = 20; /// Use the metrics to check if the relayer queues are empty and the expected /// number of messages have been sent. diff --git a/rust/utils/run-locally/src/main.rs b/rust/utils/run-locally/src/main.rs index f1407dbbce6..b4efc6115fd 100644 --- a/rust/utils/run-locally/src/main.rs +++ b/rust/utils/run-locally/src/main.rs @@ -90,6 +90,7 @@ struct State { watchers: Vec>>, data: Vec>, } + impl State { fn push_agent(&mut self, handles: AgentHandles) { self.agents.push((handles.0, handles.1)); @@ -98,6 +99,7 @@ impl State { self.data.push(handles.4); } } + impl Drop for State { fn drop(&mut self) { SHUTDOWN.store(true, Ordering::Relaxed); @@ -137,7 +139,7 @@ fn main() -> ExitCode { let solana_checkpoint_path = Path::new(SOLANA_CHECKPOINT_LOCATION); fs::remove_dir_all(solana_checkpoint_path).unwrap_or_default(); - let checkpoints_dirs: Vec = (0..VALIDATOR_COUNT) + let checkpoints_dirs: Vec = (0..VALIDATOR_COUNT - 1) .map(|_| Box::new(tempdir().unwrap()) as DynPath) .chain([Box::new(solana_checkpoint_path) as DynPath]) .collect(); @@ -199,7 +201,6 @@ fn main() -> ExitCode { .arg("defaultSigner.key", RELAYER_KEYS[2]) .arg( "relayChains", - // "test1,test2,test3", "test1,test2,test3,sealeveltest1,sealeveltest2", ); diff --git a/rust/utils/run-locally/src/solana.rs b/rust/utils/run-locally/src/solana.rs index 027079b6385..3f5c75fd10b 100644 --- a/rust/utils/run-locally/src/solana.rs +++ b/rust/utils/run-locally/src/solana.rs @@ -285,7 +285,7 @@ pub fn start_solana_test_validator( pub fn initiate_solana_hyperlane_transfer( solana_cli_tools_path: PathBuf, solana_config_path: PathBuf, -) { +) -> Option { let sender = Program::new(concat_path(&solana_cli_tools_path, "solana")) .arg("config", solana_config_path.to_str().unwrap()) .arg("keypair", SOLANA_KEYPAIR) @@ -309,21 +309,23 @@ pub fn initiate_solana_hyperlane_transfer( .run_with_output() .join(); - let message_id = _get_message_id_from_logs(output); - if let Some(message_id) = message_id { + let message_id = get_message_id_from_logs(output); + if let Some(message_id) = message_id.clone() { sealevel_client(&solana_cli_tools_path, &solana_config_path) .cmd("igp") .cmd("pay-for-gas") .arg("program-id", "GwHaw8ewMyzZn9vvrZEnTEAAYpLdkGYs195XWcLDCN4U") - .arg("message-id", message_id) + .arg("message-id", message_id.clone()) .arg("destination-domain", SOLANA_REMOTE_CHAIN_ID) .arg("gas", "100000") .run() .join(); } + println!("sent sealevel message: {:?}", message_id); + message_id } -fn _get_message_id_from_logs(logs: Vec) -> Option { +fn get_message_id_from_logs(logs: Vec) -> Option { let message_id_regex = Regex::new(r"Dispatched message to \d+, ID 0x([0-9a-fA-F]+)").unwrap(); for log in logs { // Use the regular expression to capture the ID