Skip to content

fix: block stream translators - resolve flaky receipt mismatches#24042

Draft
AlexKehayov wants to merge 4 commits intomainfrom
20489-stream-validation-translator-entity-numbers
Draft

fix: block stream translators - resolve flaky receipt mismatches#24042
AlexKehayov wants to merge 4 commits intomainfrom
20489-stream-validation-translator-entity-numbers

Conversation

@AlexKehayov
Copy link
Contributor

@AlexKehayov AlexKehayov commented Mar 5, 2026

Description:
Fixes flaky TransactionRecordParityValidator failures where block stream validation reports mismatches between generated and translated records.

Root cause:
BaseTranslator.nextCreatedNum() returns entity numbers in ascending sorted order. When multiple entities of the same type are created in a single transactional unit (e.g., an auto-created account 1946 and a contract 1970), the translator for the contract pops 1946 instead of 1970, producing a wrong contractNum in the receipt. Similarly, TopicCreateTranslator could get the wrong topic number and fail to match any state change, leaving topicID missing from the receipt.

Fix:

  • Added BaseTranslator.consumeCreatedNum(type, num) which removes a specific entity number from the list instead of blindly taking the first sorted entry.
  • ContractCreateTranslator now consumes the authoritative contractNum from the EVM result, and falls back to the EVM result's contract ID when no matching state change is found — replacing the previous hollow-account fallback that crashed with "Field contractID/adminKey is null" for normal contract creations.
  • TopicCreateTranslator finds the actual topic from state changes first, then consumes that specific number.
  • Added regression tests proving the root cause and the fix.

Fixes #20489

…resolve flaky receipt mismatches

Signed-off-by: Alex Kehayov <aleks.kehayov@limechain.tech>
@AlexKehayov AlexKehayov self-assigned this Mar 5, 2026
@trunk-io
Copy link

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

@lfdt-bot
Copy link

lfdt-bot commented Mar 5, 2026

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

Status Scanner 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.

@codacy-production
Copy link

codacy-production bot commented Mar 5, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (20ffe51) 92863 76407 82.28%
Head commit (28e25d8) 92863 (+0) 76407 (+0) 82.28% (+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 (#24042) 0 0 ∅ (not applicable)

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

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff            @@
##               main   #24042   +/-   ##
=========================================
  Coverage     78.28%   78.28%           
  Complexity    11662    11662           
=========================================
  Files          2461     2461           
  Lines         92960    92960           
  Branches       9966     9966           
=========================================
  Hits          72778    72778           
  Misses        16505    16505           
  Partials       3677     3677           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Test flake: StreamValidationTest

2 participants