Skip to content

Commit d857a69

Browse files
committed
made changes except adding the tests
1 parent 0b6bf57 commit d857a69

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
@@ -1141,43 +1141,6 @@ contract FilecoinWarmStorageService is
11411141
return (epoch - activationEpoch) / maxProvingPeriod;
11421142
}
11431143

1144-
/**
1145-
* @notice Checks if a specific epoch has been proven
1146-
* @dev Returns true only if the epoch belongs to a proven proving period
1147-
* @param dataSetId The ID of the data set to check
1148-
* @param epoch The epoch to check
1149-
* @return True if the epoch has been proven, false otherwise
1150-
*/
1151-
function isEpochProven(uint256 dataSetId, uint256 epoch) public view returns (bool) {
1152-
// Check if data set is active
1153-
if (provingActivationEpoch[dataSetId] == 0) {
1154-
return false;
1155-
}
1156-
1157-
// Check if this epoch is before activation
1158-
if (epoch < provingActivationEpoch[dataSetId]) {
1159-
return false;
1160-
}
1161-
1162-
// Check if this epoch is in the future (beyond current block)
1163-
if (epoch > block.number) {
1164-
return false;
1165-
}
1166-
1167-
// Get the period this epoch belongs to
1168-
uint256 periodId = getProvingPeriodForEpoch(dataSetId, epoch);
1169-
1170-
// Special case: current ongoing proving period
1171-
uint256 currentPeriod = getProvingPeriodForEpoch(dataSetId, block.number);
1172-
if (periodId == currentPeriod) {
1173-
// For the current period, check if it has been proven already
1174-
return provenThisPeriod[dataSetId];
1175-
}
1176-
1177-
// For past periods, check the provenPeriods bitmapping
1178-
return 0 != provenPeriods[dataSetId][periodId >> 8] & (1 << (periodId & 255));
1179-
}
1180-
11811144
function max(uint256 a, uint256 b) internal pure returns (uint256) {
11821145
return a > b ? a : b;
11831146
}
@@ -1559,11 +1522,14 @@ contract FilecoinWarmStorageService is
15591522
}
15601523

15611524
function _isPeriodProven(uint256 dataSetId, uint256 periodId, uint256 currentPeriod) private view returns (bool) {
1562-
// if (periodId == currentPeriod) {
1563-
// return provenThisPeriod[dataSetId];
1564-
// }
1525+
if (periodId == currentPeriod) {
1526+
return provenThisPeriod[dataSetId];
1527+
}
15651528
// return provenPeriods[dataSetId][periodId];
1566-
1529+
uint256 isProven = provenPeriods[dataSetId][periodId >> 8] & (1 << (periodId & 255));
1530+
if(isProven == 1){
1531+
return true;
1532+
}
15671533
return false;
15681534
}
15691535

service_contracts/test/FilecoinWarmStorageService.t.sol

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

63-
// Metadata size and count limits
63+
// Metadata size and count limits
6464
uint256 private constant MAX_KEY_LENGTH = 32;
6565
uint256 private constant MAX_VALUE_LENGTH = 128;
6666
uint256 private constant MAX_KEYS_PER_DATASET = 10;
@@ -128,7 +128,7 @@ contract FilecoinWarmStorageServiceTest is MockFVMTest {
128128
mockUSDFC = new MockERC20();
129129
mockPDPVerifier = new MockPDPVerifier();
130130

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

0 commit comments

Comments
 (0)