Skip to content

Commit

Permalink
Fix stack frame violation for append in Account Compression (#7057)
Browse files Browse the repository at this point in the history
* fix stack frame violation for append

* add inline macro
  • Loading branch information
ngundotra authored Jul 26, 2024
1 parent 591eeed commit 06eb0bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@ pub fn merkle_tree_prove_leaf(
) -> Result<Box<ChangeLogEvent>> {
merkle_tree_apply_fn!(header, tree_id, tree_bytes, prove_leaf, args)
}

#[inline(never)]
pub fn merkle_tree_append_leaf(
header: &ConcurrentMerkleTreeHeader,
tree_id: Pubkey,
tree_bytes: &mut [u8],
args: &[u8; 32],
) -> Result<Box<ChangeLogEvent>> {
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, append, *args)
}
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ pub mod spl_account_compression {
let id = ctx.accounts.merkle_tree.key();
let merkle_tree_size = merkle_tree_get_size(&header)?;
let (tree_bytes, canopy_bytes) = rest.split_at_mut(merkle_tree_size);
let change_log_event = merkle_tree_apply_fn_mut!(header, id, tree_bytes, append, leaf)?;
let change_log_event = merkle_tree_append_leaf(&header, id, tree_bytes, &leaf)?;
update_canopy(
canopy_bytes,
header.get_max_depth(),
Expand Down

0 comments on commit 06eb0bb

Please sign in to comment.