Skip to content

chore: remove mocknet network mode#7155

Open
simone-stacks wants to merge 26 commits into
stacks-network:developfrom
simone-stacks:chore/remove-mocknet
Open

chore: remove mocknet network mode#7155
simone-stacks wants to merge 26 commits into
stacks-network:developfrom
simone-stacks:chore/remove-mocknet

Conversation

@simone-stacks

@simone-stacks simone-stacks commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Description

Mocknet used a simulated in-process burnchain (MocknetController) that's incompatible with Epoch 3 / Nakamoto. No signers, no block proposals, no tenure changes. This PR removes it entirely.

Applicable issues

Additional info (benefits, drawbacks, caveats)

Checklist

  • Test coverage for new or modified code paths
  • For new Clarity features or consensus changes, add property tests (see docs/property-testing.md)
  • Changelog fragment(s) or "no changelog" label added (see changelog.d/README.md)
  • Required documentation changes (e.g., rpc/openapi.yaml for RPC endpoints, event-dispatcher.md for new events)
  • New clarity functions have corresponding PR in clarity-benchmarking repo

@coveralls

coveralls commented Apr 16, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 28582929957

Coverage decreased (-0.02%) to 85.69%

Details

  • Coverage decreased (-0.02%) from the base build.
  • Patch coverage: 19 uncovered changes across 8 files (421 of 440 lines covered, 95.68%).
  • 10192 coverage regressions across 154 files.

Uncovered Changes

File Changed Covered %
stackslib/src/config/mod.rs 69 65 94.2%
stacks-node/src/node.rs 3 0 0.0%
stacks-node/src/run_loop/helium.rs 3 0 0.0%
stackslib/src/chainstate/stacks/db/blocks.rs 306 303 99.02%
stacks-node/src/burnchains/bitcoin_regtest_controller.rs 52 50 96.15%
stacks-node/src/run_loop/mod.rs 2 0 0.0%
stacks-node/src/main.rs 1 0 0.0%
stacks-signer/src/config.rs 4 3 75.0%

Coverage Regressions

10192 previously-covered lines in 154 files lost coverage.

Top 10 Files by Coverage Loss Lines Losing Coverage Coverage
stacks-node/src/node.rs 589 9.7%
stackslib/src/chainstate/stacks/db/blocks.rs 545 89.76%
stackslib/src/chainstate/burn/db/sortdb.rs 505 90.19%
stackslib/src/chainstate/nakamoto/mod.rs 432 84.87%
stackslib/src/net/mod.rs 318 77.88%
stackslib/src/chainstate/stacks/index/storage.rs 277 82.41%
stackslib/src/chainstate/stacks/miner.rs 271 82.96%
stackslib/src/config/mod.rs 271 79.91%
clarity/src/vm/database/clarity_db.rs 268 82.11%
stackslib/src/chainstate/stacks/db/transactions.rs 253 97.15%

Coverage Stats

Coverage Status
Relevant Lines: 226843
Covered Lines: 194381
Line Coverage: 85.69%
Coverage Strength: 19529078.16 hits per line

💛 - Coveralls

@CLAassistant

CLAassistant commented May 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@simone-stacks

simone-stacks commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Worth knowing before reviewing: this isn't a pure deletion, I had to do a couple of non-mechanical things.

Behavior changes

  • burnchain.mode is now required in the config file, no implicit default (was: silently defaulting to mocknet). A config without [burnchain] mode is rejected with Setting burnchain.mode is required (one of: helium, neon, argon, krypton, xenon, mainnet, nakamoto-neon).
  • mode = "mocknet" now fails with a clear "not supported" error instead of panicking. The supported_modes check sat after get_bitcoin_network() (which panics on an unknown mode), so it never fired. Moved it up in into_config_default. This also makes that check reachable for any invalid mode and fixes a network-->mode typo in the message. Signer side already rejected network = "mocknet" cleanly.

Test rework (the slightly out-of-scope part)
mocknet was the only in-process burnchain. Ten tests ran on the helium runloop via the mocknet default and were silently leaning on it. They'd hang once it's gone (no bitcoind), so rather than leave CI red:

  • deleted 7 already covered elsewhere (neon/nakamoto integration, block_construction units, net/api unit tests)
  • ported the 3 with unique coverage to bitcoind-free stackslib unit tests: mempool_will_admit_tx_rejection_matrix (the mempool admission rejection matrix), mempool_rejection_into_json (the /v2/transactions rejection wire format) and test_iterate_candidates_nonce_gap_hold_and_release (mempool nonce-gap hold-and-release)
  • integrations.rs and mempool.rs were empty after that, so they're removed

