Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: storage request flow and MSP batch accept #235

Merged
merged 17 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
556 changes: 278 additions & 278 deletions Cargo.lock

Large diffs are not rendered by default.

496 changes: 238 additions & 258 deletions api-augment/dist/interfaces/lookup.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api-augment/dist/interfaces/lookup.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions api-augment/dist/types/interfaces/augment-api-errors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,10 @@ declare module "@polkadot/api-base/types/errors" {
* Error thrown when a bucket ID already exists in storage.
**/
BucketAlreadyExists: AugmentedError<ApiType>;
/**
* Error thrown when a bucket has no value proposition.
**/
BucketHasNoValueProposition: AugmentedError<ApiType>;
/**
* Error thrown when an operation requires an MSP to be storing the bucket.
**/
Expand Down
85 changes: 59 additions & 26 deletions api-augment/dist/types/interfaces/augment-api-events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {
FrameSupportMessagesProcessMessageError,
FrameSupportTokensMiscBalanceStatus,
PalletFileSystemEitherAccountIdOrMspId,
PalletFileSystemMspRespondStorageRequestsResult,
PalletFileSystemRejectedStorageRequestReason,
PalletNftsAttributeNamespace,
PalletNftsPalletAttributes,
PalletNftsPriceWithDirection,
Expand Down Expand Up @@ -536,9 +536,6 @@ declare module "@polkadot/api-base/types/events" {
newRoot: H256;
}
>;
/**
* Notifies that a BSP has opened a request to stop storing a file.
**/
BspRequestedToStopStoring: AugmentedEvent<
ApiType,
[bspId: H256, fileKey: H256, owner: AccountId32, location: Bytes],
Expand Down Expand Up @@ -574,17 +571,6 @@ declare module "@polkadot/api-base/types/events" {
private: bool;
}
>;
/**
* Notifies that a data server has been registered for a move bucket request.
**/
DataServerRegisteredForMoveBucket: AugmentedEvent<
ApiType,
[bspId: H256, bucketId: H256],
{
bspId: H256;
bucketId: H256;
}
>;
/**
* Notifies that a priority challenge failed to be queued for pending file deletion.
**/
Expand All @@ -601,12 +587,18 @@ declare module "@polkadot/api-base/types/events" {
**/
FileDeletionRequest: AugmentedEvent<
ApiType,
[user: AccountId32, fileKey: H256, bucketId: H256, mspId: H256, proofOfInclusion: bool],
[
user: AccountId32,
fileKey: H256,
bucketId: H256,
mspId: Option<H256>,
proofOfInclusion: bool
],
{
user: AccountId32;
fileKey: H256;
bucketId: H256;
mspId: H256;
mspId: Option<H256>;
proofOfInclusion: bool;
}
>;
Expand Down Expand Up @@ -656,13 +648,21 @@ declare module "@polkadot/api-base/types/events" {
}
>;
/**
* Notifies that a MSP has responded to storage request(s).
* Notifies that a Main Storage Provider (MSP) has accepted a storage request for a specific file key.
*
* This event is emitted when an MSP agrees to store a file, but the storage request
* is not yet fully fulfilled (i.e., the required number of Backup Storage Providers
* have not yet confirmed storage).
*
* # Note
* This event is not emitted when the storage request is immediately fulfilled upon
* MSP acceptance. In such cases, a [`StorageRequestFulfilled`] event is emitted instead.
**/
MspRespondedToStorageRequests: AugmentedEvent<
MspAcceptedStorageRequest: AugmentedEvent<
ApiType,
[results: PalletFileSystemMspRespondStorageRequestsResult],
[fileKey: H256],
{
results: PalletFileSystemMspRespondStorageRequestsResult;
fileKey: H256;
}
>;
/**
Expand All @@ -684,21 +684,21 @@ declare module "@polkadot/api-base/types/events" {
ApiType,
[
who: AccountId32,
mspId: H256,
mspId: Option<H256>,
bucketId: H256,
name: Bytes,
collectionId: Option<u32>,
private: bool,
valuePropId: H256
valuePropId: Option<H256>
],
{
who: AccountId32;
mspId: H256;
mspId: Option<H256>;
bucketId: H256;
name: Bytes;
collectionId: Option<u32>;
private: bool;
valuePropId: H256;
valuePropId: Option<H256>;
}
>;
/**
Expand Down Expand Up @@ -777,7 +777,10 @@ declare module "@polkadot/api-base/types/events" {
}
>;
/**
* Notifies the expiration of a storage request.
* Notifies the expiration of a storage request. This means that the storage request has
* been accepted by the MSP but the BSP target has not been reached (possibly 0 BSPs).
* Note: This is a valid storage outcome, the user being responsible to track the number
* of BSPs and choose to either delete the file and re-issue a storage request or continue.
**/
StorageRequestExpired: AugmentedEvent<
ApiType,
Expand All @@ -788,6 +791,8 @@ declare module "@polkadot/api-base/types/events" {
>;
/**
* Notifies that a storage request for a file key has been fulfilled.
* This means that the storage request has been accepted by the MSP and the BSP target
* has been reached.
**/
StorageRequestFulfilled: AugmentedEvent<
ApiType,
Expand All @@ -796,8 +801,24 @@ declare module "@polkadot/api-base/types/events" {
fileKey: H256;
}
>;
/**
* Notifies that a storage request has either been directly rejected by the MSP or
* the MSP did not respond to the storage request in time.
* Note: There might be BSPs that have volunteered and confirmed the file already, for
* which a priority challenge to delete the file will be issued.
**/
StorageRequestRejected: AugmentedEvent<
ApiType,
[fileKey: H256, reason: PalletFileSystemRejectedStorageRequestReason],
{
fileKey: H256;
reason: PalletFileSystemRejectedStorageRequestReason;
}
>;
/**
* Notifies that a storage request has been revoked by the user who initiated it.
* Note: the BSPs who confirmed the file are also issued a priority challenge to delete the
* file.
**/
StorageRequestRevoked: AugmentedEvent<
ApiType,
Expand Down Expand Up @@ -2135,6 +2156,18 @@ declare module "@polkadot/api-base/types/events" {
capacity: u64;
}
>;
/**
* Event emitted when a bucket's root has been changed.
**/
BucketRootChanged: AugmentedEvent<
ApiType,
[bucketId: H256, oldRoot: H256, newRoot: H256],
{
bucketId: H256;
oldRoot: H256;
newRoot: H256;
}
>;
/**
* Event emitted when a SP has changed its capacity successfully. Provides information about
* that SP's account id, its old total data that could store, and the new total data.
Expand Down
40 changes: 19 additions & 21 deletions api-augment/dist/types/interfaces/augment-api-tx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
CumulusPrimitivesParachainInherentParachainInherentData,
PalletBalancesAdjustmentDirection,
PalletFileSystemBucketMoveRequestResponse,
PalletFileSystemMspStorageRequestResponse,
PalletFileSystemStorageRequestMspBucketResponse,
PalletNftsAttributeNamespace,
PalletNftsCancelAttributesApprovalWitness,
PalletNftsCollectionConfig,
Expand Down Expand Up @@ -590,12 +590,12 @@ declare module "@polkadot/api-base/types/submittable" {
>;
createBucket: AugmentedSubmittable<
(
mspId: H256 | string | Uint8Array,
mspId: Option<H256> | null | Uint8Array | H256 | string,
name: Bytes | string | Uint8Array,
private: bool | boolean | Uint8Array,
valuePropId: H256 | string | Uint8Array
valuePropId: Option<H256> | null | Uint8Array | H256 | string
) => SubmittableExtrinsic<ApiType>,
[H256, Bytes, bool, H256]
[Option<H256>, Bytes, bool, Option<H256>]
>;
/**
* Dispatchable extrinsic that allows a User to delete any of their buckets if it is currently empty.
Expand Down Expand Up @@ -638,10 +638,10 @@ declare module "@polkadot/api-base/types/submittable" {
location: Bytes | string | Uint8Array,
fingerprint: H256 | string | Uint8Array,
size: u64 | AnyNumber | Uint8Array,
mspId: H256 | string | Uint8Array,
mspId: Option<H256> | null | Uint8Array | H256 | string,
peerIds: Vec<Bytes> | (Bytes | string | Uint8Array)[]
) => SubmittableExtrinsic<ApiType>,
[H256, Bytes, H256, u64, H256, Vec<Bytes>]
[H256, Bytes, H256, u64, Option<H256>, Vec<Bytes>]
>;
mspRespondMoveBucketRequest: AugmentedSubmittable<
(
Expand All @@ -668,22 +668,20 @@ declare module "@polkadot/api-base/types/submittable" {
**/
mspRespondStorageRequestsMultipleBuckets: AugmentedSubmittable<
(
fileKeyResponsesInput:
| Vec<ITuple<[H256, PalletFileSystemMspStorageRequestResponse]>>
| [
H256 | string | Uint8Array,
(
| PalletFileSystemMspStorageRequestResponse
| {
accept?: any;
reject?: any;
}
| string
| Uint8Array
)
][]
storageRequestMspResponse:
| Vec<PalletFileSystemStorageRequestMspBucketResponse>
| (
| PalletFileSystemStorageRequestMspBucketResponse
| {
bucketId?: any;
accept?: any;
reject?: any;
}
| string
| Uint8Array
)[]
) => SubmittableExtrinsic<ApiType>,
[Vec<ITuple<[H256, PalletFileSystemMspStorageRequestResponse]>>]
[Vec<PalletFileSystemStorageRequestMspBucketResponse>]
>;
mspStopStoringBucket: AugmentedSubmittable<
(bucketId: H256 | string | Uint8Array) => SubmittableExtrinsic<ApiType>,
Expand Down
Loading
Loading