|
|
@ -2,25 +2,27 @@ use async_trait::async_trait; |
|
|
|
use serde::{Deserialize, Serialize}; |
|
|
|
use serde::{Deserialize, Serialize}; |
|
|
|
use sha3::{digest::Update, Digest, Keccak256}; |
|
|
|
use sha3::{digest::Update, Digest, Keccak256}; |
|
|
|
|
|
|
|
|
|
|
|
use crate::{utils::domain_hash, Signable, SignedType, H256}; |
|
|
|
use crate::{utils::domain_hash, Signable, SignedType, H160, H256}; |
|
|
|
|
|
|
|
|
|
|
|
/// An Hyperlane checkpoint
|
|
|
|
/// An Hyperlane checkpoint
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] |
|
|
|
pub struct Announcement { |
|
|
|
pub struct Announcement { |
|
|
|
|
|
|
|
/// The validator address
|
|
|
|
|
|
|
|
pub validator: H160, |
|
|
|
/// The mailbox address
|
|
|
|
/// The mailbox address
|
|
|
|
pub mailbox_address: H256, |
|
|
|
pub mailbox_address: H256, |
|
|
|
/// The mailbox chain
|
|
|
|
/// The mailbox chain
|
|
|
|
pub mailbox_domain: u32, |
|
|
|
pub mailbox_domain: u32, |
|
|
|
/// The checkpointed root
|
|
|
|
/// The location of signed checkpoints
|
|
|
|
pub storage_metadata: String, |
|
|
|
pub storage_location: String, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl std::fmt::Display for Announcement { |
|
|
|
impl std::fmt::Display for Announcement { |
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
|
|
|
write!( |
|
|
|
write!( |
|
|
|
f, |
|
|
|
f, |
|
|
|
"Announcement(domain: {}, mailbox: {:x}, metadata: {})", |
|
|
|
"Announcement(domain: {}, mailbox: {:x}, location: {})", |
|
|
|
self.mailbox_domain, self.mailbox_address, self.storage_metadata |
|
|
|
self.mailbox_domain, self.mailbox_address, self.storage_location |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -33,7 +35,7 @@ impl Signable for Announcement { |
|
|
|
H256::from_slice( |
|
|
|
H256::from_slice( |
|
|
|
Keccak256::new() |
|
|
|
Keccak256::new() |
|
|
|
.chain(domain_hash(self.mailbox_address, self.mailbox_domain)) |
|
|
|
.chain(domain_hash(self.mailbox_address, self.mailbox_domain)) |
|
|
|
.chain(&self.storage_metadata) |
|
|
|
.chain(&self.storage_location) |
|
|
|
.finalize() |
|
|
|
.finalize() |
|
|
|
.as_slice(), |
|
|
|
.as_slice(), |
|
|
|
) |
|
|
|
) |
|
|
|