@@ -119,7 +119,7 @@ pub enum Method {
119
119
ApplyRewards = 14 ,
120
120
ReportConsensusFault = 15 ,
121
121
WithdrawBalance = 16 ,
122
- // ConfirmSectorProofsValid = 17, // Deprecated
122
+ ConfirmSectorProofsValid = 17 ,
123
123
ChangeMultiaddrs = 18 ,
124
124
CompactPartitions = 19 ,
125
125
CompactSectorNumbers = 20 ,
@@ -2173,6 +2173,70 @@ impl Actor {
2173
2173
Ok ( ProveCommitSectorsNIReturn { activation_results : validation_batch } )
2174
2174
}
2175
2175
2176
+ fn confirm_sector_proofs_valid (
2177
+ rt : & impl Runtime ,
2178
+ params : ConfirmSectorProofsParams ,
2179
+ ) -> Result < ( ) , ActorError > {
2180
+ rt. validate_immediate_caller_is ( std:: iter:: once ( & STORAGE_POWER_ACTOR_ADDR ) ) ?;
2181
+
2182
+ /* validate params */
2183
+ // This should be enforced by the power actor. We log here just in case
2184
+ // something goes wrong.
2185
+ if params. sectors . len ( ) > ext:: power:: MAX_MINER_PROVE_COMMITS_PER_EPOCH {
2186
+ warn ! (
2187
+ "confirmed more prove commits in an epoch than permitted: {} > {}" ,
2188
+ params. sectors. len( ) ,
2189
+ ext:: power:: MAX_MINER_PROVE_COMMITS_PER_EPOCH
2190
+ ) ;
2191
+ }
2192
+ let st: State = rt. state ( ) ?;
2193
+ let store = rt. store ( ) ;
2194
+ // This skips missing pre-commits.
2195
+ let precommited_sectors =
2196
+ st. find_precommitted_sectors ( store, & params. sectors ) . map_err ( |e| {
2197
+ e. downcast_default (
2198
+ ExitCode :: USR_ILLEGAL_STATE ,
2199
+ "failed to load pre-committed sectors" ,
2200
+ )
2201
+ } ) ?;
2202
+
2203
+ let data_activations: Vec < DealsActivationInput > =
2204
+ precommited_sectors. iter ( ) . map ( |x| x. clone ( ) . into ( ) ) . collect ( ) ;
2205
+ let info = get_miner_info ( rt. store ( ) , & st) ?;
2206
+
2207
+ /*
2208
+ For all sectors
2209
+ - CommD was specified at precommit
2210
+ - If deal IDs were specified at precommit the CommD was checked against them
2211
+ Therefore CommD on precommit has already been provided and checked so no further processing needed
2212
+ */
2213
+ let compute_commd = false ;
2214
+ let ( batch_return, data_activations) =
2215
+ activate_sectors_deals ( rt, & data_activations, compute_commd) ?;
2216
+ let successful_activations = batch_return. successes ( & precommited_sectors) ;
2217
+
2218
+ let pledge_inputs = NetworkPledgeInputs {
2219
+ network_qap : params. quality_adj_power_smoothed ,
2220
+ network_baseline : params. reward_baseline_power ,
2221
+ circulating_supply : rt. total_fil_circ_supply ( ) ,
2222
+ epoch_reward : params. reward_smoothed ,
2223
+ } ;
2224
+ activate_new_sector_infos (
2225
+ rt,
2226
+ successful_activations. clone ( ) ,
2227
+ data_activations. clone ( ) ,
2228
+ & pledge_inputs,
2229
+ & info,
2230
+ ) ?;
2231
+
2232
+ for ( pc, data) in successful_activations. iter ( ) . zip ( data_activations. iter ( ) ) {
2233
+ let unsealed_cid = pc. info . unsealed_cid . 0 ;
2234
+ emit:: sector_activated ( rt, pc. info . sector_number , unsealed_cid, & data. pieces ) ?;
2235
+ }
2236
+
2237
+ Ok ( ( ) )
2238
+ }
2239
+
2176
2240
fn check_sector_proven (
2177
2241
rt : & impl Runtime ,
2178
2242
params : CheckSectorProvenParams ,
@@ -5955,6 +6019,7 @@ impl ActorCode for Actor {
5955
6019
ApplyRewards => apply_rewards,
5956
6020
ReportConsensusFault => report_consensus_fault,
5957
6021
WithdrawBalance |WithdrawBalanceExported => withdraw_balance,
6022
+ ConfirmSectorProofsValid => confirm_sector_proofs_valid,
5958
6023
ChangeMultiaddrs |ChangeMultiaddrsExported => change_multiaddresses,
5959
6024
CompactPartitions => compact_partitions,
5960
6025
CompactSectorNumbers => compact_sector_numbers,
0 commit comments