Skip to content

Conversation

@arvidn
Copy link
Contributor

@arvidn arvidn commented Nov 26, 2025

Purpose:

This PR adds support for v2 plots to chia-blockchain, activating at the hard fork height (which is still set to a place-holder).

These changes are best reviewed one commit at a time.

A good starting point is for getting a sense of these changes is chia/plotting/prover.py, which defines the interface to the "Prover". This reads plot files and finds proofs of space, used by the farmer.

The main updates can be summarized as:

  • update the chia-pos2 interface (the Prover) for the latest revision of PoS 2. The new interface is simpler in that the Partial Proof is read in full for computing the quality and potentially solving. This is now similar to the original chiapos.
  • add support for creating v2 plots in BlockTools (the core of the simulator)
  • add two new ConsensusMode enum values to the test fixture. This will make many of our tests run two more times covering the v1 phase-out and v2-only chains.
  • fixing tests to work with v2 plots. The main issue is that v2 plots don't support a pool key, so pool rewards can't be redirected. Pool rewards can only be paid to a puzzle embedded in the plot itself. Many tests redirect both the farmer reward and the pool reward, so the change is to rely only on the farmer reward, at least after the hard fork activation.
  • disabling tests that depend on the pool reward redirect, to be fixed later. These are also marked with the todo_v2_plots keyword, to make them easy to find and identify.
  • Disable tests that fail with the new chain for unknown reason. These will need to be revisited once this PR lands. They are all marked with a todo_v2_plots comment.

Current Behavior:

  • We don't have any tests covering the 3.0 hard fork

New Behavior:

  • We run most existing tests on the 3.0 hard fork as well as the hard fork chain after v1 plots have been phased-out.

Testing

Test chains

Since the test fixtures now have two more parameters, all of our test chains are generated in two more versions.

  1. After 3.0 hard fork activation
  2. After v1 plot phase-out (i.e. where only v2 plots are valid)

The test chains are generated by test fixtures, so automatically by running a test that references one of these fixtures. The test plots are cached in ~/.chia/blocks to be re-used across test runs. The longer chains can take quite a while to generate.

Test plots

We also have new v2 test plots. v2 test plots are k-18 and about 700kB each. In order to have a somewhat even netspace compared to the existing v1 test plots, we have 150 v2 plots (vs. 20 v1 plots). These test plots are generated by running the tests that set up the BlockTools simulation. They are cached in ~/.chia/test-plots to be re-used across test runs.

To run tests locally, you need the new test plots and chains. You can either generate them or download them from the test-cache repository.

Generating them takes at least 1 hour on a fast machine. It can be quite CPU and memory intensive, so you may limit the number of parallel jobs to a few fewer than cores on the machine (using -n).

pytest chia/_tests/blockchain/test_build_chains.py

You can download them from the test-cache repository. Here: Chia-Network/test-cache#23

Backwards compatibility

Some of our tests depend on exactly the test plots we use, and the number of them. So when you update your ~/.chia/plots to include the new plots, you may need to clear and reset that directory if you want to move back to main (until this PR lands).

BlockTools will check that the number of test plots it picked up is exactly the number we expect. This adds some friction to switching back and forth between this PR and main, for testing.


Note

Introduce PoS v2 plots end‑to‑end (prover/plotting→harvester/farmer/solver), add new consensus modes including HF3 and post phase‑out, and update simulator/tests, constants, CI, and deps accordingly.

  • Consensus & Plotting:
    • Implement PoS v2: new V2Prover API (get_qualities_for_challenge() without filter), V2Quality carries partial proof, and updated PartialProof fields.
    • Add create_v2_plots() and generate v2 plots in BlockTools; include v2 in simulator startup.
    • Extend test consensus modes (PLAIN, HARD_FORK_2_0, HARD_FORK_3_0, HARD_FORK_3_0_AFTER_PHASE_OUT) with per‑mode constants and difficulty tweaks; adjust filter bits and remove QUALITY_PROOF_SCAN_FILTER usage.
    • Reward logic updated post‑HF3 (no redirected pool rewards); various validation paths updated to new RS API.
  • Harvester/Farmer/Solver:
    • Harvester now reads v2 qualities and builds PartialProofsData; Farmer requests solves; Solver produces full proofs; logs/messages use fragments.
  • Simulator:
    • Farm/reward calculations honor hard‑fork boundaries; increased timeouts; include many v2 plots for balanced netspace.
  • Tests:
    • Broad updates for HF3/v2 behavior: add limit_consensus_modes marks, adjust expectations (rewards, generator refs, pool keys), tweak parameters/timeouts, and regenerate per‑mode test chains/filenames.
  • CI & Deps:
    • Bump BLOCKS_AND_PLOTS_VERSION to 0.45.1; upgrade chia_rs to 0.36.0; increase various test job timeouts.

