From 7af507bed10b6400ae238c1b313e906ac99a18dd Mon Sep 17 00:00:00 2001 From: Alex North <445306+anorth@users.noreply.github.com> Date: Tue, 28 May 2024 09:01:25 +1200 Subject: [PATCH] Add a test for calling ProveCommitSectors3 before the required pre-commit challenge delay has elapsed. --- actors/miner/tests/prove_commit2_failures_test.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/actors/miner/tests/prove_commit2_failures_test.rs b/actors/miner/tests/prove_commit2_failures_test.rs index 8efabb3c7..cfd9a643c 100644 --- a/actors/miner/tests/prove_commit2_failures_test.rs +++ b/actors/miner/tests/prove_commit2_failures_test.rs @@ -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)]);