Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
anorth committed Jul 30, 2023
1 parent 5f87ea0 commit 909ef1b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions actors/miner/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ pub mod verifreg {

#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorAllocationClaim {
pub struct SectorClaimSummary {
#[serde(with = "bigint_ser")]
pub claimed_space: BigInt,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ClaimAllocationsReturn {
pub sector_results: BatchReturn,
pub sector_claims: Vec<SectorAllocationClaim>,
pub sector_claims: Vec<SectorClaimSummary>,
}
}
2 changes: 1 addition & 1 deletion actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5033,7 +5033,7 @@ fn batch_activate_deals_and_claim_allocations(
true => ext::verifreg::ClaimAllocationsReturn {
sector_results: BatchReturn::ok(verified_claims.len() as u32),
sector_claims: vec![
ext::verifreg::SectorAllocationClaim {
ext::verifreg::SectorClaimSummary {
claimed_space: BigInt::zero()
};
verified_claims.len()
Expand Down
2 changes: 1 addition & 1 deletion actors/miner/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ impl ActorHarness {
sector_results: BatchReturn::ok(sectors_claims.len() as u32),
sector_claims: sectors_claims
.iter()
.map(|sector| ext::verifreg::SectorAllocationClaim {
.map(|sector| ext::verifreg::SectorClaimSummary {
claimed_space: BigInt::from(
sector.claims.iter().map(|c| c.size.0).sum::<u64>(),
),
Expand Down
9 changes: 6 additions & 3 deletions actors/verifreg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl Actor {
}

let mut batch_gen = BatchReturnGen::new(params.sectors.len());
let mut sector_results: Vec<SectorAllocationClaim> = vec![];
let mut sector_results: Vec<SectorClaimSummary> = vec![];
let mut total_claimed_space = DataCap::zero();

rt.transaction(|st: &mut State, rt| {
Expand All @@ -400,7 +400,10 @@ impl Actor {
if let Some(alloc) = maybe_alloc {
if !can_claim_alloc(&claim, provider, alloc, rt.curr_epoch(), sector.expiry)
{
info!("failed to claim allocation {}", claim.allocation_id);
info!(
"failed to claim allocation {} in sector {} expiry {}",
claim.allocation_id, sector.sector, sector.expiry
);
batch_gen.add_fail(ExitCode::USR_FORBIDDEN);
continue 'sectors;
}
Expand Down Expand Up @@ -443,7 +446,7 @@ impl Actor {
sector_claimed_space += DataCap::from(new_claim.size.0);
}
total_claimed_space += &sector_claimed_space;
sector_results.push(SectorAllocationClaim { claimed_space: sector_claimed_space });
sector_results.push(SectorClaimSummary { claimed_space: sector_claimed_space });
batch_gen.add_success();
}
st.save_allocs(&mut allocs)?;
Expand Down
4 changes: 2 additions & 2 deletions actors/verifreg/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub struct ClaimAllocationsParams {

#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize_tuple, Deserialize_tuple)]
#[serde(transparent)]
pub struct SectorAllocationClaim {
pub struct SectorClaimSummary {
#[serde(with = "bigint_ser")]
pub claimed_space: BigInt,
}
Expand All @@ -157,7 +157,7 @@ pub struct ClaimAllocationsReturn {
/// Status of each sector grouping of claims.
pub sector_results: BatchReturn,
/// The claimed space for each successful sector group.
pub sector_claims: Vec<SectorAllocationClaim>,
pub sector_claims: Vec<SectorClaimSummary>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
Expand Down

0 comments on commit 909ef1b

Please sign in to comment.