Skip to content

split blockchain test group into two parallel CI jobs#20634

Draft
emlowe wants to merge 1 commit intomainfrom
split-blockchain-tests
Draft

split blockchain test group into two parallel CI jobs#20634
emlowe wants to merge 1 commit intomainfrom
split-blockchain-tests

Conversation

@emlowe
Copy link
Contributor

@emlowe emlowe commented Mar 9, 2026

Summary

  • Split the blockchain test group (~60 min wall time) into two separate CI jobs (blockchain.validation and blockchain.transactions) by creating subdirectories under chia/_tests/blockchain/
  • Extracted TestBodyValidation (941 parametrized test instances, 60% of total work) from test_blockchain.py into a new test_blockchain_body_validation.py file
  • Estimated critical path reduction from ~60 min to ~40-45 min

Details

The blockchain test group was the longest-running CI job. Analysis of job 65991611992 showed that test_blockchain.py alone contained 87% of all test instances (1362/1566), with TestBodyValidation being the dominant class (941 instances spanning the entire 58-min run).

A simple file-level split would not help because test_blockchain.py dwarfs all other files. Instead, TestBodyValidation was extracted into its own file and placed in a transactions/ subdirectory alongside test_blockchain_transactions.py and test_build_chains.py.

New groups:

Group Tests Est. time
blockchain.validation ~422 ~25-30 min
blockchain.transactions ~1144 ~40-45 min

CI results

Before vs after (macOS Intel, slowest platform)

Baseline from 10 most recent merged PRs (single blockchain group):

PR Time
#20632 1h 6m
#20629 56m
#20627 1h 5m
#20626 1h 15m
#20625 55m
#20624 58m
#20623 1h 12m
#20621 1h 8m
#20619 1h 1m
#20615 1h 25m
Average ~1h 4m

This PR (critical path = max of the two groups):

Group Time
blockchain.transactions 49m 48s
blockchain.validation 13m 42s
Critical path 49m 48s

macOS Intel improvement: ~1h 4m -> ~50m (22% faster)

All platforms

Platform transactions validation Critical path Baseline avg Improvement
macos-intel 49m 48s 13m 42s 49m 48s ~1h 4m ~22%
macos-arm 36m 30s 17m 13s 36m 30s ~42m 40s ~14%
ubuntu-intel 49m 44s 25m 43s 49m 44s - -
ubuntu-arm 31m 59s 16m 45s 31m 59s ~46m 41s ~31%
windows 35m 16s 23m 11s 35m 16s - -

Test plan

  • CI passes on all platforms (the two new blockchain groups appear in the matrix)
  • blockchain.validation and blockchain.transactions both complete successfully
  • Old blockchain group no longer appears
  • Total test count unchanged (1623 tests collected in both old and new structures)
  • Check actual timing improvement after CI run

The blockchain test group takes ~60 min because test_blockchain.py
contains 87% of all test instances (1362/1566). Split into two
subdirectories so build-job-matrix.py creates separate CI jobs:

- blockchain.validation (~422 tests): TestBlockHeaderValidation,
  TestGenesisBlock, TestPreValidation, TestReorgs, standalone tests,
  plus test_augmented_chain, test_get_block_generator, test_lookup_fork_chain

- blockchain.transactions (~1144 tests): TestBodyValidation (extracted
  to new file), test_blockchain_transactions, test_build_chains

Estimated critical path reduction: ~60 min -> ~40-45 min.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is kicking off a free cloud agent to fix this issue. This run is complimentary, but you can enable autofix for all future PRs in the Cursor dashboard.

@emlowe emlowe added CI CI changes Changed Required label for PR that categorizes merge commit message as "Changed" for changelog Exclude_Notes Use this label if the changes in the PR should be excluded from the release notes labels Mar 9, 2026
@github-actions
Copy link
Contributor

File Coverage Missing Lines
chia/_tests/blockchain/transactions/test_blockchain_body_validation.py 99.8% lines 124
Total Missing Coverage
632 lines Unknown 99%

@arvidn
Copy link
Contributor

arvidn commented Mar 17, 2026

moving these files seems a little bit risky. Any in-flight PRs could break. I would hope there's a way to make the workflow be split up instead.

@github-actions github-actions bot added the merge_conflict Branch has conflicts that prevent merge to main label Mar 17, 2026
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 CI CI changes coverage-diff Exclude_Notes Use this label if the changes in the PR should be excluded from the release notes merge_conflict Branch has conflicts that prevent merge to main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants