Skip to content

Commit

Permalink
chore(sealevel): upgrade message version to v3
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Dec 11, 2023
1 parent dae8b26 commit caac97b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion rust/sealevel/libraries/multisig-ism/src/test_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const DESTINATION_DOMAIN: u32 = 4321u32;

pub fn get_multisig_ism_test_data() -> MultisigIsmTestData {
let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 69,
origin: ORIGIN_DOMAIN,
sender: H256::from_str(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ async fn test_transfer_remote(spl_token_program_id: Pubkey) {
.unwrap();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
sender: program_id.to_bytes().into(),
Expand Down Expand Up @@ -869,7 +869,7 @@ async fn transfer_from_remote(
);

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: origin_override.unwrap_or(REMOTE_DOMAIN),
// Default to the remote router as the sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ async fn test_transfer_remote() {
.unwrap();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
sender: program_id.to_bytes().into(),
Expand Down Expand Up @@ -616,7 +616,7 @@ async fn transfer_from_remote(
let recipient: H256 = recipient_pubkey.to_bytes().into();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: origin_override.unwrap_or(REMOTE_DOMAIN),
// Default to the remote router as the sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ async fn transfer_from_remote(
);

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: origin_override.unwrap_or(REMOTE_DOMAIN),
// Default to the remote router as the sender
Expand Down Expand Up @@ -783,7 +783,7 @@ async fn test_transfer_remote() {
.unwrap();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
sender: program_id.to_bytes().into(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ async fn test_set_validators_and_threshold_creates_pda_account() {
// to fetch the account metas required for the instruction.

let test_message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: domain,
sender: H256::random(),
Expand Down
22 changes: 11 additions & 11 deletions rust/sealevel/programs/mailbox-test/src/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async fn test_dispatch_from_eoa() {
.unwrap();

let expected_message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -238,7 +238,7 @@ async fn test_dispatch_from_eoa() {
.unwrap();

let expected_message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 1,
origin: LOCAL_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -300,7 +300,7 @@ async fn test_dispatch_from_program() {
.unwrap();

let expected_message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
// The sender should be the program ID because its dispatch authority signed
Expand Down Expand Up @@ -389,7 +389,7 @@ async fn test_dispatch_returns_message_id() {
message_body: message_body.clone(),
};
let expected_message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: LOCAL_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -574,7 +574,7 @@ async fn test_process_successful_verify_and_handle() {
let recipient_id = hyperlane_sealevel_test_send_receiver::id();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -605,7 +605,7 @@ async fn test_process_successful_verify_and_handle() {

// Send another to illustrate that the sequence is incremented
let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -647,7 +647,7 @@ async fn test_process_errors_if_message_already_processed() {
let recipient_id = hyperlane_sealevel_test_send_receiver::id();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -697,7 +697,7 @@ async fn test_process_errors_if_ism_verify_fails() {
test_ism.set_accept(false).await.unwrap();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -743,7 +743,7 @@ async fn test_process_errors_if_recipient_handle_fails() {
.unwrap();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -784,7 +784,7 @@ async fn test_process_errors_if_incorrect_destination_domain() {
let recipient_id = hyperlane_sealevel_test_send_receiver::id();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down Expand Up @@ -905,7 +905,7 @@ async fn test_process_errors_if_reentrant() {
let recipient_id = hyperlane_sealevel_test_send_receiver::id();

let message = HyperlaneMessage {
version: 0,
version: 3,
nonce: 0,
origin: REMOTE_DOMAIN,
sender: payer.pubkey().to_bytes().into(),
Expand Down
2 changes: 1 addition & 1 deletion rust/sealevel/programs/mailbox/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use solana_program::{
use crate::{mailbox_inbox_pda_seeds, mailbox_outbox_pda_seeds};

/// The current message version.
pub const VERSION: u8 = 0;
pub const VERSION: u8 = 3;

/// Maximum bytes per message = 2 KiB (somewhat arbitrarily set to begin).
pub const MAX_MESSAGE_BODY_BYTES: usize = 2 * 2_usize.pow(10);
Expand Down

0 comments on commit caac97b

Please sign in to comment.