Skip to content

Commit

Permalink
Add a test for calling ProveCommitSectors3 before the required pre-co…
Browse files Browse the repository at this point in the history
…mmit challenge delay has elapsed.
  • Loading branch information
anorth committed May 27, 2024
1 parent ca68aa2 commit fdd9d91
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions actors/miner/tests/prove_commit2_failures_test.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use fvm_ipld_encoding::RawBytes;
use fvm_shared::{ActorID, bigint::Zero, clock::ChainEpoch, econ::TokenAmount};
use fvm_shared::address::Address;
use fvm_shared::deal::DealID;
use fvm_shared::error::ExitCode;
use fvm_shared::sector::SectorNumber;
use fvm_shared::{bigint::Zero, clock::ChainEpoch, econ::TokenAmount, ActorID};

use fil_actor_miner::ext::verifreg::AllocationID;
use fil_actor_miner::{
ProveCommitSectors3Params, SectorActivationManifest, ERR_NOTIFICATION_RECEIVER_ABORTED,
ERR_NOTIFICATION_REJECTED,
ERR_NOTIFICATION_RECEIVER_ABORTED, ERR_NOTIFICATION_REJECTED, ProveCommitSectors3Params,
SectorActivationManifest,
};
use fil_actors_runtime::test_utils::{expect_abort_contains_message, MockRuntime};
use fil_actor_miner::ext::verifreg::AllocationID;
use fil_actors_runtime::EPOCHS_IN_DAY;
use fil_actors_runtime::test_utils::{expect_abort_contains_message, MockRuntime};
use util::*;

mod util;
Expand Down Expand Up @@ -90,6 +90,20 @@ fn reject_mismatched_proof_len() {
h.check_state(&rt);
}

#[test]
fn reject_too_soon() {
let (h, rt, activations) = setup_precommits(&[(0, 0, 0)]);
let epoch = *rt.epoch.borrow();
rt.set_epoch(epoch - 2);
let cfg = ProveCommitSectors2Config::default();
expect_abort_contains_message(
ExitCode::USR_FORBIDDEN,
"too early to prove sector",
h.prove_commit_sectors2(&rt, &activations, false, false, false, cfg),
);
h.check_state(&rt);
}

#[test]
fn reject_expired_precommit() {
let (h, rt, activations) = setup_precommits(&[(0, 0, 0)]);
Expand Down

0 comments on commit fdd9d91

Please sign in to comment.