-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Publish storage deals (#599)
- Loading branch information
Showing
15 changed files
with
355 additions
and
411 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use codec::{Decode, Encode}; | ||
use primitives_commitment::{piece::PaddedPieceSizeError, CommitmentError}; | ||
use scale_info::TypeInfo; | ||
|
||
// Clone and PartialEq required because of the BoundedVec<(DealId, DealSettlementError)> | ||
#[derive(TypeInfo, Encode, Decode, Clone, PartialEq, thiserror::Error)] | ||
pub enum DealSettlementError { | ||
/// The deal is going to be slashed. | ||
#[error("DealSettlementError: Slashed Deal")] | ||
SlashedDeal, | ||
/// The deal last update is in the future — i.e. `last_update_block > current_block`. | ||
#[error("DealSettlementError: Future Last Update")] | ||
FutureLastUpdate, | ||
/// The deal was not found. | ||
#[error("DealSettlementError: Deal Not Found")] | ||
DealNotFound, | ||
/// The deal is too early to settle. | ||
#[error("DealSettlementError: Early Settlement")] | ||
EarlySettlement, | ||
/// The deal has expired | ||
#[error("DealSettlementError: Expired Deal")] | ||
ExpiredDeal, | ||
/// Deal is not activated | ||
#[error("DealSettlementError: Deal Not Active")] | ||
DealNotActive, | ||
} | ||
|
||
impl core::fmt::Debug for DealSettlementError { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
core::fmt::Display::fmt(self, f) | ||
} | ||
} | ||
|
||
// TODO: Implement TypeInfo for inner error so we can store them here. | ||
// For now logging will the error will do | ||
#[derive(TypeInfo, Encode, Decode, Clone, PartialEq, thiserror::Error)] | ||
pub enum CommDError { | ||
#[error("CommDError for commitment {0}")] | ||
CommitmentError(CommitmentError), | ||
#[error("CommDError for piece size {0}")] | ||
PaddedPieceSizeError(PaddedPieceSizeError), | ||
} | ||
|
||
impl core::fmt::Debug for CommDError { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
core::fmt::Display::fmt(self, f) | ||
} | ||
} |
Oops, something went wrong.