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

Commit 2191e25

Browse files
committed
using the stackoverflow-safe version of the initialize_with_root call + minor fmt
1 parent 3ec1114 commit 2191e25

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

account-compression/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -308,17 +308,14 @@ pub mod spl_account_compression {
308308
assert_eq!(proof.len(), header.get_max_depth() as usize);
309309

310310
let id = ctx.accounts.merkle_tree.key();
311-
// A call is made to ConcurrentMerkleTree::initialize_with_root(root, rightmost_leaf, proof, rightmost_index)
312-
let change_log = merkle_tree_apply_fn_mut!(
313-
header,
314-
id,
315-
tree_bytes,
316-
initialize_with_root,
311+
// A call is made to ConcurrentMerkleTree::initialize_with_root
312+
let args = &InitializeWithRootArgs {
317313
root,
318314
rightmost_leaf,
319-
&proof,
320-
rightmost_index
321-
)?;
315+
proof_vec: proof,
316+
index: rightmost_index,
317+
};
318+
let change_log = merkle_tree_initialize_with_root(&header, id, tree_bytes, args)?;
322319
update_canopy(canopy_bytes, header.get_max_depth(), Some(&change_log))?;
323320
wrap_event(
324321
&AccountCompressionEvent::ChangeLog(*change_log),

libraries/concurrent-merkle-tree/src/node.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ pub fn empty_node_cached<const N: usize>(level: u32, cache: &[Node; N]) -> Node
2727
data
2828
}
2929

30-
3130
/// Calculates and caches the hash of empty nodes up to level i
32-
pub fn empty_node_cached_mut<const N: usize>(level: u32, cache: &mut[Node; N]) -> Node {
31+
pub fn empty_node_cached_mut<const N: usize>(level: u32, cache: &mut [Node; N]) -> Node {
3332
let mut data = EMPTY;
3433
if level != 0 {
3534
let target = (level - 1) as usize;

0 commit comments

Comments
 (0)