Skip to content

Commit 7095dc7

Browse files
committed
cache activatonEpoch in validatePayment
1 parent 1a9e4ab commit 7095dc7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

service_contracts/src/FilecoinWarmStorageService.sol

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,8 @@ contract FilecoinWarmStorageService is
14501450
require(totalEpochsRequested > 0, Errors.InvalidEpochRange(fromEpoch, toEpoch));
14511451

14521452
// If proving wasn't ever activated for this data set, don't pay anything
1453-
if (provingActivationEpoch[dataSetId] == 0) {
1453+
uint256 activationEpoch = provingActivationEpoch[dataSetId];
1454+
if (activationEpoch == 0) {
14541455
return ValidationResult({
14551456
modifiedAmount: 0,
14561457
settleUpto: fromEpoch,
@@ -1463,7 +1464,7 @@ contract FilecoinWarmStorageService is
14631464
uint256 lastProvenEpoch = fromEpoch;
14641465

14651466
(provenEpochCount, lastProvenEpoch) =
1466-
_findProvenEpochs(dataSetId, fromEpoch, toEpoch, provenEpochCount, lastProvenEpoch);
1467+
_findProvenEpochs(dataSetId, fromEpoch, toEpoch, provenEpochCount, lastProvenEpoch, activationEpoch);
14671468

14681469
// If no epochs are proven, we can't settle anything
14691470
if (provenEpochCount == 0) {
@@ -1492,9 +1493,9 @@ contract FilecoinWarmStorageService is
14921493
uint256 fromEpoch,
14931494
uint256 toEpoch,
14941495
uint256 provenEpochCount,
1495-
uint256 lastProvenEpoch
1496+
uint256 lastProvenEpoch,
1497+
uint256 activationEpoch
14961498
) internal view returns (uint256, uint256) {
1497-
uint256 activationEpoch = provingActivationEpoch[dataSetId];
14981499
if (toEpoch < activationEpoch) {
14991500
revert Errors.InvalidEpochRange(fromEpoch, toEpoch);
15001501
}

0 commit comments

Comments
 (0)