Skip to content

Commit 9a81882

Browse files
feat: remove dataset creation fee (#245)
# Remove Dataset Creation Fee ## Summary Removes the 0.1 USDFC dataset creation fee. ## Changes - **Removed** `DATA_SET_CREATION_FEE` constant and initialization - **Updated** `createDataSet()` function to set zero lockup and payment amounts - **Fixed** tests to expect no fee charges during dataset creation - **Updated** comments and test names to reflect fee removal ## Rationale The dataset creation fee was originally introduced to prevent storage providers from creating unused datasets. However, since dataset creation now coincides with adding the first data piece, this concern is addressed without the fee. ## Files Changed - `src/FilecoinWarmStorageService.sol` - Removed fee logic - `test/FilecoinWarmStorageService.t.sol` - Updated test expectations ## Testing - All existing tests pass with updated expectations - Dataset creation now requires no upfront payment Issue #241
1 parent 7ce6cd4 commit 9a81882

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

service_contracts/src/FilecoinWarmStorageService.sol

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ contract FilecoinWarmStorageService is
170170
// Burn Address
171171
address payable private constant BURN_ADDRESS = payable(0xff00000000000000000000000000000000000063);
172172

173-
// Dynamic fee values based on token decimals
174-
uint256 private immutable DATA_SET_CREATION_FEE; // 0.1 USDFC with correct decimals
175-
176173
// Token decimals
177174
uint8 private immutable TOKEN_DECIMALS;
178175

@@ -315,7 +312,6 @@ contract FilecoinWarmStorageService is
315312

316313
// Initialize the fee constants based on the actual token decimals
317314
STORAGE_PRICE_PER_TIB_PER_MONTH = (5 * 10 ** TOKEN_DECIMALS) / 2; // 2.5 USDFC
318-
DATA_SET_CREATION_FEE = (1 * 10 ** TOKEN_DECIMALS) / 10; // 0.1 USDFC
319315
CACHE_MISS_PRICE_PER_TIB_PER_MONTH = (1 * 10 ** TOKEN_DECIMALS) / 2; // 0.5 USDFC
320316
CDN_PRICE_PER_TIB_PER_MONTH = (1 * 10 ** TOKEN_DECIMALS) / 2; // 0.5 USDFC
321317
}
@@ -570,21 +566,8 @@ contract FilecoinWarmStorageService is
570566
// Store reverse mapping from rail ID to data set ID for validation
571567
railToDataSet[pdpRailId] = dataSetId;
572568

573-
// First, set a lockupFixed value that's at least equal to the one-time payment
574-
// This is necessary because modifyRailPayment requires that lockupFixed >= oneTimePayment
575-
payments.modifyRailLockup(
576-
pdpRailId,
577-
DEFAULT_LOCKUP_PERIOD,
578-
DATA_SET_CREATION_FEE // lockupFixed equal to the one-time payment amount
579-
);
580-
581-
// Charge the one-time data set creation fee
582-
// This is a payment from payer to data set service provider of a fixed amount
583-
payments.modifyRailPayment(
584-
pdpRailId,
585-
0, // Initial rate is 0, will be updated when roots are added
586-
DATA_SET_CREATION_FEE // One-time payment amount
587-
);
569+
// Set lockup period for the rail
570+
payments.modifyRailLockup(pdpRailId, DEFAULT_LOCKUP_PERIOD, 0);
588571

589572
uint256 cacheMissRailId = 0;
590573
uint256 cdnRailId = 0;

service_contracts/test/FilecoinWarmStorageService.t.sol

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ contract FilecoinWarmStorageServiceTest is Test {
462462
return (keys, values);
463463
}
464464

465-
function testCreateDataSetCreatesRailAndChargesFee() public {
465+
function testCreateDataSetCreatesRail() public {
466466
// Prepare ExtraData - withCDN key presence means CDN is enabled
467467
(string[] memory metadataKeys, string[] memory metadataValues) = _getSingleMetadataKV("withCDN", "true");
468468

@@ -490,16 +490,12 @@ contract FilecoinWarmStorageServiceTest is Test {
490490
365 days // max lockup period
491491
);
492492

493-
// Client deposits funds to the Payments contract for the one-time fee
494-
uint256 depositAmount = 1e6; // 10x the required fee
493+
// Client deposits funds to the Payments contract for future payments
494+
uint256 depositAmount = 1e5; // Sufficient funds for future operations
495495
mockUSDFC.approve(address(payments), depositAmount);
496496
payments.deposit(mockUSDFC, client, depositAmount);
497497
vm.stopPrank();
498498

499-
// Get account balances before creating data set
500-
(uint256 clientFundsBefore,) = getAccountInfo(mockUSDFC, client);
501-
(uint256 spFundsBefore,) = getAccountInfo(mockUSDFC, serviceProvider);
502-
503499
// Expect DataSetCreated event when creating the data set
504500
vm.expectEmit(true, true, true, true);
505501
emit FilecoinWarmStorageService.DataSetCreated(
@@ -578,19 +574,6 @@ contract FilecoinWarmStorageServiceTest is Test {
578574
assertEq(cdnRail.commissionRateBps, 0, "No commission");
579575
assertEq(cdnRail.lockupFixed, 0, "Lockup fixed should be 0 after one-time payment");
580576
assertEq(cdnRail.paymentRate, 0, "Initial payment rate should be 0");
581-
582-
// Get account balances after creating data set
583-
(uint256 clientFundsAfter,) = getAccountInfo(mockUSDFC, client);
584-
(uint256 spFundsAfter,) = getAccountInfo(mockUSDFC, serviceProvider);
585-
586-
// Calculate expected client balance
587-
uint256 expectedClientFundsAfter = clientFundsBefore - 1e5;
588-
589-
// Verify balances changed correctly (one-time fee transferred)
590-
assertEq(
591-
clientFundsAfter, expectedClientFundsAfter, "Client funds should decrease by the data set creation fee"
592-
);
593-
assertTrue(spFundsAfter > spFundsBefore, "Service provider funds should increase");
594577
}
595578

596579
function testCreateDataSetNoCDN() public {
@@ -621,8 +604,8 @@ contract FilecoinWarmStorageServiceTest is Test {
621604
365 days // max lockup period
622605
);
623606

624-
// Client deposits funds to the Payments contract for the one-time fee
625-
uint256 depositAmount = 1e6; // 10x the required fee
607+
// Client deposits funds to the Payments contract for future payments
608+
uint256 depositAmount = 1e5; // Sufficient funds for future operations
626609
mockUSDFC.approve(address(payments), depositAmount);
627610
payments.deposit(mockUSDFC, client, depositAmount);
628611
vm.stopPrank();
@@ -700,7 +683,7 @@ contract FilecoinWarmStorageServiceTest is Test {
700683
1000e6, // lockup allowance (1000 USDFC)
701684
365 days // max lockup period
702685
);
703-
uint256 depositAmount = 1e6; // 10x the required fee
686+
uint256 depositAmount = 1e5;
704687
mockUSDFC.approve(address(payments), depositAmount);
705688
payments.deposit(mockUSDFC, client, depositAmount);
706689
vm.stopPrank();

0 commit comments

Comments
 (0)