You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test(devnet): integration test for the miner window PoSt - #7820
sequenceDiagram
autonumber
participant T as Trial (forest-dev)
participant F as Forest (under test)
participant L as Lotus (validator)
participant M as lotus-miner
participant A as miner actor t01000
Note over T,A: epoch 42, before the deadline
T->>F: StateMinerInfo, StateMinerPower, StateMinerProvingDeadline, StateMinerDeadlines, StateMinerPartitions(d) for d = 0..47
T->>L: the same calls at the same tipset, answers must be equal
Note over T: keeps proof type, power, the first deadline with live sectors (0) and its partitions<br/>deadline 0 of the next period: challenge 638, open 658, close 718
T->>F: wait_for_epoch(718), one ChainHead per block delay
Note over F,M: epoch 639, lotus-miner proves by itself (challenge + 1)
M->>F: StateGetRandomnessFromBeacon(WindowedPoStChallengeSeed, 638, cbor(t01000))
M->>F: StateMinerPartitions(0), StateMinerSectors(live), StateNetworkVersion
M->>M: generate and self-verify the window PoSt for partition 0 (2 sectors)
Note over F,M: epoch 662, open + 4
M->>F: StateGetRandomnessFromTickets(PoStChainCommit, 638)
M->>F: WalletHas, WalletBalance, gas estimate, MpoolPushMessage(SubmitWindowedPoSt deadline 0, partitions [0], commit epoch 638, commit rand)
F->>F: signs with the worker key from its keystore, nonce, mpool
M->>F: MinerCreateBlock for 664 includes it, SyncSubmitBlock
F->>A: executes it, exit 0, proof stored unverified
F-->>L: block gossiped, Lotus validates it, same receipt
Note over A: epoch 717, cron at the deadline's last epoch<br/>snapshots the proof (disputable), faults any unproven partition
Note over T,A: epoch 718, the trial resumes
T->>F: StateListMessages(to t01000, back to 658), ChainGetMessage each, exactly one SubmitWindowedPoSt for deadline 0
T->>L: the same, equal
T->>F: StateSearchMsg(PoSt), receipt exit 0 (Lotus equal)
Note over T: asserts: exit 0, partitions == [0..n), proof type == MinerInfo's,<br/>commit rand == StateGetRandomnessFromTickets(638) answered by both nodes
T->>F: StateMinerSectors(live), StateNetworkVersion, StateGetRandomnessFromBeacon(638), Lotus equal
T->>F: poll StateMinerDeadlines until deadline 0 has a disputable proof (Lotus equal)
T->>F: StateMinerFaults is empty, StateMinerPower equals the start (Lotus equal)
Note over T,A: the dispute, the only step that verifies the proof
T->>F: StateCall(DisputeWindowedPoSt deadline 0, post 0), exit 16 "failed to dispute valid post"
T->>L: the same StateCall, identical receipt and text
T->>F: MpoolPushMessage(dispute, gas = simulated x 1.3) from the funded test wallet
F->>A: epoch 720, VM re-verifies the proof with the real randomness, exit 16, state unchanged
F-->>L: Lotus validates the block
T->>F: StateWaitMsg, then StateSearchMsg on both nodes, exit 16
T->>L: ChainGetTipSetByHeight(720) equals Forest's head
Loading
Change checklist
I have performed a self-review of my own code,
I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
I have added tests that prove my fix is effective or that my feature works (if possible),
I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Essentials
Run ID: c3e574a4-a031-4121-be4e-4e243752c334
Commits
Reviewing files that changed from the base of the PR and between 4d28864 and 362d622.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The miner devnet tests now include a WindowPoSt integration test. The test checks proof execution and miner state on Forest and Lotus, then checks dispute simulation and submission. Supporting changes add deadline and message lookup helpers and expose live-sector data.
Changes
WindowPoSt devnet integration test
Layer / File(s)
Summary
Deadline and devnet test support src/rpc/types/mod.rs, src/shim/actors/builtin/miner/mod.rs, src/dev/subcommands/devnet_cmd/miner/devnet.rs
Exposes MinerPartitions.live_sectors, adds DeadlineInfo::for_index and its test, and adds Devnet::wait_for_epoch and Devnet::executed.
WindowPoSt validation and dispute test src/dev/subcommands/devnet_cmd/miner/wdpost.rs
Adds a test that checks the submitted PoSt, partition coverage, proof details, miner power, and dispute results. Helpers locate a live deadline and require exactly one matching submission.
sequenceDiagram
participant Test as WindowPoSt devnet test
participant Forest
participant Lotus
Test->>Forest: Check PoSt execution and miner state
Test->>Lotus: Check PoSt execution and miner state
Test->>Forest: Simulate and submit dispute
Test->>Lotus: Simulate dispute
Loading
Possibly related issues
Issue 7669, “Additional devnet checks for Lotus-Miner integration”: this PR adds a devnet miner integration test for WindowPoSt.
Possibly related PRs
ChainSafe/forest#7807: establishes the miner integration command and harness that this PR extends with the wdpost group and test.
ChainSafe/forest#7815: provides the Devnet::synced and At::same flow used alongside the new Devnet helpers.
ChainSafe/forest#7816: changes the StateMinerPower contract used by the test’s power assertions.
The added devnet test is mergeable, with normal test execution still appropriate before landing.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Linked Issues check
Issue #7789 has coding requirements. The new valid_post_keeps_power test in src/dev/subcommands/devnet_cmd/miner/wdpost.rs implements most of them: first live deadline selection (`first_live_deadl…
(1) In valid_post_keeps_power, assert that info.window_post_proof_type equals RegisteredPoStProof::StackedDRGWindow2KiBV1P1 and that each submitted proof type equals it, in addition to the existing match check. (2) Show the mutation c…
Docstring Coverage
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 3 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "test(devnet): integration test for the miner window PoSt" matches the main change. The PR adds a devnet integration test (wdpost.rs) for the genesis miner's window PoSt, plus supporting hel…
Out of Scope Changes check
All changed areas support #7789. src/dev/subcommands/devnet_cmd/miner/wdpost.rs holds the new test. devnet.rs adds wait_for_epoch and executed, which the test calls. miner.rs registers the `…
Full details: Title check
Explanation
The title "test(devnet): integration test for the miner window PoSt" matches the main change. The PR adds a devnet integration test (wdpost.rs) for the genesis miner's window PoSt, plus supporting helpers in devnet.rs, a Wdpost group in the miner test command, and DeadlineInfo::for_index. The title is specific and conventional, and it does not describe anything absent from the changeset.
Full details: Out of Scope Changes check
Explanation
All changed areas support #7789. src/dev/subcommands/devnet_cmd/miner/wdpost.rs holds the new test. devnet.rs adds wait_for_epoch and executed, which the test calls. miner.rs registers the wdpost group. .github/workflows/miner-tests.yml runs the wdpost group. src/rpc/types/mod.rs makes MinerPartitions.live_sectors public, which the test reads. src/shim/actors/builtin/miner/mod.rs adds DeadlineInfo::for_index, which the test uses to select the target deadline. No unrelated behavior change appears in the PR summary or file list.
Full details: Linked Issues check
Explanation
Issue #7789 has coding requirements. The new valid_post_keeps_power test in src/dev/subcommands/devnet_cmd/miner/wdpost.rs implements most of them: first live deadline selection (first_live_deadline), cross-node equality checks through at.same, PoSt discovery (submitted_post, exactly one match), exit code 0, partition coverage, proof type matching against StateMinerInfo.window_post_proof_type, commit randomness, disputable proof polling, empty faults, unchanged power, StateCall before the on-chain dispute, and exit code 16 on chain through Forest (net.executed). Two requirements are not fully met. (1) The proof type check compares each proof with info.window_post_proof_type only. It does not assert the value StackedDRGWindow2KiBV1P1 that #7789 names. (2) The mutation check has no implementation or reported run. No file in the PR changes the StateGetRandomnessFromBeacon handler. The dispute assertion would fail under that mutation, but the PR does not show that the test fails when the mutation is applied.
Resolution
(1) In valid_post_keeps_power, assert that info.window_post_proof_type equals RegisteredPoStProof::StackedDRGWindow2KiBV1P1 and that each submitted proof type equals it, in addition to the existing match check. (2) Show the mutation check result: apply the fixed-wrong-bytes StateGetRandomnessFromBeacon mutation to the Forest handler (VM randomness unchanged), run the test, and confirm it fails. Record the result in the PR. A permanent mutation harness is not required unless the team wants one.
Full details: Docstring Coverage
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 5 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Simplify code
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Essentials
Run ID: 61f8cd83-48b2-4441-b326-b05454957480
Commits
Reviewing files that changed from the base of the PR and between 2ef897d and 4d28864.
Files selected for processing: 1
src/dev/subcommands/devnet_cmd/miner/devnet.rs
Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.
❌ Patch coverage is 9.04762% with 191 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.64%. Comparing base (1562afe) to head (362d622).
✅ All tests successful. No failed tests found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #7789
Other information and links
sequenceDiagram autonumber participant T as Trial (forest-dev) participant F as Forest (under test) participant L as Lotus (validator) participant M as lotus-miner participant A as miner actor t01000 Note over T,A: epoch 42, before the deadline T->>F: StateMinerInfo, StateMinerPower, StateMinerProvingDeadline, StateMinerDeadlines, StateMinerPartitions(d) for d = 0..47 T->>L: the same calls at the same tipset, answers must be equal Note over T: keeps proof type, power, the first deadline with live sectors (0) and its partitions<br/>deadline 0 of the next period: challenge 638, open 658, close 718 T->>F: wait_for_epoch(718), one ChainHead per block delay Note over F,M: epoch 639, lotus-miner proves by itself (challenge + 1) M->>F: StateGetRandomnessFromBeacon(WindowedPoStChallengeSeed, 638, cbor(t01000)) M->>F: StateMinerPartitions(0), StateMinerSectors(live), StateNetworkVersion M->>M: generate and self-verify the window PoSt for partition 0 (2 sectors) Note over F,M: epoch 662, open + 4 M->>F: StateGetRandomnessFromTickets(PoStChainCommit, 638) M->>F: WalletHas, WalletBalance, gas estimate, MpoolPushMessage(SubmitWindowedPoSt deadline 0, partitions [0], commit epoch 638, commit rand) F->>F: signs with the worker key from its keystore, nonce, mpool M->>F: MinerCreateBlock for 664 includes it, SyncSubmitBlock F->>A: executes it, exit 0, proof stored unverified F-->>L: block gossiped, Lotus validates it, same receipt Note over A: epoch 717, cron at the deadline's last epoch<br/>snapshots the proof (disputable), faults any unproven partition Note over T,A: epoch 718, the trial resumes T->>F: StateListMessages(to t01000, back to 658), ChainGetMessage each, exactly one SubmitWindowedPoSt for deadline 0 T->>L: the same, equal T->>F: StateSearchMsg(PoSt), receipt exit 0 (Lotus equal) Note over T: asserts: exit 0, partitions == [0..n), proof type == MinerInfo's,<br/>commit rand == StateGetRandomnessFromTickets(638) answered by both nodes T->>F: StateMinerSectors(live), StateNetworkVersion, StateGetRandomnessFromBeacon(638), Lotus equal T->>F: poll StateMinerDeadlines until deadline 0 has a disputable proof (Lotus equal) T->>F: StateMinerFaults is empty, StateMinerPower equals the start (Lotus equal) Note over T,A: the dispute, the only step that verifies the proof T->>F: StateCall(DisputeWindowedPoSt deadline 0, post 0), exit 16 "failed to dispute valid post" T->>L: the same StateCall, identical receipt and text T->>F: MpoolPushMessage(dispute, gas = simulated x 1.3) from the funded test wallet F->>A: epoch 720, VM re-verifies the proof with the real randomness, exit 16, state unchanged F-->>L: Lotus validates the block T->>F: StateWaitMsg, then StateSearchMsg on both nodes, exit 16 T->>L: ChainGetTipSetByHeight(720) equals Forest's headChange checklist
Outside contributions
Summary by CodeRabbit
wdposttest group alongsideonboarding.