Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
bryzettler committed Dec 4, 2024
1 parent 65d73f3 commit 14ad0e1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ pub struct InitializeSharedMerkleV0<'info> {
pub const STARTING_DEPTH: u32 = 17;
pub const BUFFER_SIZE: u32 = 64;

fn div_ceil(dividend: u64, divisor: u64) -> u64 {
(dividend + divisor - 1) / divisor
}

#[allow(clippy::manual_div_ceil)]
pub fn handler(
ctx: Context<InitializeSharedMerkleV0>,
args: InitializeSharedMerkleArgsV0,
Expand All @@ -52,7 +57,7 @@ pub fn handler(
let total_lamports = ctx.accounts.merkle_tree.lamports() + ctx.accounts.tree_authority.lamports();
ctx.accounts.shared_merkle.set_inner(SharedMerkleV0 {
proof_size: args.proof_size,
price_per_mint: total_lamports.div_ceil(2u64.pow(depth) - 3), // because we can swap with 3 left
price_per_mint: div_ceil(total_lamports, 2u64.pow(depth) - 3), // because we can swap with 3 left
merkle_tree: ctx.accounts.merkle_tree.key(),
bump_seed: ctx.bumps["shared_merkle"],
});
Expand Down

0 comments on commit 14ad0e1

Please sign in to comment.