# `specs-actors` Scenario Testing [Back to Master Tracking Doc](https://hackmd.io/LOZjAsz-THelSD5lWqSVlw) This document tracks an ongoing initiative to come up with scenario tests: * Tests that have NOT been implemented: [[Open Items]](#Open-Items-Have-not-been-implemented) * Tests that have been implemented: [[Closed]](#Closed-No-action-required) ## Contents [TOC] ## Open Items (Have not been implemented) :::info These scenarios have not been implemented ::: #### Miner Alice adds and proves a CC sector Scope: Starts at miner creation, ends after the first PoSt submission for the CC sector. Deals with a single sector's lifetime. Happy path: 1. Alice creates a Miner - Invocation: StoragePower.CreateMiner 2. Alice precommits a CC sector - Invocation: Miner(Alice).PreCommitSector 3. Alice proves the CC sector - Invocation: Miner(Alice).ProveCommitSector 4. Cron actor confirms the proof - Invocation: Cron.EpochTick 5. Alice submits the first PoSt for the sector - Invocation: Miner(Alice).SubmitWindowedPoSt Unhappy paths: - Failing to prove the CC sector on time, resulting in precommit expiry (via Miner(Alice).handleProvingDeadline) - Missing the first PoSt for the sector, resulting in pledge penalty (via Miner(Alice).handleProvingDeadline) - Submitting a PoSt for the containing deadline, but marking the sector "skipped", resulting in pledge penalty (via Miner(Alice).SubmitWindowedPoSt) ## Closed (No action required) :::success These scenarios have been implemented! ::: #### Miner Alice adds and proves a sector (Implemented in [specs-actors/#989](https://github.com/filecoin-project/specs-actors/pull/989)) Scope: Starts at miner creation, ends after the first PoSt submission for the sector. Deals with a single sector's lifetime. Happy path: 1. Alice creates a Miner - Invocation: StoragePower.CreateMiner 2. Alice precommits a sector - Invocation: Miner(Alice).PreCommitSector 3. Alice proves the sector - Invocation: Miner(Alice).ProveCommitSector 4. Cron actor confirms the proof - Invocation: Cron.EpochTick 5. Alice submits the first PoSt for the sector - Invocation: Miner(Alice).SubmitWindowedPoSt Unhappy paths: - Failing to prove the sector on time, resulting in precommit expiry (via Miner(Alice).handleProvingDeadline) - Missing the first PoSt for the sector, resulting in pledge penalty (via Miner(Alice).handleProvingDeadline) - Submitting a PoSt for the containing deadline, but marking the sector "skipped", resulting in pledge penalty (via Miner(Alice).SubmitWindowedPoSt) #### Miner Alice replaces a CC sector with a sector containing deals signed by Bob (Implemented in [specs-actors/#1030](https://github.com/filecoin-project/specs-actors/pull/1030) and [specs-actors/#1034](https://github.com/filecoin-project/specs-actors/pull/1034)) Scope: Starts with Alice having a single proven CC sector, and ends after the first PoSt submission for the replaced sector Happy path: 1. Alice adds funds to StorageMarket - Invocation: StorageMarket.AddBalance 2. Bob adds funds to StorageMarket - Invocation: StorageMarket.AddBalance 3. Alice publishes a set of storage deals signed by Bob to be included in a sector - Invocation: StorageMarket.PublishStorageDeals 4. Alice precommits a sector that replaces the previously-proven CC sector - Invocation: Miner(Alice).PreCommitSector 5. Alice proves the sector - Invocation: Miner(Alice).ProveCommitSector 6. Cron actor confirms the proof - Invocation: Cron.EpochTick 7. Alice submits the first PoSt for the sector - Invocation: Miner(Alice).SubmitWindowedPoSt Unhappy paths: - Failing to prove the replacement sector on time. Results in: - Precommit expiry (via Miner(Alice).handleProvingDeadline) - Deal init timeout (via StorageMarket.CronTick) - Missing the first PoSt for the replacement sector - Submitting a PoSt for the replacement sector's containing deadline, but marking the sector "skipped" #### Miner Alice adds and proves a sector that contains verified deals (Implemented in [specs-actors/#1030](https://github.com/filecoin-project/specs-actors/pull/1030) and [specs-actors/#1034](https://github.com/filecoin-project/specs-actors/pull/1034)) Scope: Starts at miner creation, ends after the first PoSt submission for the sector. Deals with a single sector's lifetime. Happy path: 1. Alice creates a Miner - Invocation: StoragePower.CreateMiner 2. Verifreg `RootKey` adds verifier Xavier to the VerifiedRegistry - Invocation: Verifreg.AddVerifier 3. Verifier Xavier adds verified client Bob to the VerifiedRegistry - Invocation: Verifreg.AddVerifiedClient 4. Alice precommits a sector containing verified deals signed by Bob - Invocation: Miner(Alice).PreCommitSector 5. Alice proves the sector - Invocation: Miner(Alice).ProveCommitSector 6. Cron actor confirms the proof and activates the deal in the Market. - Invocation: Cron.EpochTick 7. Alice submits the first PoSt for the sector - Invocation: Miner(Alice).SubmitWindowedPoSt Unhappy paths: - Alice and Bob publish storage deals that exceed Bob's verified client cap - Failing to prove the sector on time, resulting in precommit expiry (via Miner(Alice).handleProvingDeadline), AND deal init timeout (via Market.CronTick). This should also restore the verified client's bytes. - Missing the first PoSt for the sector, resulting in pledge penalty (via Miner(Alice).handleProvingDeadline) - Submitting a PoSt for the containing deadline, but marking the sector "skipped", resulting in pledge penalty (via Miner(Alice).SubmitWindowedPoSt)