Skip to content

Commit 41eb6df

Browse files
committed
fix: cpi context refactor
1 parent 51690d7 commit 41eb6df

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

program-libs/compressed-account/src/instruction_data/with_account_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<'a> InstructionData<'a> for ZInstructionDataInvokeCpiWithAccountInfo<'a> {
337337
}
338338

339339
fn new_address_owner(&self) -> Vec<Option<Pubkey>> {
340-
vec![Some(self.invoking_program_id)]
340+
vec![Some(self.invoking_program_id); self.new_address_params.len()]
341341
}
342342

343343
fn proof(&self) -> Option<Ref<&'a [u8], CompressedProof>> {

program-libs/compressed-account/src/instruction_data/zero_copy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ impl<'a> InstructionData<'a> for ZInstructionDataInvoke<'a> {
475475
}
476476

477477
fn new_address_owner(&self) -> Vec<Option<Pubkey>> {
478-
vec![None]
478+
vec![None; self.new_address_params.len()]
479479
}
480480

481481
fn input_accounts(&self) -> &[impl InputAccount<'a>] {
@@ -604,7 +604,7 @@ impl<'a> InstructionData<'a> for ZInstructionDataInvokeCpi<'a> {
604604
}
605605

606606
fn new_address_owner(&self) -> Vec<Option<Pubkey>> {
607-
vec![None]
607+
vec![None; self.new_address_params.len()]
608608
}
609609

610610
fn output_accounts(&self) -> &[impl OutputAccount<'a>] {

programs/system/src/cpi_context/state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ impl<'a> ZCpiContextAccount<'a> {
6363
self.in_accounts.clear();
6464
self.out_accounts.clear();
6565
*self.output_data_len = 0.into();
66+
self.output_data.clear();
67+
self.remaining_data.fill(0);
6668
}
6769

6870
pub fn store_data<

0 commit comments

Comments
 (0)