Skip to content

Commit 0f671ca

Browse files
committed
fix: s/calculateRatesPerEpoch/calculateRatePerEpoch
1 parent 9e1769a commit 0f671ca

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

service_contracts/abi/FilecoinWarmStorageService.abi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
},
102102
{
103103
"type": "function",
104-
"name": "calculateRatesPerEpoch",
104+
"name": "calculateRatePerEpoch",
105105
"inputs": [
106106
{
107107
"name": "totalBytes",

service_contracts/src/FilecoinWarmStorageService.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,8 +1153,7 @@ contract FilecoinWarmStorageService is
11531153
uint256 totalBytes = leafCount * BYTES_PER_LEAF;
11541154
FilecoinPayV1 payments = FilecoinPayV1(paymentsContractAddress);
11551155

1156-
// Update the PDP rail payment rate with the new rate and no one-time
1157-
// payment
1156+
// Update the PDP rail payment rate with the new rate and no one-time payment
11581157
uint256 pdpRailId = dataSetInfo[dataSetId].pdpRailId;
11591158
uint256 newStorageRatePerEpoch = _calculateStorageRate(totalBytes);
11601159
payments.modifyRailPayment(
@@ -1231,7 +1230,7 @@ contract FilecoinWarmStorageService is
12311230
* @param totalBytes Total size of the stored data in bytes
12321231
* @return storageRate The PDP storage rate per epoch
12331232
*/
1234-
function calculateRatesPerEpoch(uint256 totalBytes) external view returns (uint256 storageRate) {
1233+
function calculateRatePerEpoch(uint256 totalBytes) external view returns (uint256 storageRate) {
12351234
storageRate = _calculateStorageRate(totalBytes);
12361235
}
12371236

service_contracts/test/FilecoinWarmStorageService.t.sol

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -963,19 +963,19 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
963963
uint256 expectedMinPerEpoch = expectedMinPerMonth / 86400; // Convert to per-epoch
964964

965965
// Test 0 bytes
966-
uint256 rateZero = pdpServiceWithPayments.calculateRatesPerEpoch(0);
966+
uint256 rateZero = pdpServiceWithPayments.calculateRatePerEpoch(0);
967967
assertEq(rateZero, expectedMinPerEpoch, "0 bytes should return 0.06 USDFC/month minimum");
968968

969969
// Test 1 GiB
970-
uint256 rateOneGiB = pdpServiceWithPayments.calculateRatesPerEpoch(oneGiB);
970+
uint256 rateOneGiB = pdpServiceWithPayments.calculateRatePerEpoch(oneGiB);
971971
assertEq(rateOneGiB, expectedMinPerEpoch, "1 GiB should return minimum rate");
972972

973973
// Test 10 GiB
974-
uint256 rateTenGiB = pdpServiceWithPayments.calculateRatesPerEpoch(10 * oneGiB);
974+
uint256 rateTenGiB = pdpServiceWithPayments.calculateRatePerEpoch(10 * oneGiB);
975975
assertEq(rateTenGiB, expectedMinPerEpoch, "10 GiB should return minimum rate");
976976

977977
// Test 24 GiB (below crossover)
978-
uint256 rateTwentyFourGiB = pdpServiceWithPayments.calculateRatesPerEpoch(24 * oneGiB);
978+
uint256 rateTwentyFourGiB = pdpServiceWithPayments.calculateRatePerEpoch(24 * oneGiB);
979979
assertEq(rateTwentyFourGiB, expectedMinPerEpoch, "24 GiB should return minimum rate");
980980
}
981981

@@ -988,11 +988,11 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
988988
uint256 expectedMinPerEpoch = expectedMinPerMonth / 86400;
989989

990990
// 24 GiB: natural rate (0.0586) < minimum (0.06), so returns minimum
991-
uint256 rate24GiB = pdpServiceWithPayments.calculateRatesPerEpoch(24 * oneGiB);
991+
uint256 rate24GiB = pdpServiceWithPayments.calculateRatePerEpoch(24 * oneGiB);
992992
assertEq(rate24GiB, expectedMinPerEpoch, "24 GiB should use minimum floor");
993993

994994
// 25 GiB: natural rate (0.0610) > minimum (0.06), so returns natural rate
995-
uint256 rate25GiB = pdpServiceWithPayments.calculateRatesPerEpoch(25 * oneGiB);
995+
uint256 rate25GiB = pdpServiceWithPayments.calculateRatePerEpoch(25 * oneGiB);
996996
assert(rate25GiB > expectedMinPerEpoch);
997997

998998
// Verify it's actually proportional (not minimum)
@@ -1010,16 +1010,16 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
10101010
uint256 expectedMinPerEpoch = expectedMinPerMonth / 86400;
10111011

10121012
// Test 48 GiB
1013-
uint256 rate48GiB = pdpServiceWithPayments.calculateRatesPerEpoch(48 * oneGiB);
1013+
uint256 rate48GiB = pdpServiceWithPayments.calculateRatePerEpoch(48 * oneGiB);
10141014
assert(rate48GiB > expectedMinPerEpoch);
10151015

10161016
// Test 100 GiB
1017-
uint256 rate100GiB = pdpServiceWithPayments.calculateRatesPerEpoch(100 * oneGiB);
1017+
uint256 rate100GiB = pdpServiceWithPayments.calculateRatePerEpoch(100 * oneGiB);
10181018
assert(rate100GiB > rate48GiB);
10191019

10201020
// Test 1 TiB
10211021
uint256 oneTiB = oneGiB * 1024;
1022-
uint256 rateOneTiB = pdpServiceWithPayments.calculateRatesPerEpoch(oneTiB);
1022+
uint256 rateOneTiB = pdpServiceWithPayments.calculateRatePerEpoch(oneTiB);
10231023
assert(rateOneTiB > rate100GiB);
10241024

10251025
// Verify proportional scaling
@@ -1032,7 +1032,7 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
10321032
uint256 oneGiB = 1024 * 1024 * 1024;
10331033

10341034
// Get rate per epoch for dataset below crossover point
1035-
uint256 ratePerEpoch = pdpServiceWithPayments.calculateRatesPerEpoch(oneGiB);
1035+
uint256 ratePerEpoch = pdpServiceWithPayments.calculateRatePerEpoch(oneGiB);
10361036

10371037
// Convert to rate per month (86400 epochs per month)
10381038
uint256 ratePerMonth = ratePerEpoch * 86400;

0 commit comments

Comments
 (0)