11#![ allow( clippy:: all) ]
22
33use fil_actor_miner as miner;
4- use fil_actor_miner:: { PowerPair , SubmitWindowedPoStParams } ;
4+ use fil_actor_miner:: PowerPair ;
55use fil_actors_runtime:: runtime:: DomainSeparationTag ;
66use fil_actors_runtime:: test_utils:: * ;
77use fvm_ipld_bitfield:: BitField ;
@@ -15,7 +15,6 @@ use fvm_shared::sector::RegisteredSealProof;
1515mod util;
1616
1717use fvm_ipld_encoding:: ipld_block:: IpldBlock ;
18- use fvm_shared:: version:: NetworkVersion ;
1918use num_traits:: Zero ;
2019use util:: * ;
2120
@@ -270,7 +269,7 @@ fn invalid_submissions() {
270269 let params = miner:: SubmitWindowedPoStParams {
271270 deadline : dlinfo. index ,
272271 partitions : vec ! [ partition] ,
273- proofs : make_post_proofs ( RegisteredPoStProof :: StackedDRGWindow8MiBV1 ) ,
272+ proofs : make_post_proofs ( RegisteredPoStProof :: StackedDRGWindow8MiBV1P1 ) ,
274273 chain_commit_epoch : dlinfo. challenge ,
275274 chain_commit_rand : Randomness ( TEST_RANDOMNESS_ARRAY_FROM_ONE . into ( ) ) ,
276275 } ;
@@ -295,7 +294,7 @@ fn invalid_submissions() {
295294 let params = miner:: SubmitWindowedPoStParams {
296295 deadline : dlinfo. index ,
297296 partitions : vec ! [ partition] ,
298- proofs : make_post_proofs ( RegisteredPoStProof :: StackedDRGWindow64GiBV1 ) ,
297+ proofs : make_post_proofs ( RegisteredPoStProof :: StackedDRGWindow64GiBV1P1 ) ,
299298 chain_commit_epoch : dlinfo. challenge ,
300299 chain_commit_rand : Randomness ( TEST_RANDOMNESS_ARRAY_FROM_ONE . into ( ) ) ,
301300 } ;
@@ -1294,119 +1293,3 @@ fn bad_post_fails_when_verified() {
12941293 rt. reset ( ) ;
12951294 h. check_state ( & rt) ;
12961295}
1297-
1298- #[ test]
1299- fn cannot_submit_v1_proof_types_nv19 ( ) {
1300- struct TestCase {
1301- desc : & ' static str ,
1302- nv : NetworkVersion ,
1303- seal_proof_type : RegisteredSealProof ,
1304- post_proof_type : RegisteredPoStProof ,
1305- exit_code : ExitCode ,
1306- error_msg : String ,
1307- }
1308-
1309- let tests = [
1310- TestCase {
1311- desc : "cannot submit v1 proof in nv19" ,
1312- nv : NetworkVersion :: V19 ,
1313- seal_proof_type : RegisteredSealProof :: StackedDRG32GiBV1P1 ,
1314- post_proof_type : RegisteredPoStProof :: StackedDRGWindow32GiBV1 ,
1315- exit_code : ExitCode :: USR_ILLEGAL_ARGUMENT ,
1316- error_msg :
1317- "expected proof of type StackedDRGWindow32GiBV1P1, got StackedDRGWindow32GiBV1"
1318- . to_string ( ) ,
1319- } ,
1320- TestCase {
1321- desc : "can submit v1p1 proof in nv19" ,
1322- nv : NetworkVersion :: V19 ,
1323- seal_proof_type : RegisteredSealProof :: StackedDRG32GiBV1P1 ,
1324- post_proof_type : RegisteredPoStProof :: StackedDRGWindow32GiBV1P1 ,
1325- exit_code : ExitCode :: OK ,
1326- error_msg : "" . to_string ( ) ,
1327- } ,
1328- TestCase {
1329- desc : "can submit v1p1 proof in nv20" ,
1330- nv : NetworkVersion :: V20 ,
1331- seal_proof_type : RegisteredSealProof :: StackedDRG32GiBV1P1 ,
1332- post_proof_type : RegisteredPoStProof :: StackedDRGWindow32GiBV1P1 ,
1333- exit_code : ExitCode :: OK ,
1334- error_msg : "" . to_string ( ) ,
1335- } ,
1336- TestCase {
1337- desc : "can NOT submit v1 proof in nv20" ,
1338- nv : NetworkVersion :: V20 ,
1339- seal_proof_type : RegisteredSealProof :: StackedDRG32GiBV1P1 ,
1340- post_proof_type : RegisteredPoStProof :: StackedDRGWindow32GiBV1 ,
1341- exit_code : ExitCode :: USR_ILLEGAL_ARGUMENT ,
1342- error_msg :
1343- "expected proof of type StackedDRGWindow32GiBV1P1, got StackedDRGWindow32GiBV1"
1344- . to_string ( ) ,
1345- } ,
1346- ] ;
1347-
1348- for tc in tests {
1349- println ! ( "Testing: {}" , tc. desc) ;
1350- let period_offset = ChainEpoch :: from ( 100 ) ;
1351- let precommit_epoch = ChainEpoch :: from ( 1 ) ;
1352-
1353- let mut h = ActorHarness :: new ( period_offset) ;
1354- h. set_proof_type ( tc. seal_proof_type ) ;
1355-
1356- let mut rt = h. new_runtime ( ) ;
1357- rt. network_version = tc. nv ;
1358- // in nv19 policy, both V1 and V1P1 are "valid" post proof types
1359- rt. policy . valid_post_proof_type . insert ( RegisteredPoStProof :: StackedDRGWindow32GiBV1 ) ;
1360- rt. policy . valid_post_proof_type . insert ( RegisteredPoStProof :: StackedDRGWindow32GiBV1P1 ) ;
1361- rt. epoch . replace ( precommit_epoch) ;
1362- rt. balance . replace ( BIG_BALANCE . clone ( ) ) ;
1363-
1364- h. construct_and_verify ( & rt) ;
1365-
1366- let info = h. get_info ( & rt) ;
1367- // No matter what post proof type the test uses, the miner info should be V1P1
1368- assert_eq ! ( info. window_post_proof_type, RegisteredPoStProof :: StackedDRGWindow32GiBV1P1 ) ;
1369-
1370- let sectors = h. commit_and_prove_sectors ( & rt, 1 , DEFAULT_SECTOR_EXPIRATION , vec ! [ ] , true ) ;
1371- let sector = sectors[ 0 ] . clone ( ) ;
1372- let pwr = miner:: power_for_sector ( h. sector_size , & sector) ;
1373-
1374- // Skip to the right deadline
1375- let state = h. get_state ( & rt) ;
1376- let ( dlidx, pidx) = state. find_sector ( & rt. store , sector. sector_number ) . unwrap ( ) ;
1377- let dlinfo = h. advance_to_deadline ( & rt, dlidx) ;
1378-
1379- // Submit PoSt
1380- let post_partitions =
1381- vec ! [ miner:: PoStPartition { index: pidx, skipped: make_empty_bitfield( ) } ] ;
1382- let post_sectors = vec ! [ sector. clone( ) ] ;
1383- let params = SubmitWindowedPoStParams {
1384- deadline : dlidx,
1385- partitions : post_partitions,
1386- proofs : make_post_proofs ( tc. post_proof_type ) ,
1387- chain_commit_epoch : dlinfo. challenge ,
1388- chain_commit_rand : Randomness ( TEST_RANDOMNESS_ARRAY_FROM_ONE . into ( ) ) ,
1389- } ;
1390-
1391- if tc. exit_code . is_success ( ) {
1392- h. submit_window_post_raw (
1393- & rt,
1394- & dlinfo,
1395- post_sectors,
1396- params,
1397- PoStConfig :: with_expected_power_delta ( & pwr) ,
1398- )
1399- . unwrap ( ) ;
1400- } else {
1401- rt. set_caller ( * ACCOUNT_ACTOR_CODE_ID , h. worker ) ;
1402- rt. expect_validate_caller_addr ( h. caller_addrs ( ) ) ;
1403- let result = rt. call :: < miner:: Actor > (
1404- miner:: Method :: SubmitWindowedPoSt as u64 ,
1405- IpldBlock :: serialize_cbor ( & params) . unwrap ( ) ,
1406- ) ;
1407- expect_abort_contains_message ( tc. exit_code , & tc. error_msg , result) ;
1408- }
1409-
1410- rt. verify ( ) ;
1411- }
1412- }
0 commit comments