Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Dec 14, 2023
1 parent 7c3be2b commit 941c5fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
6 changes: 2 additions & 4 deletions rust/hyperlane-base/src/settings/signers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl ChainSigner for fuels::prelude::WalletUnlocked {
#[async_trait]
impl BuildableWithSignerConf for Keypair {
async fn build(conf: &SignerConf) -> Result<Self, Report> {
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(
Expand All @@ -134,9 +134,7 @@ impl BuildableWithSignerConf for Keypair {
)
} else {
bail!(format!("{conf:?} key is not supported by sealevel"));
};
println!("~~~ created sealevel keypair: {:?}", key);
key
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust/utils/run-locally/src/invariants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions rust/utils/run-locally/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct State {
watchers: Vec<Box<dyn TaskHandle<Output = ()>>>,
data: Vec<Box<dyn ArbitraryData>>,
}

impl State {
fn push_agent(&mut self, handles: AgentHandles) {
self.agents.push((handles.0, handles.1));
Expand All @@ -98,6 +99,7 @@ impl State {
self.data.push(handles.4);
}
}

impl Drop for State {
fn drop(&mut self) {
SHUTDOWN.store(true, Ordering::Relaxed);
Expand Down Expand Up @@ -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<DynPath> = (0..VALIDATOR_COUNT)
let checkpoints_dirs: Vec<DynPath> = (0..VALIDATOR_COUNT - 1)
.map(|_| Box::new(tempdir().unwrap()) as DynPath)
.chain([Box::new(solana_checkpoint_path) as DynPath])
.collect();
Expand Down Expand Up @@ -199,7 +201,6 @@ fn main() -> ExitCode {
.arg("defaultSigner.key", RELAYER_KEYS[2])
.arg(
"relayChains",
// "test1,test2,test3",
"test1,test2,test3,sealeveltest1,sealeveltest2",
);

Expand Down
12 changes: 7 additions & 5 deletions rust/utils/run-locally/src/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
let sender = Program::new(concat_path(&solana_cli_tools_path, "solana"))
.arg("config", solana_config_path.to_str().unwrap())
.arg("keypair", SOLANA_KEYPAIR)
Expand All @@ -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<String>) -> Option<String> {
fn get_message_id_from_logs(logs: Vec<String>) -> Option<String> {
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
Expand Down

0 comments on commit 941c5fe

Please sign in to comment.