Skip to content

test(devnet): integration test for the miner window PoSt - #7820

Merged
akaladarshi merged 3 commits into
akaladarshi/state-miner-power-parityfrom
akaladarshi/miner-wdpost
Nov 5, 2026
Merged

akaladarshi merged 3 commits into
akaladarshi/state-miner-power-parityfrom
akaladarshi/miner-wdpost

Conversation

@akaladarshi

@akaladarshi akaladarshi commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

Changes introduced in this pull request:

  • Adds the devnet test for the lotus miner window post integration with forest

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 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.

Outside contributions

  • This pull request is based on an issue that a maintainer has accepted (see Before Opening a Pull Request).
  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Tests
    • Added a devnet test covering Window PoSt submission, execution, proof details, sector status, miner power, and dispute outcomes across both nodes.
    • The miner test command and CI workflow now include the wdpost test group alongside onboarding.

@akaladarshi
akaladarshi added this pull request to stack #7817 October 30, 2026 07:06
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

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.
Wdpost test-group wiring
src/dev/subcommands/devnet_cmd/miner.rs, .github/workflows/miner-tests.yml
Adds the Wdpost test group, routes it to wdpost::tests(), and includes it in the miner test workflow matrix.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

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.

Suggested reviewers: sudo-shashank, eclesiomelojunior

Merge Risk: Minimal · previous review 4d288

The added devnet test is mergeable, with normal test execution still appropriate before landing.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Linked Issues check Warning 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 Warning 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 Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed 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.

@akaladarshi
akaladarshi force-pushed the akaladarshi/miner-wdpost branch from 97b10bb to 874785b Compare October 30, 2026 07:07
@akaladarshi
akaladarshi force-pushed the akaladarshi/miner-wdpost branch 2 times, most recently from c3e6f2e to 2ef897d Compare November 3, 2026 11:47
@akaladarshi
akaladarshi marked this pull request as ready for review November 3, 2026 11:47
@akaladarshi
akaladarshi requested a review from a team as a code owner November 3, 2026 11:47
@akaladarshi
akaladarshi requested review from EclesioMeloJunior and LesnyRumcajs and removed request for a team November 3, 2026 11:47
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ 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.

Files with missing lines Patch % Lines
src/dev/subcommands/devnet_cmd/miner/wdpost.rs 0.00% 166 Missing ⚠️
src/dev/subcommands/devnet_cmd/miner/devnet.rs 0.00% 24 Missing ⚠️
src/dev/subcommands/devnet_cmd/miner.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
src/rpc/types/mod.rs 86.56% <ø> (ø)
src/shim/actors/builtin/miner/mod.rs 31.93% <100.00%> (+3.73%) ⬆️
src/dev/subcommands/devnet_cmd/miner.rs 0.00% <0.00%> (ø)
src/dev/subcommands/devnet_cmd/miner/devnet.rs 0.00% <0.00%> (ø)
src/dev/subcommands/devnet_cmd/miner/wdpost.rs 0.00% <0.00%> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1562afe...362d622. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@akaladarshi
akaladarshi force-pushed the akaladarshi/miner-wdpost branch from 0b5ba60 to 4d28864 Compare November 4, 2026 07:02
@akaladarshi
akaladarshi force-pushed the akaladarshi/miner-wdpost branch from 4d28864 to 362d622 Compare November 4, 2026 13:04
@akaladarshi
akaladarshi added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 7ee22b1 Nov 5, 2026
42 checks passed
@akaladarshi
akaladarshi deleted the akaladarshi/miner-wdpost branch November 5, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Miner Integration Test: WindowPoSt through Forest is valid and keeps power

2 participants