Skip to content

Commit 7ddb183

Browse files
committed
cache activatonEpoch in validatePayment
1 parent df87fa7 commit 7ddb183

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
@@ -1433,7 +1433,8 @@ contract FilecoinWarmStorageService is
14331433
require(totalEpochsRequested > 0, Errors.InvalidEpochRange(fromEpoch, toEpoch));
14341434

14351435
// If proving wasn't ever activated for this data set, don't pay anything
1436-
if (provingActivationEpoch[dataSetId] == 0) {
1436+
uint256 activationEpoch = provingActivationEpoch[dataSetId];
1437+
if (activationEpoch == 0) {
14371438
return ValidationResult({
14381439
modifiedAmount: 0,
14391440
settleUpto: fromEpoch,
@@ -1446,7 +1447,7 @@ contract FilecoinWarmStorageService is
14461447
uint256 lastProvenEpoch = fromEpoch;
14471448

14481449
(provenEpochCount, lastProvenEpoch) =
1449-
_findProvenEpochs(dataSetId, fromEpoch, toEpoch, provenEpochCount, lastProvenEpoch);
1450+
_findProvenEpochs(dataSetId, fromEpoch, toEpoch, provenEpochCount, lastProvenEpoch, activationEpoch);
14501451

14511452
// If no epochs are proven, we can't settle anything
14521453
if (provenEpochCount == 0) {
@@ -1475,9 +1476,9 @@ contract FilecoinWarmStorageService is
14751476
uint256 fromEpoch,
14761477
uint256 toEpoch,
14771478
uint256 provenEpochCount,
1478-
uint256 lastProvenEpoch
1479+
uint256 lastProvenEpoch,
1480+
uint256 activationEpoch
14791481
) internal view returns (uint256, uint256) {
1480-
uint256 activationEpoch = provingActivationEpoch[dataSetId];
14811482
if (toEpoch < activationEpoch) {
14821483
revert Errors.InvalidEpochRange(fromEpoch, toEpoch);
14831484
}

0 commit comments

Comments
 (0)