Skip to content

Commit ab96798

Browse files
committed
made changes except adding the tests
1 parent a52211e commit ab96798

File tree

3 files changed

+11
-44
lines changed

3 files changed

+11
-44
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# VIM
22
*.swp
3-
foundry.lock
3+
foundry.lock
4+
my-changes.txt

service_contracts/src/FilecoinWarmStorageService.sol

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,43 +1172,6 @@ contract FilecoinWarmStorageService is
11721172
return (epoch - activationEpoch) / maxProvingPeriod;
11731173
}
11741174

1175-
/**
1176-
* @notice Checks if a specific epoch has been proven
1177-
* @dev Returns true only if the epoch belongs to a proven proving period
1178-
* @param dataSetId The ID of the data set to check
1179-
* @param epoch The epoch to check
1180-
* @return True if the epoch has been proven, false otherwise
1181-
*/
1182-
function isEpochProven(uint256 dataSetId, uint256 epoch) public view returns (bool) {
1183-
// Check if data set is active
1184-
if (provingActivationEpoch[dataSetId] == 0) {
1185-
return false;
1186-
}
1187-
1188-
// Check if this epoch is before activation
1189-
if (epoch < provingActivationEpoch[dataSetId]) {
1190-
return false;
1191-
}
1192-
1193-
// Check if this epoch is in the future (beyond current block)
1194-
if (epoch > block.number) {
1195-
return false;
1196-
}
1197-
1198-
// Get the period this epoch belongs to
1199-
uint256 periodId = getProvingPeriodForEpoch(dataSetId, epoch);
1200-
1201-
// Special case: current ongoing proving period
1202-
uint256 currentPeriod = getProvingPeriodForEpoch(dataSetId, block.number);
1203-
if (periodId == currentPeriod) {
1204-
// For the current period, check if it has been proven already
1205-
return provenThisPeriod[dataSetId];
1206-
}
1207-
1208-
// For past periods, check the provenPeriods bitmapping
1209-
return 0 != provenPeriods[dataSetId][periodId >> 8] & (1 << (periodId & 255));
1210-
}
1211-
12121175
function max(uint256 a, uint256 b) internal pure returns (uint256) {
12131176
return a > b ? a : b;
12141177
}
@@ -1593,11 +1556,14 @@ contract FilecoinWarmStorageService is
15931556
}
15941557

15951558
function _isPeriodProven(uint256 dataSetId, uint256 periodId, uint256 currentPeriod) private view returns (bool) {
1596-
// if (periodId == currentPeriod) {
1597-
// return provenThisPeriod[dataSetId];
1598-
// }
1559+
if (periodId == currentPeriod) {
1560+
return provenThisPeriod[dataSetId];
1561+
}
15991562
// return provenPeriods[dataSetId][periodId];
1600-
1563+
uint256 isProven = provenPeriods[dataSetId][periodId >> 8] & (1 << (periodId & 255));
1564+
if(isProven == 1){
1565+
return true;
1566+
}
16011567
return false;
16021568
}
16031569

service_contracts/test/FilecoinWarmStorageService.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract FilecoinWarmStorageServiceTest is Test {
5959
// Test parameters
6060
bytes public extraData;
6161

62-
// Metadata size and count limits
62+
// Metadata size and count limits
6363
uint256 private constant MAX_KEY_LENGTH = 32;
6464
uint256 private constant MAX_VALUE_LENGTH = 128;
6565
uint256 private constant MAX_KEYS_PER_DATASET = 10;
@@ -126,7 +126,7 @@ contract FilecoinWarmStorageServiceTest is Test {
126126
mockUSDFC = new MockERC20();
127127
mockPDPVerifier = new MockPDPVerifier();
128128

129-
// Deploy actual ServiceProviderRegistry
129+
// Deploy actual ServiceProviderRegistry
130130
ServiceProviderRegistry registryImpl = new ServiceProviderRegistry();
131131
bytes memory registryInitData = abi.encodeWithSelector(ServiceProviderRegistry.initialize.selector);
132132
MyERC1967Proxy registryProxy = new MyERC1967Proxy(address(registryImpl), registryInitData);

0 commit comments

Comments
 (0)