use cid::Cid;
use fil_actors_shared::v8::DealWeight;
use fvm_ipld_bitfield::UnvalidatedBitField;
use fvm_ipld_encoding::tuple::*;
use fvm_ipld_encoding::{serde_bytes, BytesDe};
use fvm_shared::address::Address;
use fvm_shared::bigint::bigint_ser;
use fvm_shared::clock::ChainEpoch;
use fvm_shared::deal::DealID;
use fvm_shared::econ::TokenAmount;
use fvm_shared::randomness::Randomness;
use fvm_shared::sector::{
PoStProof, RegisteredPoStProof, RegisteredSealProof, RegisteredUpdateProof, SectorNumber,
StoragePower,
};
use fvm_shared::smooth::FilterEstimate;
pub type CronEvent = i64;
pub const CRON_EVENT_WORKER_KEY_CHANGE: CronEvent = 0;
pub const CRON_EVENT_PROVING_DEADLINE: CronEvent = 1;
pub const CRON_EVENT_PROCESS_EARLY_TERMINATIONS: CronEvent = 2;
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct MinerConstructorParams {
pub owner: Address,
pub worker: Address,
pub control_addresses: Vec<Address>,
pub window_post_proof_type: RegisteredPoStProof,
#[serde(with = "serde_bytes")]
pub peer_id: Vec<u8>,
pub multi_addresses: Vec<BytesDe>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CronEventPayload {
pub event_type: i64,
}
#[derive(Debug)]
pub struct PartitionKey {
pub deadline: u64,
pub partition: u64,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct GetControlAddressesReturn {
pub owner: Address,
pub worker: Address,
pub control_addresses: Vec<Address>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ChangeWorkerAddressParams {
pub new_worker: Address,
pub new_control_addresses: Vec<Address>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ChangePeerIDParams {
#[serde(with = "serde_bytes")]
pub new_id: Vec<u8>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ChangeMultiaddrsParams {
pub new_multi_addrs: Vec<BytesDe>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ConfirmSectorProofsParams {
pub sectors: Vec<SectorNumber>,
pub reward_smoothed: FilterEstimate,
#[serde(with = "bigint_ser")]
pub reward_baseline_power: StoragePower,
pub quality_adj_power_smoothed: FilterEstimate,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct DeferredCronEventParams {
#[serde(with = "serde_bytes")]
pub event_payload: Vec<u8>,
pub reward_smoothed: FilterEstimate,
pub quality_adj_power_smoothed: FilterEstimate,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct PoStPartition {
pub index: u64,
pub skipped: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct SubmitWindowedPoStParams {
pub deadline: u64,
pub partitions: Vec<PoStPartition>,
pub proofs: Vec<PoStProof>,
pub chain_commit_epoch: ChainEpoch,
pub chain_commit_rand: Randomness,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ProveCommitSectorParams {
pub sector_number: SectorNumber,
#[serde(with = "serde_bytes")]
pub proof: Vec<u8>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CheckSectorProvenParams {
pub sector_number: SectorNumber,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ExtendSectorExpirationParams {
pub extensions: Vec<ExpirationExtension>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ExpirationExtension {
pub deadline: u64,
pub partition: u64,
pub sectors: UnvalidatedBitField,
pub new_expiration: ChainEpoch,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct TerminateSectorsParams {
pub terminations: Vec<TerminationDeclaration>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct TerminationDeclaration {
pub deadline: u64,
pub partition: u64,
pub sectors: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct TerminateSectorsReturn {
pub done: bool,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct DeclareFaultsParams {
pub faults: Vec<FaultDeclaration>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct FaultDeclaration {
pub deadline: u64,
pub partition: u64,
pub sectors: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct DeclareFaultsRecoveredParams {
pub recoveries: Vec<RecoveryDeclaration>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct RecoveryDeclaration {
pub deadline: u64,
pub partition: u64,
pub sectors: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CompactPartitionsParams {
pub deadline: u64,
pub partitions: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct CompactSectorNumbersParams {
pub mask_sector_numbers: UnvalidatedBitField,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct ReportConsensusFaultParams {
#[serde(with = "serde_bytes")]
pub header1: Vec<u8>,
#[serde(with = "serde_bytes")]
pub header2: Vec<u8>,
#[serde(with = "serde_bytes")]
pub header_extra: Vec<u8>,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct WithdrawBalanceParams {
pub amount_requested: TokenAmount,
}
#[derive(Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct WithdrawBalanceReturn {
pub amount_withdrawn: TokenAmount,
}
#[derive(Debug, PartialEq, Serialize_tuple, Deserialize_tuple)]
pub struct WorkerKeyChange {
pub new_worker: Address,
pub effective_at: ChainEpoch,
}
pub type PreCommitSectorParams = SectorPreCommitInfo;
#[derive(Debug, PartialEq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct PreCommitSectorBatchParams {
pub sectors: Vec<SectorPreCommitInfo>,
}
#[derive(Debug, Default, PartialEq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct SectorPreCommitInfo {
pub seal_proof: RegisteredSealProof,
pub sector_number: SectorNumber,
pub sealed_cid: Cid,
pub seal_rand_epoch: ChainEpoch,
pub deal_ids: Vec<DealID>,
pub expiration: ChainEpoch,
pub replace_capacity: bool,
pub replace_sector_deadline: u64,
pub replace_sector_partition: u64,
pub replace_sector_number: SectorNumber,
}
#[derive(Debug, PartialEq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct SectorPreCommitOnChainInfo {
pub info: SectorPreCommitInfo,
pub pre_commit_deposit: TokenAmount,
pub pre_commit_epoch: ChainEpoch,
#[serde(with = "bigint_ser")]
pub deal_weight: DealWeight,
#[serde(with = "bigint_ser")]
pub verified_deal_weight: DealWeight,
}
#[derive(Debug, Default, PartialEq, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct SectorOnChainInfo {
pub sector_number: SectorNumber,
pub seal_proof: RegisteredSealProof,
pub sealed_cid: Cid,
pub deal_ids: Vec<DealID>,
pub activation: ChainEpoch,
pub expiration: ChainEpoch,
#[serde(with = "bigint_ser")]
pub deal_weight: DealWeight,
#[serde(with = "bigint_ser")]
pub verified_deal_weight: DealWeight,
pub initial_pledge: TokenAmount,
pub expected_day_reward: TokenAmount,
pub expected_storage_pledge: TokenAmount,
pub replaced_sector_age: ChainEpoch,
pub replaced_day_reward: TokenAmount,
pub sector_key_cid: Option<Cid>,
}
#[derive(Debug, PartialEq, Copy, Clone, Serialize_tuple, Deserialize_tuple)]
pub struct Fault {
pub miner: Address,
pub fault: ChainEpoch,
}
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ApplyRewardParams {
pub reward: TokenAmount,
pub penalty: TokenAmount,
}
#[derive(Debug, PartialEq, Clone, Copy, Serialize_tuple, Deserialize_tuple)]
pub struct DisputeWindowedPoStParams {
pub deadline: u64,
pub post_index: u64, }
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ProveCommitAggregateParams {
pub sector_numbers: UnvalidatedBitField,
#[serde(with = "serde_bytes")]
pub aggregate_proof: Vec<u8>,
}
#[derive(Debug, PartialEq, Serialize_tuple, Deserialize_tuple)]
pub struct ReplicaUpdate {
pub sector_number: SectorNumber,
pub deadline: u64,
pub partition: u64,
pub new_sealed_cid: Cid,
pub deals: Vec<DealID>,
pub update_proof_type: RegisteredUpdateProof,
#[serde(with = "serde_bytes")]
pub replica_proof: Vec<u8>,
}
#[derive(Debug, Serialize_tuple, Deserialize_tuple)]
pub struct ProveReplicaUpdatesParams {
pub updates: Vec<ReplicaUpdate>,
}