Skip to content

Commit

Permalink
typegen
Browse files Browse the repository at this point in the history
  • Loading branch information
undercover-cactus committed Jan 7, 2025
1 parent e22a94a commit 207d9ba
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 7 deletions.
3 changes: 3 additions & 0 deletions api-augment/dist/interfaces/lookup.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions api-augment/dist/types/interfaces/augment-api-events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,16 @@ declare module "@polkadot/api-base/types/events" {
fileKey: H256;
}
>;
/**
* Event to notify of incoherencies in used capacity.
**/
UsedCapacityShouldBeZero: AugmentedEvent<
ApiType,
[actualUsedCapacity: u64],
{
actualUsedCapacity: u64;
}
>;
/**
* Generic event
**/
Expand Down
3 changes: 3 additions & 0 deletions api-augment/dist/types/interfaces/lookup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,9 @@ declare const _default: {
fileSize: string;
error: string;
};
UsedCapacityShouldBeZero: {
actualUsedCapacity: string;
};
};
};
/**
Expand Down
7 changes: 6 additions & 1 deletion api-augment/dist/types/interfaces/types-lookup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,10 @@ declare module "@polkadot/types/lookup" {
readonly fileSize: u64;
readonly error: SpRuntimeDispatchError;
} & Struct;
readonly isUsedCapacityShouldBeZero: boolean;
readonly asUsedCapacityShouldBeZero: {
readonly actualUsedCapacity: u64;
} & Struct;
readonly type:
| "NewBucket"
| "BucketDeleted"
Expand All @@ -2064,7 +2068,8 @@ declare module "@polkadot/types/lookup" {
| "MoveBucketAccepted"
| "MoveBucketRejected"
| "MspStoppedStoringBucket"
| "FailedToDecreaseBucketSize";
| "FailedToDecreaseBucketSize"
| "UsedCapacityShouldBeZero";
}
/** @name PalletFileSystemRejectedStorageRequestReason (139) */
interface PalletFileSystemRejectedStorageRequestReason extends Enum {
Expand Down
8 changes: 8 additions & 0 deletions api-augment/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,14 @@ declare module "@polkadot/api-base/types/events" {
* file.
**/
StorageRequestRevoked: AugmentedEvent<ApiType, [fileKey: H256], { fileKey: H256 }>;
/**
* Event to notify of incoherencies in used capacity.
**/
UsedCapacityShouldBeZero: AugmentedEvent<
ApiType,
[actualUsedCapacity: u64],
{ actualUsedCapacity: u64 }
>;
/**
* Generic event
**/
Expand Down
3 changes: 3 additions & 0 deletions api-augment/src/interfaces/lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,9 @@ export default {
fileKey: "H256",
fileSize: "u64",
error: "SpRuntimeDispatchError"
},
UsedCapacityShouldBeZero: {
actualUsedCapacity: "u64"
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion api-augment/src/interfaces/types-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,10 @@ declare module "@polkadot/types/lookup" {
readonly fileSize: u64;
readonly error: SpRuntimeDispatchError;
} & Struct;
readonly isUsedCapacityShouldBeZero: boolean;
readonly asUsedCapacityShouldBeZero: {
readonly actualUsedCapacity: u64;
} & Struct;
readonly type:
| "NewBucket"
| "BucketDeleted"
Expand All @@ -2152,7 +2156,8 @@ declare module "@polkadot/types/lookup" {
| "MoveBucketAccepted"
| "MoveBucketRejected"
| "MspStoppedStoringBucket"
| "FailedToDecreaseBucketSize";
| "FailedToDecreaseBucketSize"
| "UsedCapacityShouldBeZero";
}

/** @name PalletFileSystemRejectedStorageRequestReason (139) */
Expand Down
2 changes: 1 addition & 1 deletion api-augment/storagehub.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pallets/file-system/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ where
if new_root == <T::Providers as shp_traits::ReadProvidersInterface>::get_default_root() {
let used_capacity =
<T::Providers as ReadStorageProvidersInterface>::get_used_capacity(&bsp_id);
if used_capacity == Zero::zero() {
if used_capacity != Zero::zero() {
// Emit event if we have inconsistency. We can later monitor for those.
Self::deposit_event(Event::UsedCapacityShouldBeZero {
actual_used_capacity: used_capacity,
Expand Down Expand Up @@ -1962,10 +1962,9 @@ where
&& new_root == <T::Providers as shp_traits::ReadProvidersInterface>::get_default_root()
{
// If it doesn't store any files we stop the challenge cycle and stop its randomness cycle.

let used_capacity =
<T::Providers as ReadStorageProvidersInterface>::get_used_capacity(&sp_id);
if used_capacity == Zero::zero() {
if used_capacity != Zero::zero() {
// Emit event if we have inconsistency. We can later monitor for those.
Self::deposit_event(Event::UsedCapacityShouldBeZero {
actual_used_capacity: used_capacity,
Expand Down

0 comments on commit 207d9ba

Please sign in to comment.