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

fix(rpc): Filecoin.StateSectorGetInfo #4117

Closed
wants to merge 1 commit into from
Closed
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
1 change: 0 additions & 1 deletion scripts/tests/api_compare/filter-list
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
!Filecoin.StateSearchMsgLimited
!Filecoin.StateVMCirculatingSupplyInternal
!Filecoin.StateWaitMsg
!Filecoin.StateSectorGetInfo
23 changes: 15 additions & 8 deletions src/rpc_api/data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ use fil_actor_interface::{
miner::MinerPower,
power::Claim,
};
use fil_actor_miner_state::v12::{BeneficiaryTerm, PendingBeneficiaryChange};
use fil_actor_miner_state::v12::{
BeneficiaryTerm, PendingBeneficiaryChange, SectorOnChainInfoFlags,
};
use fil_actors_shared::fvm_ipld_bitfield::BitField;
use fvm_ipld_encoding::{BytesDe, RawBytes};
use libipld_core::ipld::Ipld;
Expand Down Expand Up @@ -754,6 +756,9 @@ pub struct SectorOnChainInfo {
/// Epoch during which the sector expires
pub expiration: ChainEpoch,

/// Additional flags, see [`SectorOnChainInfoFlags`]
pub flags: u32,

#[serde(with = "crate::lotus_json")]
/// Integral of active deals over sector lifetime
pub deal_weight: BigInt,
Expand All @@ -771,22 +776,20 @@ pub struct SectorOnChainInfo {
/// time
pub expected_day_reward: TokenAmount,

/// Epoch at which this sector's power was most recently updated
pub power_base_epoch: ChainEpoch,

#[serde(with = "crate::lotus_json")]
/// Expected twenty day projection of reward for sector computed at
/// activation time
pub expected_storage_pledge: TokenAmount,

pub replaced_sector_age: ChainEpoch,

#[serde(with = "crate::lotus_json")]
pub replaced_day_reward: TokenAmount,

#[serde(with = "crate::lotus_json")]
#[serde(rename = "SectorKeyCID")]
pub sector_key_cid: Option<Cid>,

#[serde(rename = "SimpleQAPower")]
pub simple_qa_power: bool,
}

impl From<fil_actor_interface::miner::SectorOnChainInfo> for SectorOnChainInfo {
Expand All @@ -798,20 +801,24 @@ impl From<fil_actor_interface::miner::SectorOnChainInfo> for SectorOnChainInfo {
deal_ids: other.deal_ids,
activation: other.activation,
expiration: other.expiration,
flags: if other.simple_qa_power {
SectorOnChainInfoFlags::SIMPLE_QA_POWER.bits()
} else {
Default::default()
},
deal_weight: other.deal_weight,
verified_deal_weight: other.verified_deal_weight,
initial_pledge: other.initial_pledge.into(),
expected_day_reward: other.expected_day_reward.into(),
expected_storage_pledge: other.expected_storage_pledge.into(),
replaced_sector_age: other.replaced_sector_age,
power_base_epoch: other.activation,
// `replaced_day_reward` has to be zero and Lemmih cannot figure out
// why. Lotus casts all `SectorOnChainInfo` structs to the miner-v9
// version which clears some fields (like `simple_qa_power`) but it
// shouldn't clear `replaced_day_reward`. Oh well, maybe one day
// Lemmih will figure it out.
replaced_day_reward: TokenAmount::default(),
sector_key_cid: other.sector_key_cid,
simple_qa_power: other.simple_qa_power,
}
}
}
Expand Down
Loading