Skip to content

Commit 945fe89

Browse files
authored
fix: missing fields in miner methods for NV25 (#5475)
1 parent bd94731 commit 945fe89

File tree

5 files changed

+59
-46
lines changed

5 files changed

+59
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
### Fixed
4747

4848
- [#5458](https://github.com/ChainSafe/forest/pull/5458) Fix stack overflow occurring when running Forest in debug mode.
49+
- [#5475](https://github.com/ChainSafe/forest/pull/5475) Added missing fields for state sector RPC methods that were added in the recent network upgrade.
4950

5051
## Forest v0.25.0 "Bombadil"
5152

src/rpc/methods/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,7 @@ impl RpcMethod<3> for StateSectorExpiration {
22692269
on_time = 0;
22702270
return Ok(());
22712271
}
2272-
let expirations: Amt<fil_actor_miner_state::v13::ExpirationSet, _> =
2272+
let expirations: Amt<fil_actor_miner_state::v16::ExpirationSet, _> =
22732273
Amt::load(&partition.expirations_epochs(), store)?;
22742274
expirations.for_each(|epoch, expiration| {
22752275
if expiration.early_sectors.get(sector_number) {

src/rpc/types/mod.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,28 +258,40 @@ pub struct SectorOnChainInfo {
258258
/// Pledge collected to commit this sector
259259
pub initial_pledge: TokenAmount,
260260

261-
#[schemars(with = "LotusJson<TokenAmount>")]
261+
#[schemars(with = "LotusJson<Option<TokenAmount>>")]
262262
#[serde(with = "crate::lotus_json")]
263263
/// Expected one day projection of reward for sector computed at activation
264264
/// time
265-
pub expected_day_reward: TokenAmount,
265+
pub expected_day_reward: Option<TokenAmount>,
266266

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

270-
#[schemars(with = "LotusJson<TokenAmount>")]
270+
#[schemars(with = "LotusJson<Option<TokenAmount>>")]
271271
#[serde(with = "crate::lotus_json")]
272272
/// Expected twenty day projection of reward for sector computed at
273273
/// activation time
274-
pub expected_storage_pledge: TokenAmount,
274+
pub expected_storage_pledge: Option<TokenAmount>,
275275

276-
#[schemars(with = "LotusJson<TokenAmount>")]
276+
#[schemars(with = "LotusJson<Option<TokenAmount>>")]
277277
#[serde(with = "crate::lotus_json")]
278-
pub replaced_day_reward: TokenAmount,
278+
pub replaced_day_reward: Option<TokenAmount>,
279279

280280
#[schemars(with = "LotusJson<Option<Cid>>")]
281281
#[serde(with = "crate::lotus_json", rename = "SectorKeyCID")]
282282
pub sector_key_cid: Option<Cid>,
283+
284+
/// The total fee payable per day for this sector. The value of this field is set at the time of
285+
/// sector activation, extension and whenever a sector's `QAP` is changed. This fee is payable for
286+
/// the lifetime of the sector and is aggregated in the deadline's `daily_fee` field.
287+
///
288+
/// This field is not included in the serialized form of the struct prior to the activation of
289+
/// FIP-0100, and is added as the 16th element of the array after that point only for new sectors
290+
/// or sectors that are updated after that point. For old sectors, the value of this field will
291+
/// always be zero.
292+
#[schemars(with = "LotusJson<TokenAmount>")]
293+
#[serde(with = "crate::lotus_json")]
294+
pub daily_fee: TokenAmount,
283295
}
284296

285297
lotus_json_with_self!(SectorOnChainInfo);

src/rpc/types/sector_impl.rs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ impl From<fil_actor_miner_state::v8::SectorOnChainInfo> for SectorOnChainInfo {
1818
deal_weight: info.deal_weight,
1919
verified_deal_weight: info.verified_deal_weight,
2020
initial_pledge: info.initial_pledge.into(),
21-
expected_day_reward: info.expected_day_reward.into(),
22-
expected_storage_pledge: info.expected_storage_pledge.into(),
23-
replaced_day_reward: TokenAmount::default(),
21+
expected_day_reward: Some(info.expected_day_reward.into()),
22+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
23+
replaced_day_reward: None,
2424
sector_key_cid: info.sector_key_cid,
2525
power_base_epoch: info.activation,
26+
daily_fee: TokenAmount::default(),
2627
}
2728
}
2829
}
@@ -44,11 +45,12 @@ impl From<fil_actor_miner_state::v9::SectorOnChainInfo> for SectorOnChainInfo {
4445
deal_weight: info.deal_weight,
4546
verified_deal_weight: info.verified_deal_weight,
4647
initial_pledge: info.initial_pledge.into(),
47-
expected_day_reward: info.expected_day_reward.into(),
48-
expected_storage_pledge: info.expected_storage_pledge.into(),
49-
replaced_day_reward: info.replaced_day_reward.into(),
48+
expected_day_reward: Some(info.expected_day_reward.into()),
49+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
50+
replaced_day_reward: Some(info.replaced_day_reward.into()),
5051
sector_key_cid: info.sector_key_cid,
5152
power_base_epoch: info.activation,
53+
daily_fee: TokenAmount::default(),
5254
}
5355
}
5456
}
@@ -70,11 +72,12 @@ impl From<fil_actor_miner_state::v10::SectorOnChainInfo> for SectorOnChainInfo {
7072
deal_weight: info.deal_weight,
7173
verified_deal_weight: info.verified_deal_weight,
7274
initial_pledge: info.initial_pledge.into(),
73-
expected_day_reward: info.expected_day_reward.into(),
74-
expected_storage_pledge: info.expected_storage_pledge.into(),
75-
replaced_day_reward: info.replaced_day_reward.into(),
75+
expected_day_reward: Some(info.expected_day_reward.into()),
76+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
77+
replaced_day_reward: Some(info.replaced_day_reward.into()),
7678
sector_key_cid: info.sector_key_cid,
7779
power_base_epoch: info.activation,
80+
daily_fee: TokenAmount::default(),
7881
}
7982
}
8083
}
@@ -96,11 +99,12 @@ impl From<fil_actor_miner_state::v11::SectorOnChainInfo> for SectorOnChainInfo {
9699
deal_weight: info.deal_weight,
97100
verified_deal_weight: info.verified_deal_weight,
98101
initial_pledge: info.initial_pledge.into(),
99-
expected_day_reward: info.expected_day_reward.into(),
100-
expected_storage_pledge: info.expected_storage_pledge.into(),
101-
replaced_day_reward: info.replaced_day_reward.into(),
102+
expected_day_reward: Some(info.expected_day_reward.into()),
103+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
104+
replaced_day_reward: Some(info.replaced_day_reward.into()),
102105
sector_key_cid: info.sector_key_cid,
103106
power_base_epoch: info.activation,
107+
daily_fee: TokenAmount::default(),
104108
}
105109
}
106110
}
@@ -118,11 +122,12 @@ impl From<fil_actor_miner_state::v12::SectorOnChainInfo> for SectorOnChainInfo {
118122
deal_weight: info.deal_weight,
119123
verified_deal_weight: info.verified_deal_weight,
120124
initial_pledge: info.initial_pledge.into(),
121-
expected_day_reward: info.expected_day_reward.into(),
122-
expected_storage_pledge: info.expected_storage_pledge.into(),
123-
replaced_day_reward: info.replaced_day_reward.into(),
125+
expected_day_reward: Some(info.expected_day_reward.into()),
126+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
127+
replaced_day_reward: Some(info.replaced_day_reward.into()),
124128
sector_key_cid: info.sector_key_cid,
125129
power_base_epoch: info.power_base_epoch,
130+
daily_fee: TokenAmount::default(),
126131
}
127132
}
128133
}
@@ -140,11 +145,12 @@ impl From<fil_actor_miner_state::v13::SectorOnChainInfo> for SectorOnChainInfo {
140145
deal_weight: info.deal_weight,
141146
verified_deal_weight: info.verified_deal_weight,
142147
initial_pledge: info.initial_pledge.into(),
143-
expected_day_reward: info.expected_day_reward.into(),
144-
expected_storage_pledge: info.expected_storage_pledge.into(),
145-
replaced_day_reward: info.replaced_day_reward.into(),
148+
expected_day_reward: Some(info.expected_day_reward.into()),
149+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
150+
replaced_day_reward: Some(info.replaced_day_reward.into()),
146151
sector_key_cid: info.sector_key_cid,
147152
power_base_epoch: info.power_base_epoch,
153+
daily_fee: TokenAmount::default(),
148154
}
149155
}
150156
}
@@ -162,11 +168,12 @@ impl From<fil_actor_miner_state::v14::SectorOnChainInfo> for SectorOnChainInfo {
162168
deal_weight: info.deal_weight,
163169
verified_deal_weight: info.verified_deal_weight,
164170
initial_pledge: info.initial_pledge.into(),
165-
expected_day_reward: info.expected_day_reward.into(),
166-
expected_storage_pledge: info.expected_storage_pledge.into(),
167-
replaced_day_reward: info.replaced_day_reward.into(),
171+
expected_day_reward: Some(info.expected_day_reward.into()),
172+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
173+
replaced_day_reward: Some(info.replaced_day_reward.into()),
168174
sector_key_cid: info.sector_key_cid,
169175
power_base_epoch: info.power_base_epoch,
176+
daily_fee: TokenAmount::default(),
170177
}
171178
}
172179
}
@@ -184,11 +191,12 @@ impl From<fil_actor_miner_state::v15::SectorOnChainInfo> for SectorOnChainInfo {
184191
deal_weight: info.deal_weight,
185192
verified_deal_weight: info.verified_deal_weight,
186193
initial_pledge: info.initial_pledge.into(),
187-
expected_day_reward: info.expected_day_reward.into(),
188-
expected_storage_pledge: info.expected_storage_pledge.into(),
189-
replaced_day_reward: info.replaced_day_reward.into(),
194+
expected_day_reward: Some(info.expected_day_reward.into()),
195+
expected_storage_pledge: Some(info.expected_storage_pledge.into()),
196+
replaced_day_reward: Some(info.replaced_day_reward.into()),
190197
sector_key_cid: info.sector_key_cid,
191198
power_base_epoch: info.power_base_epoch,
199+
daily_fee: TokenAmount::default(),
192200
}
193201
}
194202
}
@@ -206,20 +214,12 @@ impl From<fil_actor_miner_state::v16::SectorOnChainInfo> for SectorOnChainInfo {
206214
deal_weight: info.deal_weight,
207215
verified_deal_weight: info.verified_deal_weight,
208216
initial_pledge: info.initial_pledge.into(),
209-
expected_day_reward: info
210-
.expected_day_reward
211-
.unwrap_or(TokenAmount::default().into())
212-
.into(),
213-
expected_storage_pledge: info
214-
.expected_storage_pledge
215-
.unwrap_or(TokenAmount::default().into())
216-
.into(),
217-
replaced_day_reward: info
218-
.replaced_day_reward
219-
.unwrap_or(TokenAmount::default().into())
220-
.into(),
217+
expected_day_reward: info.expected_day_reward.map(Into::into),
218+
expected_storage_pledge: info.expected_storage_pledge.map(Into::into),
219+
replaced_day_reward: info.replaced_day_reward.map(Into::into),
221220
sector_key_cid: info.sector_key_cid,
222221
power_base_epoch: info.power_base_epoch,
222+
daily_fee: info.daily_fee.into(),
223223
}
224224
}
225225
}

