Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Fix library function visibility issue #301

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/v0.8/core/statistics/library/StatisticsLIB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ library StatisticsLIB {
function addTotal(
StatisticsType.Statistics storage self,
uint256 size
) external {
) internal {
self.total += size;
}

/// @notice Adds to the success in the statistics data
function addSuccess(
StatisticsType.Statistics storage self,
uint256 size
) external {
) internal {
uint256 ongoing = self.total - self.success - self.failed;
require(size <= ongoing, "invalid size to addSuccess");
self.success += size;
Expand All @@ -48,7 +48,7 @@ library StatisticsLIB {
function addFailed(
StatisticsType.Statistics storage self,
uint256 size
) external {
) internal {
uint256 ongoing = self.total - self.success - self.failed;
require(size <= ongoing, "invalid size to addFailed");
self.failed += size;
Expand All @@ -58,7 +58,7 @@ library StatisticsLIB {
function getOverview(
StatisticsType.Statistics storage self
)
external
internal
view
returns (
uint256 total,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ library StorageProvidersStatisticsLIB {
StatisticsType.StorageProvidersStatistics storage self,
uint64 storageProvider,
uint256 size
) external {
) internal {
require(size != 0, "invalid size to addStoraged");

if (self.storageProviderInfos[storageProvider] == 0) {
Expand All @@ -50,7 +50,7 @@ library StorageProvidersStatisticsLIB {
/// @return storageProviders Array of storage providers.
function getOverview(
StatisticsType.StorageProvidersStatistics storage self
) external view returns (uint64[] memory storageProviders) {
) internal view returns (uint64[] memory storageProviders) {
return (self.storageProviders);
}
}
12 changes: 6 additions & 6 deletions src/v0.8/core/statistics/library/StorageStatisticsLIB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ library StorageStatisticsLIB {
function addAllocated(
StatisticsType.StorageStatistics storage self,
uint256 size
) external {
) internal {
uint256 unAllocated = self.total - self.allocatedDatacap;
//solhint-disable-next-line
require(unAllocated >= size, "invalid size to addAllocated");
Expand All @@ -41,7 +41,7 @@ library StorageStatisticsLIB {
function addCanceled(
StatisticsType.StorageStatistics storage self,
uint256 size
) external {
) internal {
uint256 available = self.allocatedDatacap -
self.completed -
self.canceled;
Expand All @@ -54,7 +54,7 @@ library StorageStatisticsLIB {
function addStoraged(
StatisticsType.StorageStatistics storage self,
uint256 size
) external {
) internal {
uint256 available = self.allocatedDatacap -
self.completed -
self.canceled;
Expand All @@ -72,7 +72,7 @@ library StorageStatisticsLIB {
/// @return A boolean indicating whether the storage statistics represent a completed state.
function isStorageCompleted(
StatisticsType.StorageStatistics storage self
) external view returns (bool) {
) internal view returns (bool) {
if ((self.completed + self.canceled) == self.total) {
return true;
}
Expand All @@ -85,7 +85,7 @@ library StorageStatisticsLIB {
/// @return A boolean indicating whether the storage is considered successful.
function isStorageSuccessful(
StatisticsType.StorageStatistics storage self
) external view returns (bool) {
) internal view returns (bool) {
if (self.completed == self.total) {
return true;
}
Expand All @@ -102,7 +102,7 @@ library StorageStatisticsLIB {
function getOverview(
StatisticsType.StorageStatistics storage self
)
external
internal
view
returns (
uint256 total,
Expand Down
6 changes: 3 additions & 3 deletions src/v0.8/shared/utils/array/ArrayLIB.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ library ArrayUint16LIB {
function mergeSequentialArray(
uint16[] memory _starts,
uint16[] memory _ends
) public pure returns (uint16[] memory) {
) internal pure returns (uint16[] memory) {
// Check if the number of start values matches the number of end values
require(_starts.length == _ends.length, "start and end not match");

Expand Down Expand Up @@ -386,7 +386,7 @@ library ArrayUint32LIB {
function mergeSequentialArray(
uint32[] memory _starts,
uint32[] memory _ends
) public pure returns (uint32[] memory) {
) internal pure returns (uint32[] memory) {
// Check if the number of start values matches the number of end values
require(_starts.length == _ends.length, "start and end not match");

Expand Down Expand Up @@ -588,7 +588,7 @@ library ArrayUint64LIB {
function mergeSequentialArray(
uint64[] memory _starts,
uint64[] memory _ends
) public pure returns (uint64[] memory) {
) internal pure returns (uint64[] memory) {
// Check if the number of start values matches the number of end values
require(_starts.length == _ends.length, "start and end not match");

Expand Down
Loading