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

Commit c4d51f2

Browse files
authored
Fix init empty stack frame violation (#7058)
1 parent 06eb0bb commit c4d51f2

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ use {
2828
anchor_lang::prelude::*,
2929
};
3030

31+
#[inline(never)]
32+
pub fn merkle_tree_initialize_empty(
33+
header: &ConcurrentMerkleTreeHeader,
34+
tree_id: Pubkey,
35+
tree_bytes: &mut [u8],
36+
) -> Result<Box<ChangeLogEvent>> {
37+
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, initialize,)
38+
}
39+
40+
#[inline(never)]
3141
pub fn merkle_tree_initialize_with_root(
3242
header: &ConcurrentMerkleTreeHeader,
3343
tree_id: Pubkey,
@@ -37,6 +47,7 @@ pub fn merkle_tree_initialize_with_root(
3747
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, initialize_with_root, args)
3848
}
3949

50+
#[inline(never)]
4051
pub fn merkle_tree_set_leaf(
4152
header: &ConcurrentMerkleTreeHeader,
4253
tree_id: Pubkey,
@@ -46,6 +57,7 @@ pub fn merkle_tree_set_leaf(
4657
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, set_leaf, args)
4758
}
4859

60+
#[inline(never)]
4961
pub fn merkle_tree_fill_empty_or_append(
5062
header: &ConcurrentMerkleTreeHeader,
5163
tree_id: Pubkey,
@@ -55,6 +67,7 @@ pub fn merkle_tree_fill_empty_or_append(
5567
merkle_tree_apply_fn_mut!(header, tree_id, tree_bytes, fill_empty_or_append, args)
5668
}
5769

70+
#[inline(never)]
5871
pub fn merkle_tree_prove_leaf(
5972
header: &ConcurrentMerkleTreeHeader,
6073
tree_id: Pubkey,

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ pub mod spl_account_compression {
166166
Clock::get()?.slot,
167167
);
168168
header.serialize(&mut header_bytes)?;
169+
169170
let merkle_tree_size = merkle_tree_get_size(&header)?;
170171
let (tree_bytes, canopy_bytes) = rest.split_at_mut(merkle_tree_size);
171172
let id = ctx.accounts.merkle_tree.key();
172-
let change_log_event = merkle_tree_apply_fn_mut!(header, id, tree_bytes, initialize,)?;
173+
174+
let change_log_event = merkle_tree_initialize_empty(&header, id, tree_bytes)?;
175+
173176
wrap_event(
174177
&AccountCompressionEvent::ChangeLog(*change_log_event),
175178
&ctx.accounts.noop,

0 commit comments

Comments
 (0)