Written by Cursor Bugbot for commit f06ebdf. This will update automatically on new commits. Configure here.

@arvidn arvidn added the Changed Required label for PR that categorizes merge commit message as "Changed" for changelog label Nov 26, 2025
@arvidn arvidn changed the title Pos2 simulations proof-of-space v2 support Nov 26, 2025
@arvidn arvidn force-pushed the pos2-simulations branch 3 times, most recently from 1e6d6bc to 686e568 Compare December 2, 2025 14:34
@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Dec 2, 2025
@arvidn arvidn force-pushed the pos2-simulations branch 2 times, most recently from 5513836 to 3410782 Compare December 3, 2025 02:01
@github-actions github-actions bot removed the merge_conflict Branch has conflicts that prevent merge to main label Dec 3, 2025
@arvidn arvidn force-pushed the pos2-simulations branch 2 times, most recently from 2dd5d58 to e7ac280 Compare December 3, 2025 23:32
@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Dec 11, 2025
@github-actions github-actions bot added merge_conflict Branch has conflicts that prevent merge to main and removed merge_conflict Branch has conflicts that prevent merge to main labels Dec 15, 2025
@github-actions github-actions bot removed the merge_conflict Branch has conflicts that prevent merge to main label Dec 15, 2025
@arvidn arvidn marked this pull request as ready for review December 16, 2025 01:45
@arvidn arvidn requested review from a team as code owners December 16, 2025 01:45
@arvidn arvidn marked this pull request as draft December 16, 2025 01:46
…changed. There is no quality proof scan filter
@arvidn arvidn marked this pull request as ready for review December 16, 2025 11:54
@arvidn arvidn changed the title proof-of-space v2 support [CHIA-3649][CHIA-3657][CHIA-3732] proof-of-space v2 support Dec 16, 2025
@arvidn arvidn changed the title [CHIA-3649][CHIA-3657][CHIA-3732] proof-of-space v2 support [CHIA-3649][CHIA-3657][CHIA-3732][CHIA-3666] proof-of-space v2 support Dec 16, 2025
@coveralls-official
Copy link

coveralls-official bot commented Dec 16, 2025

Pull Request Test Coverage Report for Build 20299025915

Details

  • 261 of 275 (94.91%) changed or added relevant lines in 39 files are covered.
  • 33 unchanged lines in 11 files lost coverage.
  • Overall coverage increased (+0.08%) to 90.878%

Changes Missing Coverage Covered Lines Changed/Added Lines %
chia/_tests/blockchain/config.py 0 1 0.0%
chia/_tests/core/full_node/config.py 0 1 0.0%
chia/_tests/core/mempool/config.py 0 1 0.0%
chia/harvester/harvester_api.py 1 3 33.33%
chia/plotting/create_plots.py 28 30 93.33%
chia/simulator/block_tools.py 31 33 93.94%
chia/solver/solver_api.py 1 3 33.33%
chia/plotting/check_plots.py 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
chia/full_node/full_node_api.py 1 86.82%
chia/full_node/full_node.py 1 87.31%
chia/harvester/harvester_api.py 1 61.89%
chia/plotting/check_plots.py 1 0.0%
chia/_tests/simulation/test_simulation.py 1 96.55%
chia/wallet/util/wallet_sync_utils.py 1 85.57%
chia/consensus/block_header_validation.py 2 94.23%
chia/wallet/wallet_node.py 3 86.69%
chia/_tests/harvester/test_harvester_api.py 4 95.45%
chia/introducer/introducer_api.py 5 81.48%
Totals Coverage Status
Change from base Build 20242846771: 0.08%
Covered Lines: 103045
Relevant Lines: 113223

💛 - Coveralls

@github-actions
Copy link
Contributor

File Coverage Missing Lines
chia/harvester/harvester_api.py 33.3% lines 169, 205
chia/plotting/check_plots.py 0.0% lines 180, 225, 228
chia/plotting/create_plots.py 93.3% lines 307, 321
chia/simulator/block_tools.py 93.9% lines 682-683
chia/solver/solver_api.py 33.3% lines 50, 60
Total Missing Coverage
272 lines 11 lines 95%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changed Required label for PR that categorizes merge commit message as "Changed" for changelog coverage-diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant