Skip to content

Commit

Permalink
feat: reject V1P1 proofs on calibrationnet before cutoff
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Apr 26, 2023
1 parent 5fcae00 commit 4e42e32
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fvm/src/kernel/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ use fvm_ipld_blockstore::Blockstore;
use fvm_ipld_encoding::{bytes_32, IPLD_RAW};
use fvm_shared::address::Payload;
use fvm_shared::bigint::Zero;
use fvm_shared::chainid::ChainID;
use fvm_shared::consensus::ConsensusFault;
use fvm_shared::crypto::signature;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ErrorNumber;
use fvm_shared::event::ActorEvent;
use fvm_shared::piece::{zero_piece_commitment, PaddedPieceSize};
use fvm_shared::sector::RegisteredPoStProof::StackedDRGWindow32GiBV1P1;
use fvm_shared::sector::{RegisteredPoStProof, SectorInfo};
use fvm_shared::sys::out::vm::ContextFlags;
use fvm_shared::{commcid, ActorID};
Expand Down Expand Up @@ -539,6 +541,22 @@ where
.call_manager
.charge_gas(self.call_manager.price_list().on_verify_post(verify_info))?;

// Due to a bug on calibrationnet, we have some _valid_ StackedDRGWindow32GiBV1P1
// proofs that were deemed invalid on chain. This was fixed WITHOUT a network version check.
// As a result, we need to explicitly consider all such proofs invalid, ONLY on calibrationnet,
// and ONLY before epoch 498691,
let calibnet_chain_id = ChainID::from(314159);

#[allow(clippy::collapsible_if)]
if self.call_manager.context().network.chain_id == calibnet_chain_id {
if self.call_manager.context().epoch <= 498691
&& !verify_info.proofs.is_empty()
&& verify_info.proofs[0].post_proof == StackedDRGWindow32GiBV1P1
{
return Ok(false);
}
}

// This is especially important to catch as, otherwise, a bad "post" could be undisputable.
t.record(catch_and_log_panic("verifying post", || {
verify_post(verify_info)
Expand Down

0 comments on commit 4e42e32

Please sign in to comment.