src/tool/subcommands/api_cmd/test_snapshots.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ filecoin_statemarketbalance_1737021768960382.rpcsnap.json.zst
8686
filecoin_statemarketdeals_1737021771457252.rpcsnap.json.zst
8787
filecoin_statemarketparticipants_1737021768960732.rpcsnap.json.zst
8888
filecoin_statemarketstoragedeal_1737021768962584.rpcsnap.json.zst
89-
filecoin_statemineractivesectors_1742810233639719.rpcsnap.json.zst
9089
filecoin_stateminerallocated_1737022538682774.rpcsnap.json.zst
9190
filecoin_statemineravailablebalance_1737022538683759.rpcsnap.json.zst
9291
filecoin_stateminerdeadlines_1742515166713076.rpcsnap.json.zst
@@ -101,14 +100,15 @@ filecoin_stateminerprovingdeadline_1737022538685431.rpcsnap.json.zst
101100
filecoin_stateminerrecoveries_1737022538685471.rpcsnap.json.zst
102101
filecoin_stateminersectorallocated_1737022538685862.rpcsnap.json.zst
103102
filecoin_stateminersectorcount_1737022538685937.rpcsnap.json.zst
104-
filecoin_stateminersectors_1742810235169204.rpcsnap.json.zst
103+
filecoin_statemineractivesectors_1743095344878935.rpcsnap.json.zst
104+
filecoin_stateminersectors_1743095345529547.rpcsnap.json.zst
105105
filecoin_statenetworkname_1737546933390169.rpcsnap.json.zst
106106
filecoin_statenetworkversion_1737546933390184.rpcsnap.json.zst
107107
filecoin_statereadstate_1737546933390259.rpcsnap.json.zst
108108
filecoin_statesearchmsg_1741784596636715.rpcsnap.json.zst
109109
filecoin_statesearchmsglimited_1741784596704876.rpcsnap.json.zst
110110
filecoin_statesectorexpiration_1741784727996672.rpcsnap.json.zst
111-
filecoin_statesectorgetinfo_1742810233440470.rpcsnap.json.zst
111+
filecoin_statesectorgetinfo_1743098602783105.rpcsnap.json.zst
112112
filecoin_statesectorpartition_1737546933391247.rpcsnap.json.zst
113113
filecoin_statesectorprecommitinfo_1737546933391304.rpcsnap.json.zst
114114
filecoin_stateverifiedclientstatus_1737546933391465.rpcsnap.json.zst

0 commit comments

Comments
 (0)