-
Notifications
You must be signed in to change notification settings - Fork 86
FIP-0106
: Remove of the ProveReplicaUpdates
method from the miner actor
#1688
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
base: master
Are you sure you want to change the base?
Conversation
@rvagg : FYI this has been marked ready for your review. |
@elmattic a couple of other things I'm seeing:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1688 +/- ##
==========================================
- Coverage 91.36% 90.80% -0.57%
==========================================
Files 143 143
Lines 30410 30253 -157
==========================================
- Hits 27784 27470 -314
- Misses 2626 2783 +157
🚀 New features to boost your workflow:
|
@rvagg Do we want to remove |
We actually can't do this because we are still relying on the hack method; Tracking these discoveries here |
assert_eq!(weights1.0 + weights2.0, new_sector_info_p1.deal_weight); | ||
assert_eq!(weights1.1 + weights2.1, new_sector_info_p1.verified_deal_weight); | ||
assert_eq!(new_sealed_cid1, new_sector_info_p1.sealed_cid); | ||
// TODO: understand why those asserts don't hold anymore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see if I can understand what's going on here. Just a reminder that we need to figure this out before merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that it’s related to notifications. When I pass false
to require_notification_success
and expect OK
, the first assertions pass, but then the last three fail.
let params = ProveReplicaUpdates3Params {
sector_updates: manifests.clone(),
sector_proofs: proofs,
aggregate_proof: RawBytes::default(),
update_proofs_type: update_proof,
aggregate_proof_type: None,
require_activation_success: true,
require_notification_success: false,
};
apply_code(
v,
&worker,
&maddr,
&TokenAmount::zero(),
MinerMethod::ProveReplicaUpdates3 as u64,
Some(params),
ExitCode::OK,
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tricky one, we can't perform an identical test with PRU3 so we might just need to reframe the test.
require_notification_success: false
means that it'll just go through and ignore the failure from f05, it'll set up deal_wight and verified_deal_weight as if f05 succeeded but it hasn't (i.e. those fields are basically meaningless because of this).
What we can test is that the deals are activated and are associated with the first one only, not the second. That kind of comes close.
possible diff (fix)
diff --git a/integration_tests/src/tests/replica_update_test.rs b/integration_tests/src/tests/replica_update_test.rs
index 6249b9fd..e184a809 100644
--- a/integration_tests/src/tests/replica_update_test.rs
+++ b/integration_tests/src/tests/replica_update_test.rs
@@ -13,7 +13,7 @@ use fvm_shared::sector::{RegisteredSealProof, SectorNumber};
use export_macro::vm_test;
use fil_actor_market::State as MarketState;
-use fil_actor_market::{Label, Method as MarketMethod};
+use fil_actor_market::{DealMetaArray, Label, Method as MarketMethod};
use fil_actor_miner::{
DisputeWindowedPoStParams, ExpirationExtension2, ExtendSectorExpiration2Params,
Method as MinerMethod, PowerPair, ProveReplicaUpdates3Params, ProveReplicaUpdates3Return,
@@ -972,32 +972,43 @@ pub fn deal_included_in_multiple_sectors_failure_test(v: &dyn VM) {
update_proofs_type: update_proof,
aggregate_proof_type: None,
require_activation_success: true,
- require_notification_success: true,
+ require_notification_success: false,
};
- apply_code(
+ let ret: ProveReplicaUpdates3Return = apply_ok(
v,
&worker,
&maddr,
&TokenAmount::zero(),
MinerMethod::ProveReplicaUpdates3 as u64,
Some(params),
- fil_actor_miner::ERR_NOTIFICATION_REJECTED,
- );
+ )
+ .deserialize()
+ .unwrap();
- // TODO: understand why those asserts don't hold anymore
- // let new_sector_info_p1 = sector_info(v, &maddr, first_sector_number);
- // let duration = new_sector_info_p1.expiration - new_sector_info_p1.power_base_epoch;
- // let weights1 = get_deal_weights(v, deal_ids[0], duration);
- // let weights2 = get_deal_weights(v, deal_ids[1], duration);
- // assert_eq!(weights1.0 + weights2.0, new_sector_info_p1.deal_weight);
- // assert_eq!(weights1.1 + weights2.1, new_sector_info_p1.verified_deal_weight);
- // assert_eq!(new_sealed_cid1, new_sector_info_p1.sealed_cid);
+ assert_eq!(ret.activation_results.success_count, 2);
+
+ let new_sector_info_p1 = sector_info(v, &maddr, first_sector_number);
+ let duration = new_sector_info_p1.expiration - new_sector_info_p1.power_base_epoch;
+ let weights1 = get_deal_weights(v, deal_ids[0], duration);
+ let weights2 = get_deal_weights(v, deal_ids[1], duration);
+ assert_eq!(&weights1.0 + &weights2.0, new_sector_info_p1.deal_weight);
+ assert_eq!(&weights1.1 + &weights2.1, new_sector_info_p1.verified_deal_weight);
+ assert_eq!(new_sealed_cid1, new_sector_info_p1.sealed_cid);
let new_sector_info_p2 = sector_info(v, &maddr, first_sector_number + 1);
- assert!(new_sector_info_p2.deal_weight.is_zero());
- assert!(new_sector_info_p2.verified_deal_weight.is_zero());
- assert_ne!(new_sealed_cid2, new_sector_info_p2.sealed_cid);
+ assert_eq!(weights1.0 + weights2.0, new_sector_info_p2.deal_weight);
+ assert_eq!(weights1.1 + weights2.1, new_sector_info_p2.verified_deal_weight);
+ assert_eq!(new_sealed_cid2, new_sector_info_p2.sealed_cid);
+
+ let st: MarketState = get_state(v, &STORAGE_MARKET_ACTOR_ADDR).unwrap();
+ let store = DynBlockstore::wrap(v.blockstore());
+ let deal_states = DealMetaArray::load(&st.states, &store).unwrap();
+ for id in deal_ids.iter() {
+ // both deals are associated with the first sector
+ let state = deal_states.get(*id).unwrap();
+ assert_eq!(first_sector_number, state.unwrap().sector_number);
+ }
assert_invariants(v, &Policy::default(), None)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think this makes more sense and probably the best we can do. I've applied your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements FIP-0106 by removing the deprecated ProveReplicaUpdates
method from the miner actor and migrating tests to use the newer ProveReplicaUpdates3
method instead.
- Removes the
ProveReplicaUpdates
method (number 27) from the miner actor - Removes the
unsealed_cid
member fromDataActivationOutput
structure - Migrates 14 integration tests from
ProveReplicaUpdates
toProveReplicaUpdates3
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
integration_tests/src/util/mod.rs | Adds imports and utility function piece_change for creating piece changes |
integration_tests/src/tests/replica_update_test.rs | Migrates all replica update tests from old to new API format |
integration_tests/src/tests/replica_update3_test.rs | Removes duplicate piece_change function, now using the shared utility |
integration_tests/src/tests/extend_sectors_test.rs | Updates sector extension test to use new replica update API |
integration_tests/src/expects.rs | Updates test expectations from market_activate_deals to market_content_changed |
actors/miner/src/lib.rs | Removes deprecated ProveReplicaUpdates method and related validation logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elmattic couple of suggestions:
-
We can remove the ReplicaUpdate and ProveReplicaUpdatesParams
-
We can move all the tests present in
replica_update_test.rs
to thereplica_update_3_test.rs
.
Changes:
ProveReplicaUpdates
method (number 27) from the miner actorunsealed_cid
member fromDataActivationOutput
ProveReplicaUpdates3
methodImportant note: I wasn’t able to port
deal_included_in_multiple_sectors_failure_test
and get the corresponding assertions to work.