Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore ConfirmSectorProofsValid #1553

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion actors/miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub enum Method {
ApplyRewards = 14,
ReportConsensusFault = 15,
WithdrawBalance = 16,
//ConfirmSectorProofsValid = 17, // Deprecated
InternalSectorSetupForPreseal = 17,
ChangeMultiaddrs = 18,
CompactPartitions = 19,
CompactSectorNumbers = 20,
Expand Down Expand Up @@ -1950,6 +1950,59 @@ impl Actor {
Ok(ProveCommitSectors3Return { activation_results: result })
}

fn internal_sector_setup_preseal(
rt: &impl Runtime,
params: InternalSectorSetupForPresealParams,
) -> Result<(), ActorError> {
rt.validate_immediate_caller_is(std::iter::once(&SYSTEM_ACTOR_ADDR))?;
let st: State = rt.state()?;
let store = rt.store();
// This skips missing pre-commits.
let precommited_sectors =
st.find_precommitted_sectors(store, &params.sectors).map_err(|e| {
e.downcast_default(
ExitCode::USR_ILLEGAL_STATE,
"failed to load pre-committed sectors",
)
})?;

let data_activations: Vec<DealsActivationInput> =
precommited_sectors.iter().map(|x| x.clone().into()).collect();
let info = get_miner_info(rt.store(), &st)?;

/*
For all sectors
- CommD was specified at precommit
- If deal IDs were specified at precommit the CommD was checked against them
Therefore CommD on precommit has already been provided and checked so no further processing needed
*/
let compute_commd = false;
let (batch_return, data_activations) =
activate_sectors_deals(rt, &data_activations, compute_commd)?;
let successful_activations = batch_return.successes(&precommited_sectors);

let pledge_inputs = NetworkPledgeInputs {
network_qap: params.quality_adj_power_smoothed,
network_baseline: params.reward_baseline_power,
circulating_supply: rt.total_fil_circ_supply(),
epoch_reward: params.reward_smoothed,
};
activate_new_sector_infos(
rt,
successful_activations.clone(),
data_activations.clone(),
&pledge_inputs,
&info,
)?;

for (pc, data) in successful_activations.iter().zip(data_activations.iter()) {
let unsealed_cid = pc.info.unsealed_cid.0;
emit::sector_activated(rt, pc.info.sector_number, unsealed_cid, &data.pieces)?;
}

Ok(())
}

fn check_sector_proven(
rt: &impl Runtime,
params: CheckSectorProvenParams,
Expand Down Expand Up @@ -5610,6 +5663,7 @@ impl ActorCode for Actor {
ApplyRewards => apply_rewards,
ReportConsensusFault => report_consensus_fault,
WithdrawBalance|WithdrawBalanceExported => withdraw_balance,
InternalSectorSetupForPreseal => internal_sector_setup_preseal,
ChangeMultiaddrs|ChangeMultiaddrsExported => change_multiaddresses,
CompactPartitions => compact_partitions,
CompactSectorNumbers => compact_sector_numbers,
Expand Down
11 changes: 10 additions & 1 deletion actors/miner/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use fvm_shared::piece::PaddedPieceSize;
use fvm_shared::randomness::Randomness;
use fvm_shared::sector::{
PoStProof, RegisteredAggregateProof, RegisteredPoStProof, RegisteredSealProof,
RegisteredUpdateProof, SectorNumber, SectorSize,
RegisteredUpdateProof, SectorNumber, SectorSize, StoragePower,
};
use fvm_shared::ActorID;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -88,6 +88,15 @@ pub struct ChangeMultiaddrsParams {
pub new_multi_addrs: Vec<BytesDe>,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct InternalSectorSetupForPresealParams {
pub sectors: Vec<SectorNumber>,
pub reward_smoothed: FilterEstimate,
#[serde(with = "bigint_ser")]
pub reward_baseline_power: StoragePower,
pub quality_adj_power_smoothed: FilterEstimate,
}

#[derive(Serialize_tuple, Deserialize_tuple)]
pub struct DeferredCronEventParams {
#[serde(with = "strict_bytes")]
Expand Down
Loading