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

Implements SectorContentChanged method in built-in market actor #1353

Merged
merged 4 commits into from
Aug 15, 2023
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
65 changes: 65 additions & 0 deletions actors/market/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub mod account {

pub mod miner {
use super::*;
use cid::Cid;
use fvm_ipld_encoding::RawBytes;
use fvm_shared::clock::ChainEpoch;
use fvm_shared::error::ExitCode;
use fvm_shared::piece::PaddedPieceSize;
use fvm_shared::sector::SectorNumber;

pub const CONTROL_ADDRESSES_METHOD: u64 = 2;
pub const IS_CONTROLLING_ADDRESS_EXPORTED: u64 =
Expand All @@ -47,6 +53,65 @@ pub mod miner {
pub struct IsControllingAddressParam {
pub address: Address,
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types will move to the miner actor when we implement sending of the notification, hence initial definition in ext here.

// Notification of change committed to one or more sectors.
// The relevant state must be already committed so the receiver can observe any impacts
// at the sending miner actor.
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorContentChangedParams {
// Distinct sectors with changed content.
pub sectors: Vec<SectorChanges>,
}

// Description of changes to one sector's content.
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorChanges {
// Identifier of sector being updated.
pub sector: SectorNumber,
// Minimum epoch until which the data is committed to the sector.
// Note the sector may later be extended without necessarily another notification.
pub minimum_commitment_epoch: ChainEpoch,
// Information about some pieces added to (or retained in) the sector.
// This may be only a subset of sector content.
// Inclusion here does not mean the piece was definitely absent previously.
// Exclusion here does not mean a piece has been removed since a prior notification.
pub added: Vec<PieceInfo>,
}

// Description of a piece of data committed to a sector.
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct PieceInfo {
pub data: Cid,
pub size: PaddedPieceSize,
// A receiver-specific identifier.
// E.g. an encoded deal ID which the provider claims this piece satisfies.
pub payload: RawBytes,
}

// For each piece in each sector, the notifee returns an exit code and
// (possibly-empty) result data.
// The miner actor will pass through results to its caller.
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorContentChangedReturn {
// A result for each sector that was notified, in the same order.
pub sectors: Vec<SectorReturn>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorReturn {
// A result for each piece for the sector that was notified, in the same order.
pub added: Vec<PieceReturn>,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct PieceReturn {
// Indicates whether the receiver accepted the notification.
// The caller is free to ignore this, but may chose to abort and roll back.
pub code: ExitCode,
// Receiver-specific result data about the piece, to be passed back to top level caller.
pub data: Vec<u8>,
}
}

pub mod verifreg {
Expand Down
453 changes: 300 additions & 153 deletions actors/market/src/lib.rs

Large diffs are not rendered by default.

Loading