Skip to content

Commit 527f303

Browse files
authored
fix: 🚑 indexer handling of file deletion (#596)
* fix: 🐛 make it so the indexer handles file deletions more gracefully * fix: 🐛 add safeguards to file deletion flows in runtime and improve them * style: 🎨 run cargo fmt * chore: 🏷️ run typegen * chore: 🔖 bump api-augment and types-bundle versions * fix: 🐛 handle edge case for revokes and rejects * chore: 🔖 bump backend and sdk versions * docs: 💡 add comments explaining the edge cases we are avoiding * test: ✅ fix tests that banked on open storage requests being deletable * style: 🎨 revert whitespace changes
1 parent 5e53d4c commit 527f303

File tree

33 files changed

+1242
-90
lines changed

33 files changed

+1242
-90
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-augment/dist/parachain/interfaces/lookup.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-augment/dist/parachain/interfaces/lookup.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-augment/dist/solochain-evm/interfaces/lookup.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-augment/dist/solochain-evm/interfaces/lookup.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api-augment/dist/types/parachain/interfaces/augment-api-errors.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,15 @@ declare module '@polkadot/api-base/types/errors' {
282282
* Failed to convert to primitive type.
283283
**/
284284
FailedTypeConversion: AugmentedError<ApiType>;
285+
/**
286+
* File has an active storage request and as such is not eligible for deletion.
287+
* The user should use the `revoke_storage_request` extrinsic to revoke it first.
288+
**/
289+
FileHasActiveStorageRequest: AugmentedError<ApiType>;
290+
/**
291+
* File has an `IncompleteStorageRequest` associated with it and as such is not eligible for a new storage request
292+
**/
293+
FileHasIncompleteStorageRequest: AugmentedError<ApiType>;
285294
/**
286295
* File key already pending deletion.
287296
**/

api-augment/dist/types/parachain/interfaces/types-lookup.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4846,7 +4846,9 @@ declare module '@polkadot/types/lookup' {
48464846
readonly isInvalidSignedOperation: boolean;
48474847
readonly isFileKeyMismatch: boolean;
48484848
readonly isIncompleteStorageRequestNotFound: boolean;
4849-
readonly type: 'StorageRequestAlreadyRegistered' | 'StorageRequestNotFound' | 'StorageRequestNotRevoked' | 'StorageRequestExists' | 'ReplicationTargetCannotBeZero' | 'ReplicationTargetExceedsMaximum' | 'MaxReplicationTargetSmallerThanDefault' | 'NotABsp' | 'NotAMsp' | 'NotASp' | 'BspNotVolunteered' | 'BspNotConfirmed' | 'BspAlreadyConfirmed' | 'StorageRequestBspsRequiredFulfilled' | 'BspAlreadyVolunteered' | 'InsufficientAvailableCapacity' | 'UnexpectedNumberOfRemovedVolunteeredBsps' | 'BspNotEligibleToVolunteer' | 'StorageRequestExpiredNoSlotAvailable' | 'StorageRequestNotAuthorized' | 'MaxTickNumberReached' | 'FailedToEncodeBsp' | 'FailedToEncodeFingerprint' | 'FailedToDecodeThreshold' | 'AboveThreshold' | 'ThresholdArithmeticError' | 'FailedTypeConversion' | 'DividedByZero' | 'ImpossibleFailedToGetValue' | 'BucketIsNotPrivate' | 'BucketNotFound' | 'BucketNotEmpty' | 'NotBucketOwner' | 'ValuePropositionNotAvailable' | 'CollectionNotFound' | 'ProviderRootNotFound' | 'ExpectedNonInclusionProof' | 'ExpectedInclusionProof' | 'InvalidFileKeyMetadata' | 'ThresholdBelowAsymptote' | 'NotFileOwner' | 'FileKeyAlreadyPendingDeletion' | 'BatchFileDeletionMustContainSingleBucket' | 'DuplicateFileKeyInBatchFileDeletion' | 'NoFileKeysToDelete' | 'FailedToPushFileKeyToBucketDeletionVector' | 'FailedToPushUserToBspDeletionVector' | 'FailedToPushFileKeyToBspDeletionVector' | 'MaxUserPendingDeletionRequestsReached' | 'MspNotStoringBucket' | 'FileKeyNotPendingDeletion' | 'FileSizeCannotBeZero' | 'NoGlobalReputationWeightSet' | 'NoBspReputationWeightSet' | 'MaximumThresholdCannotBeZero' | 'TickRangeToMaximumThresholdCannotBeZero' | 'PendingStopStoringRequestNotFound' | 'MinWaitForStopStoringNotReached' | 'PendingStopStoringRequestAlreadyExists' | 'OperationNotAllowedWithInsolventUser' | 'UserNotInsolvent' | 'NotSelectedMsp' | 'MspAlreadyConfirmed' | 'RequestWithoutMsp' | 'MspAlreadyStoringBucket' | 'MoveBucketRequestNotFound' | 'BucketIsBeingMoved' | 'BspAlreadyDataServer' | 'BspDataServersExceeded' | 'FileMetadataProcessingQueueFull' | 'TooManyBatchResponses' | 'TooManyStorageRequestResponses' | 'InvalidBucketIdFileKeyPair' | 'InconsistentStateKeyAlreadyExists' | 'FixedRatePaymentStreamNotFound' | 'DynamicRatePaymentStreamNotFound' | 'CannotHoldDeposit' | 'FailedToQueryEarliestFileVolunteerTick' | 'FailedToGetOwnerAccount' | 'FailedToGetPaymentAccount' | 'NoFileKeysToConfirm' | 'RootNotUpdated' | 'NoPrivacyChange' | 'OperationNotAllowedForInsolventProvider' | 'OperationNotAllowedWhileBucketIsNotStoredByMsp' | 'FailedToComputeFileKey' | 'FailedToCreateFileMetadata' | 'InvalidSignature' | 'ForestProofVerificationFailed' | 'ProviderNotStoringFile' | 'InvalidProviderID' | 'InvalidSignedOperation' | 'FileKeyMismatch' | 'IncompleteStorageRequestNotFound';
4849+
readonly isFileHasActiveStorageRequest: boolean;
4850+
readonly isFileHasIncompleteStorageRequest: boolean;
4851+
readonly type: 'StorageRequestAlreadyRegistered' | 'StorageRequestNotFound' | 'StorageRequestNotRevoked' | 'StorageRequestExists' | 'ReplicationTargetCannotBeZero' | 'ReplicationTargetExceedsMaximum' | 'MaxReplicationTargetSmallerThanDefault' | 'NotABsp' | 'NotAMsp' | 'NotASp' | 'BspNotVolunteered' | 'BspNotConfirmed' | 'BspAlreadyConfirmed' | 'StorageRequestBspsRequiredFulfilled' | 'BspAlreadyVolunteered' | 'InsufficientAvailableCapacity' | 'UnexpectedNumberOfRemovedVolunteeredBsps' | 'BspNotEligibleToVolunteer' | 'StorageRequestExpiredNoSlotAvailable' | 'StorageRequestNotAuthorized' | 'MaxTickNumberReached' | 'FailedToEncodeBsp' | 'FailedToEncodeFingerprint' | 'FailedToDecodeThreshold' | 'AboveThreshold' | 'ThresholdArithmeticError' | 'FailedTypeConversion' | 'DividedByZero' | 'ImpossibleFailedToGetValue' | 'BucketIsNotPrivate' | 'BucketNotFound' | 'BucketNotEmpty' | 'NotBucketOwner' | 'ValuePropositionNotAvailable' | 'CollectionNotFound' | 'ProviderRootNotFound' | 'ExpectedNonInclusionProof' | 'ExpectedInclusionProof' | 'InvalidFileKeyMetadata' | 'ThresholdBelowAsymptote' | 'NotFileOwner' | 'FileKeyAlreadyPendingDeletion' | 'BatchFileDeletionMustContainSingleBucket' | 'DuplicateFileKeyInBatchFileDeletion' | 'NoFileKeysToDelete' | 'FailedToPushFileKeyToBucketDeletionVector' | 'FailedToPushUserToBspDeletionVector' | 'FailedToPushFileKeyToBspDeletionVector' | 'MaxUserPendingDeletionRequestsReached' | 'MspNotStoringBucket' | 'FileKeyNotPendingDeletion' | 'FileSizeCannotBeZero' | 'NoGlobalReputationWeightSet' | 'NoBspReputationWeightSet' | 'MaximumThresholdCannotBeZero' | 'TickRangeToMaximumThresholdCannotBeZero' | 'PendingStopStoringRequestNotFound' | 'MinWaitForStopStoringNotReached' | 'PendingStopStoringRequestAlreadyExists' | 'OperationNotAllowedWithInsolventUser' | 'UserNotInsolvent' | 'NotSelectedMsp' | 'MspAlreadyConfirmed' | 'RequestWithoutMsp' | 'MspAlreadyStoringBucket' | 'MoveBucketRequestNotFound' | 'BucketIsBeingMoved' | 'BspAlreadyDataServer' | 'BspDataServersExceeded' | 'FileMetadataProcessingQueueFull' | 'TooManyBatchResponses' | 'TooManyStorageRequestResponses' | 'InvalidBucketIdFileKeyPair' | 'InconsistentStateKeyAlreadyExists' | 'FixedRatePaymentStreamNotFound' | 'DynamicRatePaymentStreamNotFound' | 'CannotHoldDeposit' | 'FailedToQueryEarliestFileVolunteerTick' | 'FailedToGetOwnerAccount' | 'FailedToGetPaymentAccount' | 'NoFileKeysToConfirm' | 'RootNotUpdated' | 'NoPrivacyChange' | 'OperationNotAllowedForInsolventProvider' | 'OperationNotAllowedWhileBucketIsNotStoredByMsp' | 'FailedToComputeFileKey' | 'FailedToCreateFileMetadata' | 'InvalidSignature' | 'ForestProofVerificationFailed' | 'ProviderNotStoringFile' | 'InvalidProviderID' | 'InvalidSignedOperation' | 'FileKeyMismatch' | 'IncompleteStorageRequestNotFound' | 'FileHasActiveStorageRequest' | 'FileHasIncompleteStorageRequest';
48504852
}
48514853
/** @name PalletProofsDealerProofSubmissionRecord (498) */
48524854
interface PalletProofsDealerProofSubmissionRecord extends Struct {

api-augment/dist/types/solochain-evm/interfaces/augment-api-errors.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,15 @@ declare module '@polkadot/api-base/types/errors' {
302302
* Failed to convert to primitive type.
303303
**/
304304
FailedTypeConversion: AugmentedError<ApiType>;
305+
/**
306+
* File has an active storage request and as such is not eligible for deletion.
307+
* The user should use the `revoke_storage_request` extrinsic to revoke it first.
308+
**/
309+
FileHasActiveStorageRequest: AugmentedError<ApiType>;
310+
/**
311+
* File has an `IncompleteStorageRequest` associated with it and as such is not eligible for a new storage request
312+
**/
313+
FileHasIncompleteStorageRequest: AugmentedError<ApiType>;
305314
/**
306315
* File key already pending deletion.
307316
**/

0 commit comments

Comments
 (0)