Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenGround0 committed May 23, 2024
1 parent 3b6e063 commit 6ea3301
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
20 changes: 15 additions & 5 deletions actors/miner/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,10 @@ impl ActorHarness {
CompactCommD::empty()
} else {
// Determine CommD from configuration in the same way as prove_commit_and_confirm
let piece_specs = make_piece_specs_from_configs(sector_no, &sector_deal_ids, &prove_cfg);
let piece_specs =
make_piece_specs_from_configs(sector_no, &sector_deal_ids, &prove_cfg);
let manifest = make_activation_manifest(sector_no, &piece_specs);
let piece_cids: Vec::<Cid> = manifest.pieces.iter().map(|p| p.cid).collect();
let piece_cids: Vec<Cid> = manifest.pieces.iter().map(|p| p.cid).collect();
sector_commd_from_pieces(&piece_cids)
};

Expand Down Expand Up @@ -765,7 +766,7 @@ impl ActorHarness {
) -> Result<SectorOnChainInfo, ActorError> {
let sector_number = params.sector_number;
let piece_specs = make_piece_specs_from_configs(sector_number, deal_ids, &cfg);

let manifest = make_activation_manifest(sector_number, &piece_specs);
let req_activation_succ = true; // Doesn't really matter since there's only 1
let req_notif_succ = false; // CPSV could not require this as it happened in cron
Expand Down Expand Up @@ -3339,7 +3340,11 @@ pub fn make_piece_manifest(
}
}

pub fn make_piece_specs_from_configs(sector_number: u64, deal_ids: &Vec<DealID>, prove_cfg: &ProveCommitConfig) ->Vec<(u64, ActorID, AllocationID, DealID)> {
pub fn make_piece_specs_from_configs(
sector_number: u64,
deal_ids: &Vec<DealID>,
prove_cfg: &ProveCommitConfig,
) -> Vec<(u64, ActorID, AllocationID, DealID)> {
static EMPTY_VEC: Vec<ActivatedDeal> = Vec::new();
let configured_deals = prove_cfg.activated_deals.get(&sector_number).unwrap_or(&EMPTY_VEC);
// The old configuration system had duplicated information between cfg and precommit inputs
Expand All @@ -3356,7 +3361,12 @@ pub fn make_piece_specs_from_configs(sector_number: u64, deal_ids: &Vec<DealID>,
// Piece specs don't specify piece cid but deterministically derive it so ignore deal.Cid
piece_specs.push((deal.size.0, deal.client, deal.allocation_id, deal_id.clone()));
} else {
piece_specs.push((DEFAULT_PIECE_SIZE, DEFAULT_CLIENT_ID, NO_ALLOCATION_ID, deal_id.clone()));
piece_specs.push((
DEFAULT_PIECE_SIZE,
DEFAULT_CLIENT_ID,
NO_ALLOCATION_ID,
deal_id.clone(),
));
}
}

Expand Down
18 changes: 12 additions & 6 deletions integration_tests/src/tests/prove_commit3_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,18 @@ pub fn prove_commit_sectors2_test(v: &dyn VM) {
subinvocs: Some(vec![]),
events: Some(
deal_ids_s3
.iter()
.chain(deal_ids_s4.iter())
.map(|deal_id| {
Expect::build_market_event("deal-activated", *deal_id, client_id, miner_id)
})
.collect::<Vec<_>>()),
.iter()
.chain(deal_ids_s4.iter())
.map(|deal_id| {
Expect::build_market_event(
"deal-activated",
*deal_id,
client_id,
miner_id,
)
})
.collect::<Vec<_>>(),
),
..Default::default()
},
]),
Expand Down
21 changes: 14 additions & 7 deletions integration_tests/src/tests/replica_update3_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,20 @@ pub fn prove_replica_update2_test(v: &dyn VM) {
),
value: Some(TokenAmount::zero()),
subinvocs: Some(vec![]),
events: Some(deal_ids_s3
.iter()
.chain(deal_ids_s4.iter())
.map(|deal_id| {
Expect::build_market_event("deal-activated", *deal_id, client_id, miner_id)
})
.collect::<Vec<_>>()),
events: Some(
deal_ids_s3
.iter()
.chain(deal_ids_s4.iter())
.map(|deal_id| {
Expect::build_market_event(
"deal-activated",
*deal_id,
client_id,
miner_id,
)
})
.collect::<Vec<_>>(),
),

..Default::default()
},
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/src/util/workflows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,10 @@ pub fn verifreg_add_client(
)]),
..Default::default()
}]),
events: Some(vec![verifier_balance_event(verifier.id().unwrap(), updated_verifier_balance)]),
events: Some(vec![verifier_balance_event(
verifier.id().unwrap(),
updated_verifier_balance,
)]),
..Default::default()
}
.matches(v.take_invocations().last().unwrap());
Expand Down
1 change: 0 additions & 1 deletion vm_api/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl ExpectInvocation {
expected_events
);


// use the zip method to iterate over the emitted events and expected_events
// vectors at the same time
for (emitted, expected) in emitted_events.iter().zip(expected_events.iter()) {
Expand Down

0 comments on commit 6ea3301

Please sign in to comment.