[It's isolated in the (test: commit a86f765)]

helium removal is a separate (in-draft) follow-up: #7325

@simone-stacks
simone-stacks marked this pull request as ready for review June 16, 2026 14:01

@federico-stacks federico-stacks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Added a couple of considerations

Comment thread stackslib/src/config/mod.rs
Comment thread stackslib/src/config/mod.rs Outdated
Comment thread stacks-node/src/run_loop/helium.rs Outdated
Comment thread stackslib/src/config/mod.rs Outdated

@federico-stacks federico-stacks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heads-up: there are some conflicts to be addressed

@benjamin-stacks benjamin-stacks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted eight already covered elsewhere

Since you've already done that investigation, can you add PR comments to the individual removed tests that show where that separate coverage is?

Comment thread stacks-node/src/burnchains/bitcoin_regtest_controller.rs
Comment thread stacks-node/src/run_loop/helium.rs
Comment thread stacks-node/src/node.rs
Comment thread stacks-node/src/tenure.rs
Comment thread stackslib/src/config/mod.rs Outdated
@simone-stacks

simone-stacks commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

deleted eight already covered elsewhere

Since you've already done that investigation, can you add PR comments to the individual removed tests that show where that separate coverage is?

Sure, with 7f7a1fc the final count is 3 ported and 7 removed:

  • 3 ported: coverage that was unique moved to new bitcoind-free stackslib unit tests.
  • 7 deleted: the behavior is already tested elsewhere (all covering tests pre-exist on develop).

Ported (3)

Removed New test
mempool_setup_chainstate mempool_will_admit_tx_rejection_matrix in db/blocks.rs (full mempool admission-rejection matrix; net-new probes vs the original: TooMuchChaining, and wrong-chain-id added in a92e94a)
mempool_errors mempool_rejection_into_json in db/blocks.rs (/v2/transactions rejection JSON: txid, error, reason, reason_data)
mine_transactions_out_of_order test_iterate_candidates_nonce_gap_hold_and_release in core/tests/mod.rs (future-nonce txs held while the gap exists, all released in nonce order once it fills; in-block nonce ordering was already covered by the block_construction.rs nonce-order tests)

Deleted (7), where each is now tested

Removed test Now tested by
integration_test_get_info one handler unit test per endpoint it queried, in stackslib/src/net/api/tests/: getaccount, getmapentry, callreadonly, getcontractabi, getcontractsrc, getstxtransfercost, postfeerate, posttransaction, getistraitimplemented
contract_stx_transfer stx to a contract principal, as-contract out, balances: clarity/src/vm/tests/assets.rs::test_native_stx_ops; duplicate-nonce rejection: core/tests/mod.rs::mempool_do_not_replace_tx
block_limit_runtime_test block_construction.rs::test_build_anchored_blocks_skip_too_expensive (runtime-dimension unit test, runs on every PR) plus neon_integrations.rs::block_limit_hit_integration_test_* (note*)
should_succeed_mining_valid_txs consensus.rs::test_successfully_deploy, test_successfully_deploy_and_call; transfers in block_construction.rs::test_build_anchored_blocks_stx_transfers_single; event fields in events.rs::test_emit_print_ok and test_emit_stx_transfer_ok (the consensus.rs snapshots cover tx processing, not events)
mine_contract_twice re-publish rejection: block level in static_analysis_tests.rs::error_invalid_stacks_transaction_duplicate_contract, mempool level in the ported matrix; deploy in one tenure, call in later tenures: block_construction.rs::test_contract_call_across_clarity_versions
bad_contract_tx_rollback invalid-tx skip during assembly: block_construction.rs::test_build_anchored_blocks_invalid; ordering skips: test_build_anchored_blocks_bad_nonces; problematic-tx path: test_is_tx_problematic; duplicate-publish rejection: the same static_analysis_tests.rs test and the ported matrix
should_succeed_handling_malformed_and_valid_txs valid mining: block_construction.rs; wrong network version and wrong chain-id rejected at the mempool gate: the ported matrix

Paths: block_construction.rs is stackslib/src/chainstate/stacks/tests/, consensus.rs and static_analysis_tests.rs are stackslib/src/chainstate/tests/, neon_integrations.rs is stacks-node/src/tests/, db/blocks.rs is stackslib/src/chainstate/stacks/db/, core/tests/mod.rs is stackslib/src/core/tests/, events.rs is stackslib/src/clarity_vm/tests/.

*Note: the neon tests stress the read_count dimension -- the removed test stressed runtime. Enforcement is one dimension-generic check (ExecutionCost::exceeds compares all five dimensions in the same function), so the runtime path is the same code. Additionally, test_build_anchored_blocks_skip_too_expensive exercises the runtime dimension directly in every-PR CI: verified at the rejection point, the cost vector shows runtime only, with all four storage dimensions at 0.

federico-stacks
federico-stacks previously approved these changes Jul 2, 2026
@benjamin-stacks

Copy link
Copy Markdown
Contributor

scheduled a call with @simone-stacks on Monday to review the test changes sync

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants