Skip to content

Commit

Permalink
docs: Update error docs for market pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan46 committed Nov 25, 2024
1 parent 4d198c0 commit fca5379
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
18 changes: 17 additions & 1 deletion docs/src/architecture/pallets/market.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ The Market Pallet actions can fail with following errors:
- `InsufficientFreeFunds` - Market participants do not have enough free funds.
- `NoProposalsToBePublished` - `publish_storage_deals` was called with an empty list of `deals`.
- `ProposalsPublishedByIncorrectStorageProvider` - Is returned when calling `publish_storage_deals` and the deals in a list are not published by the same storage provider.
- `AllProposalsInvalid` - `publish_storage_deals` call was supplied with a list of `deals` which are all invalid.
- `DuplicateDeal` - There is more than one deal with this ID in the Sector.
- `DealNotFound` - Tried to activate a deal that is not in the system.
- `DealActivationError` - Tried to activate a deal, but data was malformed.
Expand All @@ -222,6 +221,23 @@ The Market Pallet actions can fail with following errors:
- Deal is not pending.
- `DealsTooLargeToFitIntoSector` - Sum of all deals piece sizes for a sector exceeds sector size. The sector size is based on the registered proof type. We currently only support registered `StackedDRG2KiBV1P1` proofs, which have 2KiB sector sizes.
- `TooManyDealsPerBlock` - Tried to activate too many deals at a given `start_block`.
- `StorageProviderNotRegistered` - An account tries to call `publish_storage_deals` but is not registered as a storage provider.
- `CommD` - An error occurred when trying to calculate CommD.
- `TooManyPendingDeals` - A storage provider tried to propose a deal, but there are too many pending deals. The pending deals should be activated or wait for expiry.
- `InvalidProvider` - A deal was tried to be activated by a provider which does not own it.
- `StartBlockElapsed` - A storage provider tries to activate a deal after the start block.
- `SectorExpiresBeforeDeal` - Sector containing the deal will expire before the deal is supposed to end.
- `InvalidDealState` - A deal was attempted to be activated twice.
- `DealNotPending` - A storage provider tried to activate a deal which is not in the pending proposals.
- `WrongClientSignatureOnProposal` - The client signature did not match the client's public key and data.
- `DealEndBeforeStart` - A deal was attempted to be published but the end block is before the start block and the deal is rejected.
- `DealStartExpired` - A deal was attempted to be published but the start block is in the past and the deal is rejected.
- `DealNotPublished` - A deal was attempted to be published but is not in the correct state.
- `DealDurationOutOfBounds` - A deal was attempted to be published but the duration is not between [MinDealDuration](#constants) and [MaxDealDuration](#constants).
- `InvalidPieceCid` - The deal trying to be published has an invalid piece Cid.
- `DealIsNotActive` - When a sector is being terminated but the deal state is not active. This is the result of a programmer bug. Please [report an issue](https://github.com/eigerco/polka-storage-book/issues/new) to the developers.
- `InvalidCaller` - A deal was found that does not belong to the storage provider. This is the result of a programmer bug. Please [report an issue](https://github.com/eigerco/polka-storage-book/issues/new) to the developers.
- `DealNotFound` - A deal was attempted to be fetched but could not be found. This is the result of a programmer bug. Please [report an issue](https://github.com/eigerco/polka-storage-book/issues/new) to the developers.
- `UnexpectedValidationError` - `publish_storage_deals`'s core logic was invoked with a broken invariant that should be called by `validate_deals`. Please [report an issue](https://github.com/eigerco/polka-storage-book/issues/new) to the developers.
- `DealPreconditionFailed` - Due to a programmer bug. Please [report an issue](https://github.com/eigerco/polka-storage-book/issues/new) to the developers.

Expand Down
10 changes: 2 additions & 8 deletions pallets/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,6 @@ pub mod pallet {
/// `publish_storage_deals` must be called by Storage Providers and it's a Provider of all of the deals.
/// This error is emitted when a storage provider tries to publish deals that to not belong to them.
ProposalsPublishedByIncorrectStorageProvider,
/// `publish_storage_deals` call was supplied with `deals` which are all invalid.
AllProposalsInvalid,
/// `publish_storage_deals`'s core logic was invoked with a broken invariant that should be called by `validate_deals`.
UnexpectedValidationError,
/// There is more than 1 deal of this ID in the Sector.
Expand All @@ -485,7 +483,6 @@ pub mod pallet {
/// Tried to propose a deal, but there are too many pending deals.
/// The pending deals should be activated or wait for expiry.
TooManyPendingDeals,
/// Deal activation errors
/// Deal was tried to be activated by a provider which does not own it
InvalidProvider,
/// Deal should have been activated earlier, it's too late
Expand All @@ -496,17 +493,14 @@ pub mod pallet {
InvalidDealState,
/// Tried to activate a deal which is not in the Pending Proposals
DealNotPending,
/// Sector Terminate Error
/// Deal was not found in the [`Proposals`] table.
DealNotFound,
/// Caller is not the provider.
InvalidCaller,
/// Deal is not active
DealIsNotActive,
/// ProposalError
/// ClientDealProposal.client_signature did not match client's public key and data.
WrongClientSignatureOnProposal,
/// Provider of one of the deals is different than the Provider of the first deal.
DifferentProviderInProposal,
/// Deal's block_start > block_end, so it doesn't make sense.
DealEndBeforeStart,
/// Deal's start block is in the past, it should be in the future.
Expand Down Expand Up @@ -998,7 +992,7 @@ pub mod pallet {

ensure!(
deal.proposal.provider == *provider,
Error::<T>::DifferentProviderInProposal
Error::<T>::ProposalsPublishedByIncorrectStorageProvider
);

ensure!(
Expand Down
2 changes: 1 addition & 1 deletion pallets/market/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ fn publish_storage_deals_fails_different_providers() {
.signed(BOB),
]
),
Error::<Test>::DifferentProviderInProposal
Error::<Test>::ProposalsPublishedByIncorrectStorageProvider
);
assert_eq!(events(), []);
});
Expand Down

0 comments on commit fca5379

Please sign in to comment.