Skip to content

Commit e1d0eef

Browse files
authored
chore: remove support of v1 proofs in Miner actor (#1391)
Remove support of v1 proofs in Miner actor
1 parent a327238 commit e1d0eef

File tree

4 files changed

+13
-83
lines changed

4 files changed

+13
-83
lines changed

actors/miner/src/lib.rs

+6-36
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ use fil_actors_runtime::{
4848
SYSTEM_ACTOR_ADDR, VERIFIED_REGISTRY_ACTOR_ADDR,
4949
};
5050
use fvm_ipld_encoding::ipld_block::IpldBlock;
51-
use fvm_shared::version::NetworkVersion;
5251
pub use monies::*;
5352
pub use partition_state::*;
5453
pub use policy::*;
@@ -163,14 +162,6 @@ impl Actor {
163162
check_control_addresses(rt.policy(), &params.control_addresses)?;
164163
check_peer_info(rt.policy(), &params.peer_id, &params.multi_addresses)?;
165164
check_valid_post_proof_type(rt.policy(), params.window_post_proof_type)?;
166-
// TODO: v12: cleanup https://github.com/filecoin-project/builtin-actors/issues/1260
167-
if !is_window_post_proof_v1p1(params.window_post_proof_type) {
168-
return Err(actor_error!(
169-
illegal_argument,
170-
"unsupported window post proof type: {:?}",
171-
params.window_post_proof_type
172-
));
173-
}
174165

175166
let owner = rt.resolve_address(&params.owner).ok_or_else(|| {
176167
actor_error!(illegal_argument, "unable to resolve owner address: {}", params.owner)
@@ -550,33 +541,12 @@ impl Actor {
550541

551542
// Make sure the miner is using the correct proof type.
552543
if params.proofs[0].post_proof != info.window_post_proof_type {
553-
// Special for nv19: Allow the v1 version of v1p1 post proof types
554-
let nv = rt.network_version();
555-
// TODO: v12: cleanup https://github.com/filecoin-project/builtin-actors/issues/1260
556-
if nv == NetworkVersion::V19 {
557-
let info_v1_proof_type =
558-
convert_window_post_proof_v1p1_to_v1(info.window_post_proof_type)
559-
.context_code(
560-
ExitCode::USR_ILLEGAL_STATE,
561-
"failed to convert to v1 window post proof",
562-
)?;
563-
if info_v1_proof_type != params.proofs[0].post_proof {
564-
return Err(actor_error!(
565-
illegal_argument,
566-
"expected proof of type {:?} or {:?}, got {:?}",
567-
info_v1_proof_type,
568-
info.window_post_proof_type,
569-
params.proofs[0].post_proof
570-
));
571-
}
572-
} else {
573-
return Err(actor_error!(
574-
illegal_argument,
575-
"expected proof of type {:?}, got {:?}",
576-
info.window_post_proof_type,
577-
params.proofs[0].post_proof
578-
));
579-
}
544+
return Err(actor_error!(
545+
illegal_argument,
546+
"expected proof of type {:?}, got {:?}",
547+
info.window_post_proof_type,
548+
params.proofs[0].post_proof
549+
));
580550
}
581551

582552
// Make sure the proof size doesn't exceed the max. We could probably check for an exact match, but this is safer.

actors/miner/src/policy.rs

-36
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,6 @@ pub fn can_extend_seal_proof_type(_proof: RegisteredSealProof) -> bool {
5858
true
5959
}
6060

61-
/// Convert the v1_1 PoSt Proof type to the older v1 types (used in nv18 and below)
62-
pub fn convert_window_post_proof_v1p1_to_v1(
63-
rpp: RegisteredPoStProof,
64-
) -> Result<RegisteredPoStProof, String> {
65-
match rpp {
66-
RegisteredPoStProof::StackedDRGWindow2KiBV1P1 => {
67-
Ok(RegisteredPoStProof::StackedDRGWindow2KiBV1)
68-
}
69-
RegisteredPoStProof::StackedDRGWindow8MiBV1P1 => {
70-
Ok(RegisteredPoStProof::StackedDRGWindow8MiBV1)
71-
}
72-
RegisteredPoStProof::StackedDRGWindow512MiBV1P1 => {
73-
Ok(RegisteredPoStProof::StackedDRGWindow512MiBV1)
74-
}
75-
RegisteredPoStProof::StackedDRGWindow32GiBV1P1 => {
76-
Ok(RegisteredPoStProof::StackedDRGWindow32GiBV1)
77-
}
78-
RegisteredPoStProof::StackedDRGWindow64GiBV1P1 => {
79-
Ok(RegisteredPoStProof::StackedDRGWindow64GiBV1)
80-
}
81-
i => Err(format!("not a v1p1 proof type: {:?}", i)),
82-
}
83-
}
84-
85-
/// Convert the v1_1 PoSt Proof type to the older v1 types (used in nv18 and below)
86-
pub fn is_window_post_proof_v1p1(rpp: RegisteredPoStProof) -> bool {
87-
matches!(
88-
rpp,
89-
RegisteredPoStProof::StackedDRGWindow2KiBV1P1
90-
| RegisteredPoStProof::StackedDRGWindow8MiBV1P1
91-
| RegisteredPoStProof::StackedDRGWindow512MiBV1P1
92-
| RegisteredPoStProof::StackedDRGWindow32GiBV1P1
93-
| RegisteredPoStProof::StackedDRGWindow64GiBV1P1
94-
)
95-
}
96-
9761
/// Maximum duration to allow for the sealing process for seal algorithms.
9862
/// Dependent on algorithm and sector size
9963
pub fn max_prove_commit_duration(

actors/miner/tests/miner_actor_test_wpost.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ fn invalid_submissions() {
308308
);
309309
expect_abort_contains_message(
310310
ExitCode::USR_ILLEGAL_ARGUMENT,
311-
"expected proof of type",
311+
"proof type StackedDRGWindow64GiBV1 not allowed",
312312
result,
313313
);
314314
rt.reset();
@@ -1296,7 +1296,7 @@ fn bad_post_fails_when_verified() {
12961296
}
12971297

12981298
#[test]
1299-
fn can_submit_v1_proof_types_nv19() {
1299+
fn cannot_submit_v1_proof_types_nv19() {
13001300
struct TestCase {
13011301
desc: &'static str,
13021302
nv: NetworkVersion,
@@ -1308,12 +1308,14 @@ fn can_submit_v1_proof_types_nv19() {
13081308

13091309
let tests = [
13101310
TestCase {
1311-
desc: "can submit v1 proof in nv19",
1311+
desc: "cannot submit v1 proof in nv19",
13121312
nv: NetworkVersion::V19,
13131313
seal_proof_type: RegisteredSealProof::StackedDRG32GiBV1P1,
13141314
post_proof_type: RegisteredPoStProof::StackedDRGWindow32GiBV1,
1315-
exit_code: ExitCode::OK,
1316-
error_msg: "".to_string(),
1315+
exit_code: ExitCode::USR_ILLEGAL_ARGUMENT,
1316+
error_msg:
1317+
"expected proof of type StackedDRGWindow32GiBV1P1, got StackedDRGWindow32GiBV1"
1318+
.to_string(),
13171319
},
13181320
TestCase {
13191321
desc: "can submit v1p1 proof in nv19",

runtime/src/runtime/policy.rs

-6
Original file line numberDiff line numberDiff line change
@@ -358,30 +358,24 @@ impl ProofSet {
358358
/// Create a `ProofSet` for enabled `RegisteredPoStProof`s
359359
pub fn default_post_proofs() -> Self {
360360
let mut proofs = vec![false; REGISTERED_POST_PROOF_VARIANTS];
361-
// TODO: v12: cleanup https://github.com/filecoin-project/builtin-actors/issues/1260
362361
#[cfg(feature = "sector-2k")]
363362
{
364-
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow2KiBV1) as usize] = true;
365363
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow2KiBV1P1) as usize] = true;
366364
}
367365
#[cfg(feature = "sector-8m")]
368366
{
369-
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow8MiBV1) as usize] = true;
370367
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow8MiBV1P1) as usize] = true;
371368
}
372369
#[cfg(feature = "sector-512m")]
373370
{
374-
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow512MiBV1) as usize] = true;
375371
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow512MiBV1P1) as usize] = true;
376372
}
377373
#[cfg(feature = "sector-32g")]
378374
{
379-
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow32GiBV1) as usize] = true;
380375
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow32GiBV1P1) as usize] = true;
381376
}
382377
#[cfg(feature = "sector-64g")]
383378
{
384-
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow64GiBV1) as usize] = true;
385379
proofs[i64::from(RegisteredPoStProof::StackedDRGWindow64GiBV1P1) as usize] = true;
386380
}
387381
ProofSet(proofs)

0 commit comments

Comments
 (0)