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 prove replica update multi dline bug #138

Merged
merged 4 commits into from
Mar 31, 2022
Merged
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
14 changes: 11 additions & 3 deletions actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ impl Actor {
let mut deadlines = state
.load_deadlines(rt.store())?;

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

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

for (i, with_details) in decls_by_deadline[&dl_idx].iter().enumerate() {
for with_details in &decls_by_deadline[&dl_idx] {
let update_proof_type = with_details.sector_info.seal_proof
.registered_update_proof()
.map_err(|_|
Expand Down Expand Up @@ -1247,7 +1247,7 @@ impl Actor {
})?;

succeeded.push(new_sector_info.sector_number);
new_sectors[i] = new_sector_info;
new_sectors.push(new_sector_info);
}

deadline.partitions = partitions.flush().map_err(|e| {
Expand Down Expand Up @@ -1276,6 +1276,14 @@ impl Actor {
validated_updates.len()
));
}
if new_sectors.len() != validated_updates.len() {
return Err(actor_error!(
ErrIllegalState,
"unexpected new_sectors len {} != {}",
new_sectors.len(),
validated_updates.len()
));
}

// Overwrite sector infos.
sectors.store(new_sectors).map_err(|e| {
Expand Down