@@ -171,16 +171,9 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
171171 );
172172
173173 /**
174- * @notice Thrown if beneficiary claim extension expiration is insufficient
174+ * @notice Thrown if no allocation is found
175175 */
176- error InsufficientBeneficiaryClaimExtensionExpiration (
177- CommonTypes.FilActorId provider , int64 claimExpiration , int64 requiredExpiration
178- );
179-
180- /**
181- * @notice Thrown if no allocation or claim is found
182- */
183- error NoAllocationOrClaim ();
176+ error NoAllocationFound ();
184177
185178 struct ProviderAllocation {
186179 CommonTypes.FilActorId provider;
@@ -191,7 +184,6 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
191184 struct ProviderClaim {
192185 CommonTypes.FilActorId provider;
193186 CommonTypes.FilActorId claim;
194- int64 termMax;
195187 }
196188
197189 struct ClientDataUsage {
@@ -284,11 +276,10 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
284276 (
285277 ProviderAllocation[] memory allocations ,
286278 ProviderClaim[] memory claimExtensions ,
287- ProviderAllocation memory longestAllocation ,
288- ProviderClaim memory longestClaimExtension
279+ ProviderAllocation memory longestAllocation
289280 ) = _deserializeVerifregOperatorData (params.operator_data);
290281
291- _verifyBeneficiaryExpiration (longestAllocation, longestClaimExtension );
282+ _verifyBeneficiaryExpiration (longestAllocation);
292283 _verifyAndRegisterAllocations (allocations);
293284 _verifyAndRegisterClaimExtensions (claimExtensions);
294285 emit DatacapSpent (msg .sender , datacapAmount);
@@ -394,34 +385,13 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
394385 /**
395386 * @notice Verifies that the beneficiary expiration is sufficient for the longest allocation.
396387 * @param longestAllocation The longest allocation.
397- * @param longestClaimExtension The longest claim extension.
398388 * @dev Reverts with InsufficientBeneficiaryExpiration if the beneficiary expiration is insufficient.
399389 */
400- function _verifyBeneficiaryExpiration (
401- ProviderAllocation memory longestAllocation ,
402- ProviderClaim memory longestClaimExtension
403- ) internal {
404- MinerTypes.GetBeneficiaryReturn memory beneficiary;
405- int64 beneficiaryExpiration;
406-
407- if (longestClaimExtension.termMax != 0 ) {
408- beneficiary = MinerUtils.getBeneficiaryWithChecks (
409- longestClaimExtension.provider, beneficiaryFactory, true , true , true
410- );
411- int64 beneficiaryExpiration = CommonTypes.ChainEpoch.unwrap (beneficiary.active.term.expiration);
412-
413- if (longestClaimExtension.termMax > beneficiaryExpiration + 250 weeks) {
414- revert InsufficientBeneficiaryClaimExtensionExpiration (
415- longestClaimExtension.provider, beneficiaryExpiration, longestClaimExtension.termMax
416- );
417- }
418- return ;
419- }
420-
390+ function _verifyBeneficiaryExpiration (ProviderAllocation memory longestAllocation ) internal view {
421391 if (longestAllocation.allocationTime != 0 ) {
422- beneficiary =
392+ MinerTypes.GetBeneficiaryReturn memory beneficiary =
423393 MinerUtils.getBeneficiaryWithChecks (longestAllocation.provider, beneficiaryFactory, true , true , true );
424- beneficiaryExpiration = CommonTypes.ChainEpoch.unwrap (beneficiary.active.term.expiration);
394+ int64 beneficiaryExpiration = CommonTypes.ChainEpoch.unwrap (beneficiary.active.term.expiration);
425395
426396 if (longestAllocation.allocationTime > beneficiaryExpiration + 180 days) {
427397 revert InsufficientBeneficiaryAllocationExpiration (
@@ -432,7 +402,7 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
432402 return ;
433403 }
434404
435- revert NoAllocationOrClaim ();
405+ revert NoAllocationFound ();
436406 }
437407
438408 // solhint-disable function-max-lines
@@ -442,22 +412,18 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
442412 * @return allocations Array of provider allocations.
443413 * @return claimExtensions Array of provider claims.
444414 * @return longestAllocation Allocation with the longest term.
445- * @return longestClaimExtension Claim extension with the longest term.
446415 */
447416 function _deserializeVerifregOperatorData (bytes memory cborData )
448417 internal
449418 pure
450419 returns (
451420 ProviderAllocation[] memory allocations ,
452421 ProviderClaim[] memory claimExtensions ,
453- ProviderAllocation memory longestAllocation ,
454- ProviderClaim memory longestClaimExtension
422+ ProviderAllocation memory longestAllocation
455423 )
456424 {
457425 uint256 resultLength;
458426 uint64 provider;
459- int64 termMax;
460- int64 expiration;
461427 uint256 byteIdx = 0 ;
462428
463429 {
@@ -466,6 +432,8 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
466432 }
467433 {
468434 uint64 size;
435+ int64 termMax;
436+ int64 expiration;
469437 (resultLength, byteIdx) = CBORDecoder.readFixedArray (cborData, byteIdx);
470438 allocations = new ProviderAllocation [](resultLength);
471439 for (uint256 i = 0 ; i < resultLength; i++ ) {
@@ -494,7 +462,6 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
494462 }
495463 }
496464 }
497-
498465 {
499466 uint64 claimId;
500467 (resultLength, byteIdx) = CBORDecoder.readFixedArray (cborData, byteIdx);
@@ -509,15 +476,12 @@ contract Client is Initializable, AccessControlUpgradeable, UUPSUpgradeable {
509476
510477 (provider, byteIdx) = CBORDecoder.readUInt64 (cborData, byteIdx);
511478 (claimId, byteIdx) = CBORDecoder.readUInt64 (cborData, byteIdx);
512- (termMax, byteIdx) = CBORDecoder.readInt64 (cborData, byteIdx);
479+ // slither-disable-start unused-return
480+ (, byteIdx) = CBORDecoder.readInt64 (cborData, byteIdx);
481+ // slither-disable-end unused-return
513482
514483 claimExtensions[i].provider = CommonTypes.FilActorId.wrap (provider);
515484 claimExtensions[i].claim = CommonTypes.FilActorId.wrap (claimId);
516- claimExtensions[i].termMax = termMax;
517-
518- if (termMax > longestClaimExtension.termMax) {
519- longestClaimExtension = claimExtensions[i];
520- }
521485 }
522486 }
523487 }
0 commit comments