Skip to content

feat: enable BLOCKS-only stream mode support#25612

Open
petreze wants to merge 24 commits into
mainfrom
test-ci
Open

feat: enable BLOCKS-only stream mode support#25612
petreze wants to merge 24 commits into
mainfrom
test-ci

Conversation

@petreze
Copy link
Copy Markdown
Contributor

@petreze petreze commented May 26, 2026

Description:
Adds full support for running the consensus node with blockStream.streamMode=BLOCKS, where only block stream files are produced — no legacy V6 record files. This PR does not change the production default; it switches the default in test configuration to validate that all code paths work correctly when streamMode=BLOCKS is eventually enabled in production.
Test config changes: streamMode=BLOCKS, writerMode=FILE, streamWrappedRecordBlocks=false

Production Changes

  • Smart contract handlers: Guard legacy method calls with streamMode != BLOCKS, using block-native alternatives (addInitcode, addActions, addContractSlotUsages)
  • TransactionExecutors: Reads streamMode from config; HandleOutput.singleTransactionRecords() provides unified List<SingleTransactionRecord> via BlockRecordSource.precomputedRecords() in BLOCKS mode
  • QueryContextImpl: Sources block info from BlockStreamInfo state in BLOCKS mode instead of the unmaintained legacy BlockInfo singleton
  • StreamValidationOp: Skips record stream file validation in BLOCKS mode

Test Infrastructure

  • Unified streamMust* DSL verbs replace recordStreamMust* and blockStreamMust* — dynamically route to record or block stream based on streamMode via StreamAssertion marker interface
  • RecordStreamToBlockAssertionAdapter: Translates block items to RecordStreamItem for existing validators; lenient mode suppresses translation-fidelity errors in no-failures assertions
  • SidecarWatcher.forSpec(): Factory method auto-selects V6 sidecar files or block-derived sidecars based on streamMode
  • EventualStreamAssertion: Supports replay, stop-after-first-success, and timeout propagation across both stream paths
    Test Changes

All recordStreamMust* and blockStreamMust* usages migrated to streamMust* across ~20 test files
12 new BLOCKS-mode unit tests verify block-native code paths
Existing unit tests that verify legacy behavior explicitly set streamMode=BOTH in config
Removed overriding("blockStream.streamMode", "BOTH") calls from subprocess tests — these corrupt the shared network config without affecting the cached HandleWorkflow.streamMode
WrappedRecordHashesFlagUpgradeSubprocessTest skips in BLOCKS mode (WRB requires record stream)

Related issue(s):

Fixes #25646

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@petreze petreze self-assigned this May 26, 2026
@petreze petreze requested review from a team and tinker-michaelj as code owners May 26, 2026 09:50
@petreze petreze requested a review from PavelSBorisov May 26, 2026 09:50
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented May 26, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@lfdt-bot
Copy link
Copy Markdown

lfdt-bot commented May 26, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

Node: HAPI Test (Misc) Results

  157 files  ± 0      1 errors  156 suites   - 1   1h 13m 14s ⏱️ - 11m 0s
  174 tests  -  1    172 ✅  -  1  2 💤 ±0  0 ❌ ±0 
1 168 runs   - 38  1 166 ✅  - 38  2 💤 ±0  0 ❌ ±0 

For more details on these parsing errors, see this check.

Results for commit 69b5b6a. ± Comparison against base commit f3f6ed6.

This pull request removes 1 test.
com.hedera.services.bdd.suites.contract.leaky.LeakyContractTestsSuite ‑ as written

♻️ This comment has been updated with latest results.

@petreze petreze requested review from a team as code owners May 27, 2026 17:32
@petreze petreze requested a review from mxtartaglia-sl May 27, 2026 17:32
@petreze petreze marked this pull request as draft May 27, 2026 17:33
@petreze petreze removed request for a team, PavelSBorisov and mxtartaglia-sl May 27, 2026 19:38
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
@petreze petreze marked this pull request as ready for review May 27, 2026 19:41
petreze added 2 commits May 27, 2026 22:56
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 43.47826% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...era/node/app/records/impl/BlockStreamInfoImpl.java 0.00% 14 Missing ⚠️
...edera/node/app/blocks/impl/BlockStreamBuilder.java 0.00% 5 Missing ⚠️
...era/node/app/workflows/query/QueryContextImpl.java 0.00% 4 Missing ⚠️
...hedera/node/app/workflows/handle/HandleOutput.java 33.33% 1 Missing and 1 partial ⚠️
.../node/app/state/recordcache/BlockRecordSource.java 92.30% 0 Missing and 1 partial ⚠️

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #25612      +/-   ##
============================================
- Coverage     75.11%   74.84%   -0.27%     
- Complexity    11548    11553       +5     
============================================
  Files          2585     2586       +1     
  Lines        101419   101455      +36     
  Branches      11241    11245       +4     
============================================
- Hits          76179    75938     -241     
- Misses        21335    21616     +281     
+ Partials       3905     3901       -4     
Files with missing lines Coverage Δ Complexity Δ
...app/workflows/standalone/TransactionExecutors.java 85.82% <100.00%> (+0.34%) 0.00 <0.00> (ø)
...com/hedera/node/config/data/BlockStreamConfig.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
.../node/app/state/recordcache/BlockRecordSource.java 98.11% <92.30%> (-1.89%) 0.00 <0.00> (ø)
...hedera/node/app/workflows/handle/HandleOutput.java 20.45% <33.33%> (+0.94%) 0.00 <0.00> (ø)
...era/node/app/workflows/query/QueryContextImpl.java 70.96% <0.00%> (-7.61%) 0.00 <0.00> (ø)
...edera/node/app/blocks/impl/BlockStreamBuilder.java 80.07% <0.00%> (+2.95%) 0.00 <0.00> (ø)
...era/node/app/records/impl/BlockStreamInfoImpl.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)

... and 26 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

aderevets and others added 3 commits May 28, 2026 01:41
BLOCKS-mode embedded node can't sustain 10 concurrent contract
deployments after heavy preceding test classes (PrecompileSCTest).
Receipt polling times out with UNKNOWN on FileCreate/CryptoCreate.

Signed-off-by: aderevets <artem.derevets@limechain.tech>
In BLOCKS mode the legacy BlockInfo singleton is not maintained, so
ContractCallLocal queries read block number 0 from BlockRecordInfoImpl,
making blockhash(block.number - 1) underflow and revert. Mirror the
handle path (ParentTxnFactory) by deriving query block info from
BlockStreamInfo state. Read from the immutable snapshot, not the live
BlockStreamManager, whose fields are mutated off the query thread.

Signed-off-by: aderevets <artem.derevets@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
petreze and others added 11 commits May 28, 2026 16:44
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
@petreze petreze changed the title chore: Test ci feat: enable BLOCKS-only stream mode support Jun 1, 2026
AlexKehayov and others added 2 commits June 1, 2026 15:17
Signed-off-by: Alex Kehayov <aleks.kehayov@limechain.tech>
Signed-off-by: Petar Tonev <petar.tonev@limechain.tech>
@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Jun 1, 2026

✅ All tests passed ✅

🏷️ Commit: 69b5b6a
▶️ Tests: 7068 executed
⚪️ Checks: 45/45 completed


Learn more about TestLens at testlens.app.

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.

Address any issues that might appear when streamMode defaults to BLOCKS

4 participants