Skip to content

Commit

Permalink
update libs
Browse files Browse the repository at this point in the history
  • Loading branch information
S1nus committed Aug 7, 2024
1 parent 9fde028 commit bdf6d18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ds-test
5 changes: 5 additions & 0 deletions src/lib/commitment/Commitment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.22;

import {Namespace, isReservedNamespace} from "../tree/Types.sol";
import "openzeppelin-contracts/contracts/utils/math/Math.sol";
import "../../../lib/openzeppelin-contracts/contracts/utils/math/Math.sol";
import "forge-std/console.sol";

uint256 constant SUBTREE_ROOT_THRESHOLD = 64;
Expand Down Expand Up @@ -113,6 +114,10 @@ function roundUpPowerOfTwo(uint256 x) pure returns (uint256) {
return result;
}

function blobMinSquareSize(uint256 shareCount) pure returns (uint256) {
return roundUpPowerOfTwo(Math.sqrt(shareCount, Math.Rounding.Ceil));
}

function subtreeWidth(uint256 shareCount, uint256 subtreeRootThreshold) pure returns (uint256) {
uint256 s = shareCount / SUBTREE_ROOT_THRESHOLD;
if (s != 0) {
Expand Down

0 comments on commit bdf6d18

Please sign in to comment.