Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use Transaction.body by default, normalize other transactions on ingest #17449

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

netopyr
Copy link
Contributor

@netopyr netopyr commented Jan 20, 2025

Description:

This PR simplifies the usage of Transaction. The field Transaction.body is used by default to store the TransactionBody. If a transaction is submitted to the network that does not follow the new standard, it is adjusted on ingest.

Related issue(s):

Fixes #17448

Notes for reviewer:

Checklist

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

@netopyr netopyr added this to the v0.59 milestone Jan 20, 2025
@netopyr netopyr self-assigned this Jan 20, 2025
@netopyr netopyr requested review from a team as code owners January 20, 2025 16:24
@netopyr netopyr requested a review from derektriley January 20, 2025 16:24
Signed-off-by: Michael Heinrichs <[email protected]>
Copy link

codacy-production bot commented Jan 20, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.09% (target: -1.00%) 97.50%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (8fbc13e) 98051 71520 72.94%
Head commit (5edf819) 98073 (+22) 71452 (-68) 72.86% (-0.09%)

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 (#17449) 40 39 97.50%

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

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

Attention: Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 68.94%. Comparing base (8fbc13e) to head (5edf819).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...edera/node/app/blocks/impl/BlockStreamBuilder.java 91.66% 1 Missing ⚠️
.../hedera/node/app/workflows/TransactionChecker.java 95.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main   #17449      +/-   ##
============================================
- Coverage     69.04%   68.94%   -0.10%     
+ Complexity    22789    22761      -28     
============================================
  Files          2619     2619              
  Lines         98268    98301      +33     
  Branches      10184    10184              
============================================
- Hits          67846    67776      -70     
- Misses        26597    26688      +91     
- Partials       3825     3837      +12     
Files with missing lines Coverage Δ
...va/com/hedera/node/app/hapi/utils/CommonUtils.java 87.17% <100.00%> (+0.69%) ⬆️
...edera/node/app/blocks/impl/TranslationContext.java 100.00% <100.00%> (ø)
...ode/app/blocks/impl/contexts/AirdropOpContext.java 100.00% <ø> (ø)
...a/node/app/blocks/impl/contexts/BaseOpContext.java 100.00% <ø> (ø)
...de/app/blocks/impl/contexts/ContractOpContext.java 100.00% <ø> (ø)
...node/app/blocks/impl/contexts/CryptoOpContext.java 100.00% <ø> (ø)
...a/node/app/blocks/impl/contexts/FileOpContext.java 100.00% <ø> (ø)
...a/node/app/blocks/impl/contexts/MintOpContext.java 100.00% <ø> (ø)
...a/node/app/blocks/impl/contexts/NodeOpContext.java 100.00% <ø> (ø)
...de/app/blocks/impl/contexts/ScheduleOpContext.java 100.00% <ø> (ø)
... and 7 more

... and 50 files with indirect coverage changes

Impacted file tree graph

Signed-off-by: Michael Heinrichs <[email protected]>
Signed-off-by: Michael Heinrichs <[email protected]>
@tinker-michaelj
Copy link
Collaborator

tinker-michaelj commented Jan 22, 2025

⚠️ We need to update this TranslationContext. transactionHash() method used during BlockItem-to-TransactionRecord translation to be based on not the standardized Transaction, but instead the same BlockStreamBuilder.serializedTransaction field used here.

Otherwise if a client submits a Transaction with body and sigMap fields, but serializes its (protobuf) field 3 first, then field 1, they will compute a different transaction hash when the node does, since this line will always serialize field 1 first.

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.

Accept Transaction.body and normalize transactions
2 participants