Skip to content

Commit 3117746

Browse files
Fix prove replica update multi dline bug (#138)
Co-authored-by: zenground0 <[email protected]> Co-authored-by: Steven Allen <[email protected]>
1 parent a0a5963 commit 3117746

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

actors/miner/src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ impl Actor {
10781078
let mut deadlines = state
10791079
.load_deadlines(rt.store())?;
10801080

1081-
let mut new_sectors = vec![SectorOnChainInfo::default(); validated_updates.len()];
1081+
let mut new_sectors = vec![SectorOnChainInfo::default()];
10821082
for &dl_idx in deadlines_to_load.iter() {
10831083
let mut deadline = deadlines
10841084
.load_deadline(rt.policy(),rt.store(), dl_idx)
@@ -1100,7 +1100,7 @@ impl Actor {
11001100

11011101
let quant = state.quant_spec_for_deadline(rt.policy(),dl_idx);
11021102

1103-
for (i, with_details) in decls_by_deadline[&dl_idx].iter().enumerate() {
1103+
for with_details in &decls_by_deadline[&dl_idx] {
11041104
let update_proof_type = with_details.sector_info.seal_proof
11051105
.registered_update_proof()
11061106
.map_err(|_|
@@ -1247,7 +1247,7 @@ impl Actor {
12471247
})?;
12481248

12491249
succeeded.push(new_sector_info.sector_number);
1250-
new_sectors[i] = new_sector_info;
1250+
new_sectors.push(new_sector_info);
12511251
}
12521252

12531253
deadline.partitions = partitions.flush().map_err(|e| {
@@ -1276,6 +1276,14 @@ impl Actor {
12761276
validated_updates.len()
12771277
));
12781278
}
1279+
if new_sectors.len() != validated_updates.len() {
1280+
return Err(actor_error!(
1281+
ErrIllegalState,
1282+
"unexpected new_sectors len {} != {}",
1283+
new_sectors.len(),
1284+
validated_updates.len()
1285+
));
1286+
}
12791287

12801288
// Overwrite sector infos.
12811289
sectors.store(new_sectors).map_err(|e| {

0 commit comments

Comments
 (0)