Skip to content

Commit

Permalink
fix(axelar-gateway)!: fix message bcs peel
Browse files Browse the repository at this point in the history
  • Loading branch information
milapsheth committed Jun 7, 2024
1 parent e33738f commit b22bc51
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions move/axelar_gateway/sources/types/message.move
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module axelar_gateway::message {
use std::ascii::String;
use sui::bcs::{Self, BCS};
use sui::address;
use sui::hash;

use axelar_gateway::bytes32::{Self, Bytes32};
Expand All @@ -18,12 +17,6 @@ module axelar_gateway::message {
payload_hash: Bytes32,
}

/// ------
/// Errors
/// ------
/// Invalid bytes length
const EInvalidLength: u64 = 0;

/// -----------------
/// Public Functions
/// -----------------
Expand Down Expand Up @@ -51,17 +44,14 @@ module axelar_gateway::message {
let source_chain = bcs.peel_vec_u8().to_ascii_string();
let message_id = bcs.peel_vec_u8().to_ascii_string();
let source_address = bcs.peel_vec_u8().to_ascii_string();

let destination_id_bytes = bcs.peel_vec_u8();
assert!(destination_id_bytes.length() == 32, EInvalidLength);

let destination_id = bcs.peel_address();
let payload_hash = bytes32::peel(bcs);

Message {
source_chain,
message_id,
source_address,
destination_id: address::from_bytes(destination_id_bytes),
destination_id,
payload_hash,
}
}
Expand Down

0 comments on commit b22bc51

Please sign in to comment.