Skip to content

Commit b9a906b

Browse files
committed
update rust test
1 parent 36a64ac commit b9a906b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

programs/portal/src/instructions/resolve_execute.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn resolve_execute_vaa_v1<'a>(
9494
if let Some(acc_info) = find_account(ctx.remaining_accounts, config) {
9595
let config = Config::try_deserialize(&mut &acc_info.try_borrow_mut_data()?[..])?;
9696

97-
// Get mint for correct token account
97+
// Get mint for correct token program
9898
if find_account(ctx.remaining_accounts, config.mint).is_none() {
9999
missing.push(config.mint);
100100
}
@@ -325,7 +325,7 @@ pub fn resolve_execute_vaa_v1<'a>(
325325

326326
// release_inbound_mint and release_inbound_mint_extension share accounts
327327
let mut release_accounts = {
328-
let m_global = earn_pda(&[GLOBAL_SEED]);
328+
let m_global = Pubkey::find_program_address(&[GLOBAL_SEED], &earn::ID).0;
329329

330330
vec![
331331
SerializableAccountMeta {
@@ -541,10 +541,6 @@ fn pda(seeds: &[&[u8]]) -> Pubkey {
541541
Pubkey::find_program_address(seeds, &crate::ID).0
542542
}
543543

544-
fn earn_pda(seeds: &[&[u8]]) -> Pubkey {
545-
Pubkey::find_program_address(seeds, &earn::ID).0
546-
}
547-
548544
#[cfg(test)]
549545
mod tests {
550546
use std::str::FromStr;
@@ -579,11 +575,13 @@ mod tests {
579575
// Assert the result
580576
assert!(result.is_ok());
581577
let config = Pubkey::from_str("3WEmFf1y7MYgNgEKHjY6p7cRDR2HGtBgxzfABb91eqHv").unwrap();
578+
let mint = Pubkey::from_str("mzerokyEX9TNDoK4o2YZQBDmMzjokAeN6M2g2S3pLJo").unwrap();
582579

583580
match result.unwrap() {
584581
Resolver::Missing(missing) => {
585-
assert_eq!(missing.accounts.len(), 3);
582+
assert_eq!(missing.accounts.len(), 6);
586583
assert!(missing.accounts.contains(&config));
584+
assert!(!missing.accounts.contains(&mint));
587585
}
588586
_ => panic!("Expected missing accounts"),
589587
}
@@ -615,10 +613,13 @@ mod tests {
615613

616614
match result.unwrap() {
617615
Resolver::Missing(missing) => {
618-
assert_eq!(missing.accounts.len(), 3);
616+
assert_eq!(missing.accounts.len(), 6);
619617

620618
// config no longer missing
621619
assert!(!missing.accounts.contains(&config));
620+
621+
// mint now missing (pulled from config)
622+
assert!(missing.accounts.contains(&mint));
622623
}
623624
_ => panic!("Expected missing accounts"),
624625
}

0 commit comments

Comments
 (0)