Skip to content

Commit

Permalink
chores: fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Dec 15, 2023
1 parent 832d3a8 commit 61c3013
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion rust/agents/scraper/src/db/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl ScraperDb {
{
Ok(Some(HyperlaneMessage {
// We do not write version to the DB.
version: 0,
version: 3,
origin: message.origin as u32,
destination: message.destination as u32,
nonce: message.nonce as u32,
Expand Down
2 changes: 1 addition & 1 deletion rust/chains/hyperlane-ethereum/tests/signer_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use hyperlane_core::{
pub fn output_message() {
let hyperlane_message = HyperlaneMessage {
nonce: 0,
version: 0,
version: 3,
origin: 1000,
sender: H256::from(H160::from_str("0x1111111111111111111111111111111111111111").unwrap()),
destination: 2000,
Expand Down
2 changes: 1 addition & 1 deletion rust/hyperlane-base/src/db/rocks/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mod test {

let m = HyperlaneMessage {
nonce: 100,
version: 0,
version: 3,
origin: 10,
sender: H256::from_low_u64_be(4),
destination: 12,
Expand Down
1 change: 0 additions & 1 deletion rust/hyperlane-base/src/settings/chains.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use ethers::prelude::Selector;
use h_cosmos::CosmosProvider;
use h_sealevel::SealevelProvider;
use std::collections::HashMap;

use eyre::{eyre, Context, Result};
Expand Down
17 changes: 16 additions & 1 deletion rust/hyperlane-core/src/types/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl From<&HyperlaneMessage> for RawHyperlaneMessage {
}

/// A full Hyperlane message between chains
#[derive(Default, Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq)]
pub struct HyperlaneMessage {
/// 1 Hyperlane version number
pub version: u8,
Expand All @@ -39,6 +39,21 @@ pub struct HyperlaneMessage {
pub body: Vec<u8>,
}

impl Default for HyperlaneMessage {
fn default() -> Self {
Self {
// Use version 3 now that Hyperlane V3 is the default
version: 3,
nonce: 0,
origin: 0,
sender: H256::zero(),
destination: 0,
recipient: H256::zero(),
body: vec![],
}
}
}

impl Sequenced for HyperlaneMessage {
fn sequence(&self) -> u32 {
self.nonce
Expand Down
27 changes: 12 additions & 15 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> {
) -> 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,19 +309,16 @@ 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.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.clone())
.arg("destination-domain", SOLANA_REMOTE_CHAIN_ID)
.arg("gas", "100000")
.run()
.join();
}
println!("sent sealevel message: {:?}", message_id);
let message_id = get_message_id_from_logs(output).expect("failed to get message id from logs");
sealevel_client(&solana_cli_tools_path, &solana_config_path)
.cmd("igp")
.cmd("pay-for-gas")
.arg("program-id", "GwHaw8ewMyzZn9vvrZEnTEAAYpLdkGYs195XWcLDCN4U")
.arg("message-id", message_id.clone())
.arg("destination-domain", SOLANA_REMOTE_CHAIN_ID)
.arg("gas", "100000")
.run()
.join();
message_id
}

Expand Down Expand Up @@ -351,7 +348,7 @@ pub fn solana_termination_invariants_met(
// This value was gotten by observing the relayer logs.
// TODO: get the actual message-id so we don't have to hardcode it
"message-id",
"0x7b8ba684e5ce44f898c5fa81785c83a00e32b5bef3412e648eb7a17bec497685",
"0x89c76191bd40b1858b7957e35bf3455122826e4737c5540b9dc5a555370d78c5",
)
.arg("program-id", "9tCUWNjpqcf3NUSrtp7vquYVCwbEByvLjZUrhG5dgvhj")
.run_with_output()
Expand Down

0 comments on commit 61c3013

Please sign in to comment.