Skip to content

Commit

Permalink
Expand documentation for deal activation and verified claim parameter…
Browse files Browse the repository at this point in the history
…s and results. (#1325)
  • Loading branch information
anorth authored Jul 2, 2023
1 parent 211698a commit b88cede
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
7 changes: 4 additions & 3 deletions actors/market/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,10 @@ impl Actor {
Ok(VerifyDealsForActivationReturn { sectors: sectors_data })
}

/// Activate a set of deals, returning the deal space and extra info for sectors containing
/// verified deals. Sectors are activated in parameter-defined order and can fail independently of
/// each other with the responsible ExitCode recorded in a BatchReturn.
/// Activate a set of deals grouped by sector, returning the size and
/// extra info about verified deals.
/// Sectors' deals are activated in parameter-defined order.
/// Each sector's deals are activated or fail as a group, but independently of other sectors.
fn batch_activate_deals(
rt: &impl Runtime,
params: BatchActivateDealsParams,
Expand Down
11 changes: 8 additions & 3 deletions actors/market/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ pub struct PublishStorageDealsReturn {
pub valid_deals: BitField,
}

// Changed since V2:
// - Array of Sectors rather than just one
// - Removed SectorStart
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone, Eq, PartialEq)]
pub struct VerifyDealsForActivationParams {
/// Deals to verify, grouped by sector.
pub sectors: Vec<SectorDeals>,
}

Expand All @@ -100,9 +98,11 @@ pub struct SectorDealData {
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone, Eq, PartialEq)]
#[serde(transparent)]
pub struct BatchActivateDealsParams {
/// Deals to activate, grouped by sector.
pub sectors: Vec<SectorDeals>,
}

// Information about a verified deal that has been activated.
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone, Eq, PartialEq)]
pub struct VerifiedDealInfo {
pub client: ActorID,
Expand All @@ -111,16 +111,21 @@ pub struct VerifiedDealInfo {
pub size: PaddedPieceSize,
}

// Information about a sector-grouping of deals that have been activated.
#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone, Eq, PartialEq)]
pub struct DealActivation {
/// The total size of the non-verified deals activated.
#[serde(with = "bigint_ser")]
pub nonverified_deal_space: BigInt,
/// Information about each verified deal activated.
pub verified_infos: Vec<VerifiedDealInfo>,
}

#[derive(Serialize_tuple, Deserialize_tuple, Debug, Clone, Eq, PartialEq)]
pub struct BatchActivateDealsResult {
/// Status of each sector grouping of deals.
pub activation_results: BatchReturn,
/// Activation information for the sector groups that were activated.
pub activations: Vec<DealActivation>,
}

Expand Down
7 changes: 3 additions & 4 deletions actors/verifreg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,9 @@ impl Actor {
/// Called by storage provider actor to claim allocations for data provably committed to storage.
/// For each allocation claim, the registry checks that the provided piece CID
/// and size match that of the allocation.
/// Returns a vec of claimed spaces parallel (with same length and corresponding indices) to
/// the requested allocations. When `all_or_nothing` is false, failed claims are represented by
/// DataCap::zero() entry in the result vec. When `all_or_nothing` is enabled, any failure to
/// claim results in the entire function returning an error.
/// Returns an indicator of success for each claim, and the size of each successful claim.
/// When `all_or_nothing` is enabled, any failure to claim results in the entire
/// method returning an error.
pub fn claim_allocations(
rt: &impl Runtime,
params: ClaimAllocationsParams,
Expand Down
3 changes: 3 additions & 0 deletions actors/verifreg/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ pub struct SectorAllocationClaim {
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsParams {
pub allocations: Vec<SectorAllocationClaim>,
// Whether to abort entirely if any claim fails.
pub all_or_nothing: bool,
}

Expand All @@ -145,7 +146,9 @@ pub struct SectorAllocationClaimResult {

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
// Success/failure indication for each claim.
pub claim_results: BatchReturn,
// The claimed space for each successful claim, in order.
pub claims: Vec<SectorAllocationClaimResult>,
}

Expand Down

0 comments on commit b88cede

Please sign in to comment.