Skip to content

Commit 1fea60a

Browse files
authored
Merge pull request #165 from m0-foundation/proto-366-hal-04
PROTO-366: HAL-04: Handle potential index out of bounds on sim ix
2 parents 06ffd41 + 802a1cd commit 1fea60a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

programs/portal/src/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ pub enum NTTError {
6969
InvalidReturnAccount,
7070
#[msg("Missing payer account")]
7171
MissingPayerAccount,
72+
#[msg("No whitelisted extensions in swap global")]
73+
NoWhitelistedExtensions,
7274
}
7375

7476
impl From<ScalingError> for NTTError {

programs/portal/src/instructions/resolve_execute.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ pub fn resolve_execute_vaa_v1<'a>(
407407
}
408408

409409
// Find the extension program ID based on the destination mint
410+
// Handle case where no extensions are whitelisted
411+
if swap_global_data.whitelisted_extensions.is_empty() {
412+
msg!("Cannot bridge to extension since none are whitelisted");
413+
return err!(NTTError::NoWhitelistedExtensions);
414+
}
415+
410416
let ext_program = swap_global_data
411417
.whitelisted_extensions
412418
.iter()

0 commit comments

Comments
 (0)