Skip to content

Commit 67b4079

Browse files
hai-kreateserejke
authored andcommitted
fix: read checkpoint origin & index from message
1 parent ef499c0 commit 67b4079

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/agents/relayer/src/msg/metadata/multisig/message_id_multisig.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ impl MultisigIsmMetadataBuilder for MessageIdMultisigMetadataBuilder {
2222
vec![
2323
MetadataToken::CheckpointMailbox,
2424
MetadataToken::CheckpointRoot,
25-
// FIXME: Why does the original code not have the checkpoint index?
26-
// Cardano needs this to hash the checkpoint to verify against
27-
// the validator's signature.
28-
MetadataToken::CheckpointIndex,
2925
MetadataToken::Signatures,
3026
]
3127
}

rust/chains/hyperlane-cardano/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ hex = "0.4.3"
1515
tracing = { workspace = true }
1616
reqwest = { workspace = true }
1717
tokio = { workspace = true, features = ["macros"] }
18-
hyperlane-cardano-rpc-rust-client = "1.0.9"
18+
hyperlane-cardano-rpc-rust-client = "1.0.10"

rust/chains/hyperlane-cardano/src/rpc/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub mod conversion;
2626
pub struct CardanoMessageMetadata {
2727
origin_mailbox: H256,
2828
checkpoint_root: H256,
29-
checkpoint_index: u32,
3029
signatures: Vec<String>, // [u8; 64] is more precise than String
3130
}
3231

@@ -42,16 +41,12 @@ impl Decode for CardanoMessageMetadata {
4241
let mut checkpoint_root = H256::zero();
4342
reader.read_exact(checkpoint_root.as_mut())?;
4443

45-
let mut checkpoint_index = [0u8; 4];
46-
reader.read_exact(&mut checkpoint_index)?;
47-
4844
let mut signatures = vec![];
4945
reader.read_to_end(&mut signatures)?;
5046

5147
Ok(Self {
5248
origin_mailbox,
5349
checkpoint_root,
54-
checkpoint_index: u32::from_be_bytes(checkpoint_index),
5550
signatures: signatures
5651
.chunks(65)
5752
// Cardano checks raw signatures without the last byte
@@ -118,7 +113,6 @@ impl CardanoRpc {
118113
estimate_inbound_message_fee(
119114
&self.0,
120115
InboundMessageRequest {
121-
origin: message.origin,
122116
origin_mailbox: format!(
123117
"0x{}",
124118
parsed_metadata.origin_mailbox.encode_hex::<String>()
@@ -127,7 +121,6 @@ impl CardanoRpc {
127121
"0x{}",
128122
parsed_metadata.checkpoint_root.encode_hex::<String>()
129123
),
130-
checkpoint_index: parsed_metadata.checkpoint_index,
131124
message: Box::new(EstimateInboundMessageFeeRequestMessage {
132125
version: message.version as u32,
133126
nonce: message.nonce,
@@ -152,7 +145,6 @@ impl CardanoRpc {
152145
submit_inbound_message(
153146
&self.0,
154147
InboundMessageRequest {
155-
origin: message.origin,
156148
origin_mailbox: format!(
157149
"0x{}",
158150
parsed_metadata.origin_mailbox.encode_hex::<String>()
@@ -161,7 +153,6 @@ impl CardanoRpc {
161153
"0x{}",
162154
parsed_metadata.checkpoint_root.encode_hex::<String>()
163155
),
164-
checkpoint_index: parsed_metadata.checkpoint_index,
165156
message: Box::new(EstimateInboundMessageFeeRequestMessage {
166157
version: message.version as u32,
167158
nonce: message.nonce,

0 commit comments

Comments
 (0)