Skip to content

fix: Use config version from start of record#24592

Open
mhess-swl wants to merge 4 commits intomainfrom
24591-wrapped-cfg-version
Open

fix: Use config version from start of record#24592
mhess-swl wants to merge 4 commits intomainfrom
24591-wrapped-cfg-version

Conversation

@mhess-swl
Copy link
Copy Markdown
Contributor

Description

Fix intermittent wrapped record block hash mismatch by capturing hapiProtoVersion at block start rather than reading it from the current config at hash computation time.

Key Points

  • BlockRecordManagerImpl.buildWrappedBlockHashesInput() was reading hedera.config.version from the live ConfigProvider at the moment the wrapped record block hash was computed (block end or freeze time)
  • If a FileUpdate transaction changed hedera.config.version mid-block, the hash was computed with the new version while the .rcd file on disk recorded the old version — causing the replay-based verification to produce a different hash
  • The failure was intermittent because it depended on whether the config-changing transaction landed in the same block as the hash computation
  • Added currentWrappedBlockHapiProtoVersion field, captured via copyHapiProtoVersion() in both block-start paths of startUserTransaction(), unconditionally
  • buildWrappedBlockHashesInput() now uses the captured version instead of querying the config provider

Test Coverage

  • configVersionChangeMidBlockUsesVersionFromBlockStart — swaps ConfigProvider from configVersion=5 to 6 mid-block, then crosses a block boundary; asserts the disk writer input still has build="5"
  • freezeBlockPersistsWrappedHashStateToBlockInfoUsingVersionFromBlockStart — same config swap during the EPOCH (first-ever) block, then calls writeFreezeBlockWrappedRecordFileBlockHashesToDisk; asserts disk writer input has build="5" and verifies BlockInfo state persistence

@mhess-swl mhess-swl added this to the v0.74 milestone Mar 27, 2026
@mhess-swl mhess-swl self-assigned this Mar 27, 2026
@mhess-swl mhess-swl requested a review from a team as a code owner March 27, 2026 19:33
@lfdt-bot
Copy link
Copy Markdown

lfdt-bot commented Mar 27, 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.

@trunk-io
Copy link
Copy Markdown

trunk-io bot commented Mar 27, 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.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Mar 27, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%) 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (96cdf02) 94614 77712 82.14%
Head commit (ac60b43) 94616 (+2) 77714 (+2) 82.14% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#24592) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #24592   +/-   ##
=========================================
  Coverage     78.15%   78.15%           
  Complexity    11679    11679           
=========================================
  Files          2488     2488           
  Lines         94711    94713    +2     
  Branches      10232    10231    -1     
=========================================
+ Hits          74020    74023    +3     
  Misses        16948    16948           
+ Partials       3743     3742    -1     
Files with missing lines Coverage Δ Complexity Δ
.../node/app/records/impl/BlockRecordManagerImpl.java 82.23% <100.00%> (+0.08%) 0.00 <0.00> (ø)

... and 1 file 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.

mhess-swl and others added 3 commits March 27, 2026 22:31
Signed-off-by: Matt Hess <matt.hess@swirldslabs.com>
Signed-off-by: Derek Riley <derek.riley@swirldslabs.com>
Signed-off-by: Matt Hess <matt.hess@swirldslabs.com>
Signed-off-by: Artur Kugal <artur.kugal@swirldslabs.com>
Signed-off-by: Matt Hess <matt.hess@swirldslabs.com>
@mhess-swl mhess-swl force-pushed the 24591-wrapped-cfg-version branch from 1126b44 to dcbb65c Compare March 28, 2026 04:31
@mhess-swl mhess-swl requested a review from a team as a code owner March 28, 2026 04:31
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.

5 participants