Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 06eb0bb

Browse files
authored
Fix stack frame violation for append in Account Compression (#7057)
* fix stack frame violation for append * add inline macro
1 parent 591eeed commit 06eb0bb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

account-compression/programs/account-compression/src/concurrent_tree_wrapper.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,13 @@ pub fn merkle_tree_prove_leaf(
6363
) -> Result<Box<ChangeLogEvent>> {
6464
merkle_tree_apply_fn!(header, tree_id, tree_bytes, prove_leaf, args)
6565
}
66+
67+
#[inline(never)]
68+
pub fn merkle_tree_append_leaf(
69+
header: &ConcurrentMerkleTreeHeader,
70+
tree_id: Pubkey,
71+
tree_bytes: &mut [u8],
72+
args: &[u8; 32],
73+
) -> Result<Box<ChangeLogEvent>> {
74+
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, append, *args)
75+
}

account-compression/programs/account-compression/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ pub mod spl_account_compression {
382382
let id = ctx.accounts.merkle_tree.key();
383383
let merkle_tree_size = merkle_tree_get_size(&header)?;
384384
let (tree_bytes, canopy_bytes) = rest.split_at_mut(merkle_tree_size);
385-
let change_log_event = merkle_tree_apply_fn_mut!(header, id, tree_bytes, append, leaf)?;
385+
let change_log_event = merkle_tree_append_leaf(&header, id, tree_bytes, &leaf)?;
386386
update_canopy(
387387
canopy_bytes,
388388
header.get_max_depth(),

0 commit comments

Comments
 (0)