@@ -131,7 +131,7 @@ pub enum Method {
131131 DisputeWindowedPoSt = 24 ,
132132 //PreCommitSectorBatch = 25, // Deprecated
133133 // ProveCommitAggregate = 26, // Deprecated
134- ProveReplicaUpdates = 27 ,
134+ // ProveReplicaUpdates = 27, // Deprecated
135135 PreCommitSectorBatch2 = 28 ,
136136 //ProveReplicaUpdates2 = 29, // Deprecated
137137 ChangeBeneficiary = 30 ,
@@ -763,163 +763,6 @@ impl Actor {
763763 Ok ( ( ) )
764764 }
765765
766- fn prove_replica_updates < RT > (
767- rt : & RT ,
768- params : ProveReplicaUpdatesParams ,
769- ) -> Result < BitField , ActorError >
770- where
771- // + Clone because we messed up and need to keep a copy around between transactions.
772- // https://github.com/filecoin-project/builtin-actors/issues/133
773- RT :: Blockstore : Clone ,
774- RT : Runtime ,
775- {
776- // In this entry point, the unsealed CID is computed from deals via the market actor.
777- // A future entry point will take the unsealed CID as parameter
778- let updates = params
779- . updates
780- . into_iter ( )
781- . map ( |ru| ReplicaUpdateInner {
782- sector_number : ru. sector_number ,
783- deadline : ru. deadline ,
784- partition : ru. partition ,
785- new_sealed_cid : ru. new_sealed_cid ,
786- deals : ru. deals ,
787- update_proof_type : ru. update_proof_type ,
788- replica_proof : ru. replica_proof ,
789- } )
790- . collect ( ) ;
791- Self :: prove_replica_updates_inner ( rt, updates)
792- }
793-
794- fn prove_replica_updates_inner < RT > (
795- rt : & RT ,
796- updates : Vec < ReplicaUpdateInner > ,
797- ) -> Result < BitField , ActorError >
798- where
799- RT :: Blockstore : Blockstore ,
800- RT : Runtime ,
801- {
802- let state: State = rt. state ( ) ?;
803- let store = rt. store ( ) ;
804- let info = get_miner_info ( store, & state) ?;
805-
806- rt. validate_immediate_caller_is (
807- info. control_addresses . iter ( ) . chain ( & [ info. owner , info. worker ] ) ,
808- ) ?;
809-
810- let mut sectors = Sectors :: load ( & store, & state. sectors )
811- . context_code ( ExitCode :: USR_ILLEGAL_STATE , "failed to load sectors array" ) ?;
812- let mut sector_infos = Vec :: with_capacity ( updates. len ( ) ) ;
813- for update in & updates {
814- sector_infos. push ( sectors. must_get ( update. sector_number ) ?) ;
815- }
816-
817- // Validate inputs
818- let require_deals = true ; // Legacy PRU requires deals to be specified in the update.
819- let all_or_nothing = false ; // Skip invalid updates.
820- let ( batch_return, update_sector_infos) = validate_replica_updates (
821- & updates,
822- & sector_infos,
823- & state,
824- info. sector_size ,
825- rt. policy ( ) ,
826- rt. curr_epoch ( ) ,
827- store,
828- require_deals,
829- all_or_nothing,
830- ) ?;
831- // Drop invalid inputs.
832- let update_sector_infos: Vec < UpdateAndSectorInfo > =
833- batch_return. successes ( & update_sector_infos) . into_iter ( ) . cloned ( ) . collect ( ) ;
834-
835- let data_activation_inputs: Vec < DealsActivationInput > =
836- update_sector_infos. iter ( ) . map_into ( ) . collect ( ) ;
837-
838- /*
839- - no CommD was specified on input so it must be computed for the first time here
840- */
841- let compute_commd = true ;
842- let ( batch_return, data_activations) =
843- activate_sectors_deals ( rt, & data_activation_inputs, compute_commd) ?;
844-
845- // associate the successfully activated sectors with the ReplicaUpdateInner and SectorOnChainInfo
846- let validated_updates: Vec < ( & UpdateAndSectorInfo , DataActivationOutput ) > = batch_return
847- . successes ( & update_sector_infos)
848- . into_iter ( )
849- . zip ( data_activations)
850- . collect ( ) ;
851-
852- if validated_updates. is_empty ( ) {
853- return Err ( actor_error ! ( illegal_argument, "no valid updates" ) ) ;
854- }
855-
856- // Errors past this point cause the prove_replica_updates call to fail (no more skipping sectors)
857- // Group inputs by deadline
858- let mut updated_sectors: Vec < SectorNumber > = Vec :: new ( ) ;
859- let mut decls_by_deadline = BTreeMap :: < u64 , Vec < ReplicaUpdateStateInputs > > :: new ( ) ;
860- let mut deadlines_to_load = Vec :: < u64 > :: new ( ) ;
861- for ( usi, data_activation) in & validated_updates {
862- updated_sectors. push ( usi. update . sector_number ) ;
863- let dl = usi. update . deadline ;
864- if !decls_by_deadline. contains_key ( & dl) {
865- deadlines_to_load. push ( dl) ;
866- }
867-
868- let computed_commd = CompactCommD :: new ( data_activation. unsealed_cid )
869- . get_cid ( usi. sector_info . seal_proof ) ?;
870- let proof_inputs = ReplicaUpdateInfo {
871- update_proof_type : usi. update . update_proof_type ,
872- new_sealed_cid : usi. update . new_sealed_cid ,
873- old_sealed_cid : usi. sector_info . sealed_cid ,
874- new_unsealed_cid : computed_commd,
875- proof : usi. update . replica_proof . clone ( ) . into ( ) ,
876- } ;
877- rt. verify_replica_update ( & proof_inputs) . with_context_code (
878- ExitCode :: USR_ILLEGAL_ARGUMENT ,
879- || {
880- format ! (
881- "failed to verify replica proof for sector {}" ,
882- usi. sector_info. sector_number
883- )
884- } ,
885- ) ?;
886-
887- let activated_data = ReplicaUpdateActivatedData {
888- seal_cid : usi. update . new_sealed_cid ,
889- unverified_space : data_activation. unverified_space . clone ( ) ,
890- verified_space : data_activation. verified_space . clone ( ) ,
891- } ;
892- decls_by_deadline. entry ( dl) . or_default ( ) . push ( ReplicaUpdateStateInputs {
893- deadline : usi. update . deadline ,
894- partition : usi. update . partition ,
895- sector_info : usi. sector_info ,
896- activated_data,
897- } ) ;
898-
899- emit:: sector_updated (
900- rt,
901- usi. update . sector_number ,
902- data_activation. unsealed_cid ,
903- & data_activation. pieces ,
904- ) ?;
905- }
906-
907- let ( power_delta, pledge_delta) = update_replica_states (
908- rt,
909- & decls_by_deadline,
910- validated_updates. len ( ) ,
911- & mut sectors,
912- info. sector_size ,
913- ) ?;
914-
915- notify_pledge_changed ( rt, & pledge_delta) ?;
916- request_update_power ( rt, power_delta) ?;
917-
918- let updated_bitfield = BitField :: try_from_bits ( updated_sectors)
919- . context_code ( ExitCode :: USR_ILLEGAL_ARGUMENT , "invalid sector number" ) ?;
920- Ok ( updated_bitfield)
921- }
922-
923766 fn prove_replica_updates3 (
924767 rt : & impl Runtime ,
925768 params : ProveReplicaUpdates3Params ,
@@ -980,7 +823,6 @@ impl Actor {
980823 deadline : update. deadline ,
981824 partition : update. partition ,
982825 new_sealed_cid : update. new_sealed_cid ,
983- deals : vec ! [ ] ,
984826 update_proof_type : params. update_proofs_type ,
985827 // Replica proof may be empty if an aggregate is being proven.
986828 // Validation needs to accept this empty proof.
@@ -989,16 +831,13 @@ impl Actor {
989831 }
990832
991833 // Validate inputs.
992- let require_deals = false ; // No deals can be specified in new replica update.
993834 let ( validation_batch, update_sector_infos) = validate_replica_updates (
994835 & updates,
995836 & sector_infos,
996837 & state,
997- info. sector_size ,
998838 rt. policy ( ) ,
999839 rt. curr_epoch ( ) ,
1000840 store,
1001- require_deals,
1002841 params. require_activation_success ,
1003842 ) ?;
1004843 let valid_unproven_usis = validation_batch. successes ( & update_sector_infos) ;
@@ -3443,7 +3282,6 @@ pub struct ReplicaUpdateInner {
34433282 pub deadline : u64 ,
34443283 pub partition : u64 ,
34453284 pub new_sealed_cid : Cid ,
3446- pub deals : Vec < DealID > ,
34473285 pub update_proof_type : RegisteredUpdateProof ,
34483286 pub replica_proof : RawBytes ,
34493287}
@@ -3759,11 +3597,9 @@ fn validate_replica_updates<'a, BS>(
37593597 updates : & ' a [ ReplicaUpdateInner ] ,
37603598 sector_infos : & ' a [ SectorOnChainInfo ] ,
37613599 state : & State ,
3762- sector_size : SectorSize ,
37633600 policy : & Policy ,
37643601 curr_epoch : ChainEpoch ,
37653602 store : BS ,
3766- require_deals : bool ,
37673603 all_or_nothing : bool ,
37683604) -> Result < ( BatchReturn , Vec < UpdateAndSectorInfo < ' a > > ) , ActorError >
37693605where
@@ -3790,22 +3626,6 @@ where
37903626 ) ) ;
37913627 }
37923628
3793- if require_deals && update. deals . is_empty ( ) {
3794- return Err ( actor_error ! (
3795- illegal_argument,
3796- "must have deals to update, skipping sector {}" ,
3797- update. sector_number
3798- ) ) ;
3799- }
3800-
3801- if update. deals . len ( ) as u64 > sector_deals_max ( policy, sector_size) {
3802- return Err ( actor_error ! (
3803- illegal_argument,
3804- "more deals than policy allows, skipping sector {}" ,
3805- update. sector_number
3806- ) ) ;
3807- }
3808-
38093629 if update. deadline >= policy. wpost_period_deadlines {
38103630 return Err ( actor_error ! (
38113631 illegal_argument,
@@ -5461,7 +5281,7 @@ impl From<&UpdateAndSectorInfo<'_>> for DealsActivationInput {
54615281 DealsActivationInput {
54625282 sector_number : usi. sector_info . sector_number ,
54635283 sector_expiry : usi. sector_info . expiration ,
5464- deal_ids : usi . update . deals . clone ( ) ,
5284+ deal_ids : vec ! [ ] ,
54655285 sector_type : usi. sector_info . seal_proof ,
54665286 }
54675287 }
@@ -5472,8 +5292,6 @@ impl From<&UpdateAndSectorInfo<'_>> for DealsActivationInput {
54725292struct DataActivationOutput {
54735293 pub unverified_space : BigInt ,
54745294 pub verified_space : BigInt ,
5475- // None indicates either no deals or computation was not requested.
5476- pub unsealed_cid : Option < Cid > ,
54775295 pub pieces : Vec < ( Cid , u64 ) > ,
54785296}
54795297
@@ -5503,8 +5321,6 @@ struct ReplicaUpdateActivatedData {
55035321// Pieces are grouped by sector and succeed or fail in sector groups.
55045322// If an activation input specifies an expected CommD for the sector, a CommD
55055323// is calculated from the pieces and must match.
5506- // This method never returns CommDs in the output type; either the caller provided
5507- // them and they are correct, or the caller did not provide anything that needs checking.
55085324fn activate_sectors_pieces (
55095325 rt : & impl Runtime ,
55105326 activation_inputs : Vec < SectorPiecesActivationInput > ,
@@ -5580,7 +5396,6 @@ fn activate_sectors_pieces(
55805396 DataActivationOutput {
55815397 unverified_space : unverified_space. clone ( ) ,
55825398 verified_space : sector_claim. claimed_space . clone ( ) ,
5583- unsealed_cid : None ,
55845399 pieces,
55855400 }
55865401 } )
@@ -5691,7 +5506,6 @@ fn activate_sectors_deals(
56915506 DataActivationOutput {
56925507 unverified_space : unverified_deal_space,
56935508 verified_space : sector_claim. claimed_space ,
5694- unsealed_cid : sector_deals. unsealed_cid ,
56955509 pieces : sector_pieces,
56965510 }
56975511 } )
@@ -5801,7 +5615,6 @@ impl ActorCode for Actor {
58015615 RepayDebt |RepayDebtExported => repay_debt,
58025616 ChangeOwnerAddress |ChangeOwnerAddressExported => change_owner_address,
58035617 DisputeWindowedPoSt => dispute_windowed_post,
5804- ProveReplicaUpdates => prove_replica_updates,
58055618 PreCommitSectorBatch2 => pre_commit_sector_batch2,
58065619 ChangeBeneficiary |ChangeBeneficiaryExported => change_beneficiary,
58075620 GetBeneficiary |GetBeneficiaryExported => get_beneficiary,
0 commit comments