From 82d02e58f9ef456aeaf2a6c737562ac97b22b244 Mon Sep 17 00:00:00 2001 From: Krishang <93703995+kamuik16@users.noreply.github.com> Date: Thu, 25 Jul 2024 13:45:09 +0530 Subject: [PATCH] fix: remove Option around SectorPreCommitInfoInner.unsealed_cid (#1570) * remove Option around SectorPreCommitInfoInner.unsealed_cid * use if-let instead of match * fix: rename variable --- actors/miner/src/lib.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/actors/miner/src/lib.rs b/actors/miner/src/lib.rs index db1096741..8ae14c7a8 100644 --- a/actors/miner/src/lib.rs +++ b/actors/miner/src/lib.rs @@ -1467,7 +1467,7 @@ impl Actor { deal_ids: spci.deal_ids, expiration: spci.expiration, - unsealed_cid: Some(spci.unsealed_cid), + unsealed_cid: spci.unsealed_cid, }) .collect(), ) @@ -1544,14 +1544,10 @@ impl Actor { )); } - match &precommit.unsealed_cid { - Some(CompactCommD(Some(commd))) if !is_unsealed_sector(commd) => { + if let Some(commd) = &precommit.unsealed_cid.0 { + if !is_unsealed_sector(commd) { return Err(actor_error!(illegal_argument, "unsealed CID had wrong prefix")); } - None => return Err(actor_error!( - illegal_argument, - "unspecified CompactCommD not allowed past nv21, need explicit None value for CC or CommD")), - _ => {} } // Require sector lifetime meets minimum by assuming activation happens at last epoch permitted for seal proof. @@ -1657,7 +1653,7 @@ impl Actor { // Presence of unsealed CID is checked in the preconditions. // It must always be specified from nv22 onwards. - let declared_commd = precommit.unsealed_cid.unwrap(); + let declared_commd = precommit.unsealed_cid; // This is not a CompactCommD, None means that nothing was computed and nothing needs to be checked if let Some(computed_cid) = verify_return.unsealed_cids[i] { // It is possible the computed commd is the zero commd so expand declared_commd @@ -3594,7 +3590,7 @@ struct SectorPreCommitInfoInner { pub deal_ids: Vec, pub expiration: ChainEpoch, /// CommD - pub unsealed_cid: Option, + pub unsealed_cid: CompactCommD, } /// ReplicaUpdate param with Option for CommD