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

Externalize the generation of child records for view calls #9795

Merged
merged 233 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
233 commits
Select commit Hold shift + click to select a range
a369797
Fix TokenInfoHTSSuite tests
MiroslavGatsanoga Oct 26, 2023
98d5403
Merge branch 'develop' into fix-token-info-hts-suite
MiroslavGatsanoga Oct 27, 2023
18f035b
Move fix for child records to AbstractNonRevertibleTokenViewCall
MiroslavGatsanoga Oct 30, 2023
c884415
Remove unused mock
MiroslavGatsanoga Oct 30, 2023
432b9c6
Setup mock message frame with mock proxy updater
MiroslavGatsanoga Oct 30, 2023
378e035
Fix copy-paste error in DefaultKycStatusCallTest
MiroslavGatsanoga Oct 30, 2023
c379a62
Merge branch 'develop' into fix-token-info-hts-suite
MiroslavGatsanoga Oct 30, 2023
c750cb7
Enable a couple of tests in DefaultTokenStatusSuite
MiroslavGatsanoga Oct 30, 2023
7547749
Revert MessageFrame injections and make QuerySystemContractOperations
MiroslavGatsanoga Oct 31, 2023
d6c44e9
Fix failing unit test
MiroslavGatsanoga Oct 31, 2023
3372c04
Merge branch 'fix-token-info-hts-suite' into 09566-fix-token-update-s…
petreze Nov 1, 2023
04a9c7f
Merge branch 'develop' into fix-token-info-hts-suite
MiroslavGatsanoga Nov 2, 2023
bf11d32
fix UpdatePrecompileSuite tests and enhance child records behaviour
petreze Nov 2, 2023
e1b260a
apply spotless and fix minor typo
petreze Nov 2, 2023
d5b274c
Merge branch 'develop' into 09566-fix-token-update-suite
petreze Nov 2, 2023
83dc553
apply spotless and fix minor typo
petreze Nov 2, 2023
6ab6e58
Populate evm function result on failing eth transaction (modulatized …
stoqnkpL Nov 1, 2023
8f16eb3
old logging API moved to legacy package (#8459)
hendrikebbers Nov 1, 2023
8911e17
09449 Create data consistency validator (#9549)
litt3 Nov 1, 2023
a185876
Support fuzzy-matching record snapshots (#9513)
tinker-michaelj Nov 1, 2023
8ccf213
9559 Increased timeout in the assertions to prevent non-deterministic…
imalygin Nov 1, 2023
f3eba22
Fix compile breakage in develop following package move of logging. (#…
jsync-swirlds Nov 1, 2023
0af2702
Cleanup Module patching (#8561)
jjohannes Nov 1, 2023
b6394f7
Make platform mainnet settings the default (#9341)
poulok Nov 1, 2023
edd46bd
Measure consensus metrics for all events. (#9604)
cody-littley Nov 1, 2023
9a6072e
09543 d remove crypto class (#9544)
lpetrovic05 Nov 2, 2023
164ed6f
remove static from all the test in MiscCryptoSuite (#9619)
povolev15 Nov 2, 2023
2eca0d3
Merge remote-tracking branch 'origin/09566-fix-token-update-suite' in…
petreze Nov 2, 2023
e442139
fix UpdatePrecompileSuite tests and enhance child records behaviour
petreze Nov 2, 2023
49a469e
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 2, 2023
c0d5630
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 2, 2023
6eb51bc
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 2, 2023
4d6cf74
use correct method for failures
petreze Nov 3, 2023
827c08a
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 3, 2023
2ae5af2
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 3, 2023
16f3263
09372: fixed multiple suite test in CreatePrecompileSuite
agadzhalov Nov 3, 2023
98f53c4
fix failing unit test and add additional one for another corner case
petreze Nov 3, 2023
e2680cf
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 3, 2023
3361ca0
Stabilize fuzzy matching
tinker-michaelj Nov 3, 2023
4f8c0d2
Try to stabilize CI
tinker-michaelj Nov 3, 2023
824277d
Remove fuzzy match from PayableCreate2WorksAsExpected() for now
tinker-michaelj Nov 4, 2023
d151a8f
09371: fixed unit test because of missing symbol, treasury and autoRe…
agadzhalov Nov 6, 2023
da5097e
Merge branch 'develop' into 09567-fix-token-update-expiry-e2e
petreze Nov 6, 2023
e614095
fix TokenExpiryInfoSuite test
petreze Nov 6, 2023
84ba2a6
fix misleading typo
petreze Nov 6, 2023
8e48cae
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 6, 2023
869ac22
Merge branch '09566-fix-token-update-suite' into 09567-fix-token-upda…
petreze Nov 6, 2023
dfc8a38
fix misleading typo
petreze Nov 6, 2023
f8aec8d
apply spotless
petreze Nov 6, 2023
297d899
apply spotless
petreze Nov 6, 2023
4bc440c
Add AutoSnapshotModeOp
tinker-michaelj Nov 6, 2023
c143252
09372: fixed createTokenWithInsufficientValueSent
agadzhalov Nov 7, 2023
9ecc4ba
Stabilize CryptoTransferSuite
tinker-michaelj Nov 7, 2023
eaa0fcb
Skip irrelevant files
tinker-michaelj Nov 7, 2023
abfd631
Merge upstream
tinker-michaelj Nov 7, 2023
9f5dd85
Small fixes
tinker-michaelj Nov 7, 2023
e335896
remove unnecessary checks
petreze Nov 7, 2023
3839a6d
Merge branch 'develop' into 09566-token-update-suite
petreze Nov 7, 2023
a458f67
Merge branch '09566-token-update-suite' into 09567-fix-token-update-e…
petreze Nov 7, 2023
730c0c4
Consolidate JSON snapshots
tinker-michaelj Nov 7, 2023
e56d85c
Stabilize CI
tinker-michaelj Nov 7, 2023
874935a
Merge remote-tracking branch 'origin/develop' into 09697-auto-snapsho…
tinker-michaelj Nov 7, 2023
848aa92
Add resouce
tinker-michaelj Nov 7, 2023
1a69bdd
wip
Neeharika-Sompalli Nov 7, 2023
14eb340
Merge branch '09697-auto-snapshot-matching' into 9750-D-transfer-fuzz…
Neeharika-Sompalli Nov 7, 2023
7a7e402
wip
Neeharika-Sompalli Nov 7, 2023
3d69063
wip
Neeharika-Sompalli Nov 8, 2023
d10ba68
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 8, 2023
4ec954f
Merge branch 'develop' into test-optimization
petreze Nov 8, 2023
52e8444
Merge remote-tracking branch 'origin/09372-fix-create-hts-suites' int…
petreze Nov 8, 2023
6653952
Fix some tests from LazyCreateThroughPrecompileSuite
MiroslavGatsanoga Nov 8, 2023
e28e34c
Extract setting of contract call result in record to be in precompile…
MiroslavGatsanoga Nov 8, 2023
50b291d
Merge branch 'develop' into test-optimization
petreze Nov 8, 2023
fd1d0e9
Add gas fees to ContractCreate and ContractCall record transactionFee…
tinker-michaelj Nov 8, 2023
0f50b2b
Merge remote-tracking branch 'origin/develop' into 09663-inc-gas-in-t…
tinker-michaelj Nov 8, 2023
fe55ec7
Revert HtsCall change
tinker-michaelj Nov 8, 2023
207b036
Remove unwanted log
tinker-michaelj Nov 8, 2023
6837011
Fix typo
tinker-michaelj Nov 8, 2023
d5a7482
fixes few more issues
Neeharika-Sompalli Nov 8, 2023
dd7619d
fix unit test
tinker-michaelj Nov 8, 2023
1954f9b
fixes few more issues
Neeharika-Sompalli Nov 8, 2023
9c3ea2f
Merge remote-tracking branch 'origin/09663-inc-gas-in-txn-fee' into 9…
Neeharika-Sompalli Nov 8, 2023
057efd7
intermezzo
tinker-michaelj Nov 8, 2023
7ec4e2d
Add unit tests, prep for PR
tinker-michaelj Nov 9, 2023
742efe6
Merge remote-tracking branch 'origin/develop' into 09775-fix-sc-creat…
tinker-michaelj Nov 9, 2023
a14d618
Remove unwanted line
tinker-michaelj Nov 9, 2023
fbb44d8
Merge branch '09775-fix-sc-create-children' into 9750-D-transfer-fuzz…
Neeharika-Sompalli Nov 9, 2023
81b96ad
Merge branch 'develop' into 09372-fix-create-hts-suites
agadzhalov Nov 9, 2023
ca707f7
Merge branch 'develop' into test-optimization
petreze Nov 9, 2023
85cb531
09372: added todo comment for extenalizing commong logic
agadzhalov Nov 9, 2023
365883a
Fix failing unit tests
MiroslavGatsanoga Nov 9, 2023
6b8ff95
Merge branch 'develop' into fix-lazy-create-through-precompile-tests
MiroslavGatsanoga Nov 9, 2023
cba65e0
Merge branch 'develop' into 09372-fix-create-hts-suites
agadzhalov Nov 9, 2023
5e17a3e
Merge remote-tracking branch 'origin/develop' into 09775-fix-sc-creat…
tinker-michaelj Nov 9, 2023
daf3991
partial work
petreze Nov 9, 2023
ca2f6c7
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 9, 2023
59632f6
apply spotless plus some unit test fixes
petreze Nov 9, 2023
17306b4
Use ExternalizedRecordCustomizer
tinker-michaelj Nov 9, 2023
cc50fce
fix unit test
tinker-michaelj Nov 9, 2023
35b3889
Fix typo
tinker-michaelj Nov 9, 2023
3711915
fix unit test
tinker-michaelj Nov 9, 2023
8800b79
WIP
Neeharika-Sompalli Nov 9, 2023
5370081
Use ExternalizedRecordCustomizer instead of UnaryOperator
tinker-michaelj Nov 9, 2023
0f33f69
fix most tests
Neeharika-Sompalli Nov 9, 2023
27c8a83
Address reviewer comments
tinker-michaelj Nov 9, 2023
bfd15e5
fix most tests
Neeharika-Sompalli Nov 9, 2023
ef16071
fix most tests
Neeharika-Sompalli Nov 9, 2023
fd25b68
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 9, 2023
2f5f2ad
Merge branch '09775-fix-sc-create-children' into 9750-D-transfer-fuzz…
Neeharika-Sompalli Nov 9, 2023
155723a
enable records for transfer suite
Neeharika-Sompalli Nov 9, 2023
83550e5
docs
Neeharika-Sompalli Nov 9, 2023
9f79573
Require @NonNull customizer
tinker-michaelj Nov 10, 2023
607dc55
address few review comments
Neeharika-Sompalli Nov 10, 2023
ce06a8a
Merge branch '09775-fix-sc-create-children' into 9750-D-transfer-fuzz…
Neeharika-Sompalli Nov 10, 2023
4fe7b76
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 10, 2023
180e819
Merge remote-tracking branch 'origin/09372-fix-create-hts-suites' int…
petreze Nov 10, 2023
84fc01f
fix after merging develop
petreze Nov 10, 2023
6e957f1
generalize even further inside HtsSystemContract class
petreze Nov 10, 2023
5f3c892
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 10, 2023
122d425
Fix failing tests
Neeharika-Sompalli Nov 10, 2023
ba2ffc2
Fix failing tests
Neeharika-Sompalli Nov 10, 2023
695cbef
Fix all print stack traces
Neeharika-Sompalli Nov 10, 2023
507220a
more review comments
Neeharika-Sompalli Nov 10, 2023
720dfc6
more review comments
Neeharika-Sompalli Nov 10, 2023
681ba5f
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 10, 2023
512d628
fix unit tests
Neeharika-Sompalli Nov 10, 2023
9267624
Fix MiscSuite compile errors
tinker-michaelj Nov 11, 2023
76474b4
wip
Neeharika-Sompalli Nov 11, 2023
8c855e3
wip
Neeharika-Sompalli Nov 11, 2023
850e7f8
add additional check to handle unit tests
petreze Nov 13, 2023
a51ed0b
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 13, 2023
8e89036
apply spotless
petreze Nov 13, 2023
0ca3143
fix hapi test
petreze Nov 13, 2023
82463a5
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 13, 2023
e868110
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 13, 2023
e5f7669
fix CI Integration tests and spotless
Neeharika-Sompalli Nov 13, 2023
075877b
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 13, 2023
aa9f392
review comments
Neeharika-Sompalli Nov 14, 2023
f0b4643
Merge branch 'develop' into 9750-D-transfer-fuzzy-records
Neeharika-Sompalli Nov 14, 2023
5cc195e
Merge branch '9750-D-transfer-fuzzy-records' into 9727-D-auto-creatio…
Neeharika-Sompalli Nov 14, 2023
fc137f9
wip
Neeharika-Sompalli Nov 14, 2023
05cb18c
Merge remote-tracking branch 'origin/9727-D-auto-creation-records' in…
Neeharika-Sompalli Nov 14, 2023
fecc178
fix null pointer exception after generalization
petreze Nov 14, 2023
2f0c004
fix unit test
petreze Nov 14, 2023
9344181
fix compile
petreze Nov 14, 2023
1396199
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 14, 2023
22fae47
fix merge with develop
petreze Nov 14, 2023
d165e34
Merge branch 'develop' into 9727-D-auto-creation-records
Neeharika-Sompalli Nov 14, 2023
a25d1aa
wip
Neeharika-Sompalli Nov 14, 2023
ddd3356
fix some more tests
Neeharika-Sompalli Nov 14, 2023
7e0e3b9
Fix dispatch validations
tinker-michaelj Nov 14, 2023
a4d10a9
fixed one more test
Neeharika-Sompalli Nov 14, 2023
35d8468
fixes all tests
Neeharika-Sompalli Nov 14, 2023
5d6bf5a
fix unit tests and spotless
Neeharika-Sompalli Nov 14, 2023
5647ae9
add hollow finalization mono-service snapshot
Neeharika-Sompalli Nov 15, 2023
c21f411
Further discriminate dispatch behavior for hollow account completions
tinker-michaelj Nov 15, 2023
20d21b7
Add comment
tinker-michaelj Nov 15, 2023
854c8ee
Merge upstream
tinker-michaelj Nov 15, 2023
2702f5b
Verify correct entities in dispatch
tinker-michaelj Nov 15, 2023
71bf5b2
Add comment
tinker-michaelj Nov 15, 2023
d7edb4a
remove unnecessary check and fix unit test by mocking
petreze Nov 15, 2023
47b795f
fix child records behaviour to not be added to write calls
petreze Nov 15, 2023
f76c276
Fix failing unit tests
MiroslavGatsanoga Nov 15, 2023
e0cc1f5
Merge branch 'develop' into fix-lazy-create-through-precompile-tests
MiroslavGatsanoga Nov 15, 2023
408d4c7
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 15, 2023
51cb433
fix tests
Neeharika-Sompalli Nov 15, 2023
9d6bbf5
Add fix for contract creates dispatching synthetic crypto transfer
MiroslavGatsanoga Nov 15, 2023
eb9536e
Waive signing requirements for synthetic CryptoCreate
tinker-michaelj Nov 15, 2023
205aa27
Merge
tinker-michaelj Nov 15, 2023
f54cb04
Merge branch 'develop' into 9696-hollow-account-records
Neeharika-Sompalli Nov 15, 2023
3f61588
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 15, 2023
ca8f99e
fix suite after merge with develop (new implementation IsTokenCall)
petreze Nov 15, 2023
807e655
Resolve HapiTest issues
tinker-michaelj Nov 15, 2023
af9a549
wip
Neeharika-Sompalli Nov 15, 2023
c62f403
Merge branch 'fix-lazy-create-through-precompile-tests' into 9696-hol…
Neeharika-Sompalli Nov 15, 2023
68cf767
Fix compile error
tinker-michaelj Nov 15, 2023
fb18b2a
Merge branch 'fix-lazy-create-through-precompile-tests' into 9696-hol…
Neeharika-Sompalli Nov 15, 2023
a9f18e6
Fix to 3 remaining XTest failures
tinker-michaelj Nov 16, 2023
4972660
fix unit test
tinker-michaelj Nov 16, 2023
84e9764
Merge branch 'fix-lazy-create-through-precompile-tests' into 9696-hol…
Neeharika-Sompalli Nov 16, 2023
107491e
Merge branch 'develop' into fix-lazy-create-through-precompile-tests
Neeharika-Sompalli Nov 16, 2023
dd314f8
fix most tests
Neeharika-Sompalli Nov 16, 2023
b031238
Merge remote-tracking branch 'origin/9696-hollow-account-records' int…
Neeharika-Sompalli Nov 16, 2023
2465e68
Merge branch 'fix-lazy-create-through-precompile-tests' into 9696-hol…
Neeharika-Sompalli Nov 16, 2023
42e6b02
fix most tests
Neeharika-Sompalli Nov 16, 2023
23a64d0
fix snapshots
Neeharika-Sompalli Nov 16, 2023
845b0b5
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 16, 2023
87465a0
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 16, 2023
8e92267
after merge with dev
petreze Nov 16, 2023
342b697
Merge branch 'develop' into 9696-hollow-account-records
Neeharika-Sompalli Nov 16, 2023
883dbda
add calculateFees to ContractCreateHandler
Neeharika-Sompalli Nov 16, 2023
a017f32
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 16, 2023
42a27ed
fix tests
Neeharika-Sompalli Nov 16, 2023
5526d00
fix tests
Neeharika-Sompalli Nov 16, 2023
48d3140
Merge branch 'develop' into fix-generalize-externalization
petreze Nov 16, 2023
41474ba
fix after merging develop
petreze Nov 16, 2023
b4402b8
fix tests
Neeharika-Sompalli Nov 16, 2023
3fff025
fix spotless
Neeharika-Sompalli Nov 16, 2023
efacc54
Set contract id on reverted ContractCallResult; avoid reverting gas c…
tinker-michaelj Nov 16, 2023
fed491a
Merge branch '9696-hollow-account-records' of github.com:hashgraph/he…
tinker-michaelj Nov 16, 2023
a4f716d
fix unit test
tinker-michaelj Nov 16, 2023
50bd957
Confirm no auto-creations in HollowAccountFinalizationSuite
tinker-michaelj Nov 16, 2023
e4b2ce6
clean up
Neeharika-Sompalli Nov 16, 2023
6bd7a51
Merge remote-tracking branch 'origin/9696-hollow-account-records' int…
Neeharika-Sompalli Nov 16, 2023
b7aa046
fix docs
Neeharika-Sompalli Nov 16, 2023
c9715af
docs
Neeharika-Sompalli Nov 16, 2023
766b896
Retake snapshot
tinker-michaelj Nov 16, 2023
cca27f9
Merge branch '9696-hollow-account-records' of github.com:hashgraph/he…
tinker-michaelj Nov 16, 2023
1e25dc2
Merge upstream
tinker-michaelj Nov 16, 2023
9b092e3
fix comments
Neeharika-Sompalli Nov 16, 2023
cd61403
Merge remote-tracking branch 'origin/9696-hollow-account-records' int…
Neeharika-Sompalli Nov 16, 2023
8bea4d8
Stabilize txnWith2CompletionsAndAnother2PrecedingChildRecords()
tinker-michaelj Nov 17, 2023
b4c0a1f
Merge branch '9696-hollow-account-records' of github.com:hashgraph/he…
tinker-michaelj Nov 17, 2023
8ad9ec7
Merge branch '9696-hollow-account-records' into fix-generalize-extern…
tinker-michaelj Nov 17, 2023
76fb9a6
intermezzo
tinker-michaelj Nov 17, 2023
94d8901
Fix hapiTransferFromForFungibleToken() by finalizing child records an…
tinker-michaelj Nov 18, 2023
11228b4
Begin centralizing result construction
tinker-michaelj Nov 18, 2023
d587a7a
Revert output should be encoded rc
tinker-michaelj Nov 18, 2023
6aa3635
intermezzo
tinker-michaelj Nov 18, 2023
2efac9f
Enable more dispatch result-dependent specs
tinker-michaelj Nov 19, 2023
bff5234
Merge upstream
tinker-michaelj Nov 19, 2023
e5d5720
fix unit test
tinker-michaelj Nov 19, 2023
c405fa8
fix unit test
tinker-michaelj Nov 19, 2023
6949128
spotless
tinker-michaelj Nov 19, 2023
b83b3e7
fix unit test
tinker-michaelj Nov 19, 2023
a8b9b60
Add outputFn customization
tinker-michaelj Nov 19, 2023
14a058d
Revert on state changes in static frame
tinker-michaelj Nov 19, 2023
516cfc1
fix unit test
tinker-michaelj Nov 19, 2023
5e6b82f
Remove unwanted logging
tinker-michaelj Nov 20, 2023
25cd84c
spotless
tinker-michaelj Nov 20, 2023
2cecd5b
Disable failing tests for now
tinker-michaelj Nov 20, 2023
b6bfd63
Don't re-charge fees if not rolling back stack
tinker-michaelj Nov 20, 2023
6bbcf2b
Comment unstable tests
tinker-michaelj Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
package com.hedera.node.app.spi.workflows.record;

import com.hedera.hapi.node.base.ResponseCodeEnum;
import com.hedera.hapi.node.base.Transaction;
import com.hedera.hapi.node.transaction.SignedTransaction;
import com.hedera.hapi.node.transaction.TransactionBody;
import edu.umd.cs.findbugs.annotations.NonNull;

/**
Expand All @@ -39,4 +42,20 @@
* @return the builder
*/
SingleTransactionRecordBuilder status(@NonNull ResponseCodeEnum status);

/**
* Convenience method to package as {@link TransactionBody} as a {@link Transaction} .
*
* @param body the transaction body
* @return the transaction
*/
static Transaction transactionWith(@NonNull TransactionBody body) {
final var bodyBytes = TransactionBody.PROTOBUF.toBytes(body);

Check warning on line 53 in hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/workflows/record/SingleTransactionRecordBuilder.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/workflows/record/SingleTransactionRecordBuilder.java#L53

Added line #L53 was not covered by tests
final var signedTransaction =
SignedTransaction.newBuilder().bodyBytes(bodyBytes).build();
final var signedTransactionBytes = SignedTransaction.PROTOBUF.toBytes(signedTransaction);
return Transaction.newBuilder()
.signedTransactionBytes(signedTransactionBytes)
.build();

Check warning on line 59 in hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/workflows/record/SingleTransactionRecordBuilder.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/workflows/record/SingleTransactionRecordBuilder.java#L55-L59

Added lines #L55 - L59 were not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.hedera.node.app.workflows.handle;

import static com.hedera.node.app.workflows.handle.TokenContextImpl.castRecordBuilder;
import static java.util.Objects.requireNonNull;

import com.hedera.node.app.service.token.records.ChildFinalizeContext;
import com.hedera.node.app.workflows.dispatcher.ReadableStoreFactory;
import com.hedera.node.app.workflows.dispatcher.WritableStoreFactory;
import com.hedera.node.app.workflows.handle.record.SingleTransactionRecordBuilderImpl;
import edu.umd.cs.findbugs.annotations.NonNull;

/**
* Standard implementation of {@link ChildFinalizeContext}.
*/
public class ChildFinalizeContextImpl implements ChildFinalizeContext {
private final ReadableStoreFactory readableStoreFactory;
private final WritableStoreFactory writableStoreFactory;
private final SingleTransactionRecordBuilderImpl recordBuilder;

public ChildFinalizeContextImpl(
@NonNull final ReadableStoreFactory readableStoreFactory,
@NonNull final WritableStoreFactory writableStoreFactory,
@NonNull final SingleTransactionRecordBuilderImpl recordBuilder) {
this.readableStoreFactory = requireNonNull(readableStoreFactory);
this.writableStoreFactory = requireNonNull(writableStoreFactory);
this.recordBuilder = requireNonNull(recordBuilder);
}

@NonNull
@Override
public <T> T readableStore(@NonNull Class<T> storeInterface) {
requireNonNull(storeInterface, "storeInterface must not be null");
return readableStoreFactory.getStore(storeInterface);

Check warning on line 49 in hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java#L48-L49

Added lines #L48 - L49 were not covered by tests
}

@NonNull
@Override
public <T> T writableStore(@NonNull Class<T> storeInterface) {
requireNonNull(storeInterface, "storeInterface must not be null");
return writableStoreFactory.getStore(storeInterface);

Check warning on line 56 in hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java#L55-L56

Added lines #L55 - L56 were not covered by tests
}

@NonNull
@Override
public <T> T userTransactionRecordBuilder(@NonNull final Class<T> recordBuilderClass) {
requireNonNull(recordBuilderClass, "recordBuilderClass must not be null");
return castRecordBuilder(recordBuilder, recordBuilderClass);

Check warning on line 63 in hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/ChildFinalizeContextImpl.java#L62-L63

Added lines #L62 - L63 were not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
import com.hedera.node.app.fees.NoOpFeeCalculator;
import com.hedera.node.app.ids.EntityIdService;
import com.hedera.node.app.ids.WritableEntityIdStore;
import com.hedera.node.app.service.token.TokenService;
import com.hedera.node.app.service.token.api.TokenServiceApi;
import com.hedera.node.app.service.token.records.ChildRecordFinalizer;
import com.hedera.node.app.services.ServiceScopeLookup;
import com.hedera.node.app.signature.DelegateKeyVerifier;
import com.hedera.node.app.signature.KeyVerifier;
Expand Down Expand Up @@ -126,6 +128,7 @@ public class HandleContextImpl implements HandleContext, FeeContext {
private final ExchangeRateManager exchangeRateManager;
private final Authorizer authorizer;
private final SolvencyPreCheck solvencyPreCheck;
private final ChildRecordFinalizer childRecordFinalizer;

private ReadableStoreFactory readableStoreFactory;
private AttributeValidator attributeValidator;
Expand All @@ -135,26 +138,27 @@ public class HandleContextImpl implements HandleContext, FeeContext {
/**
* Constructs a {@link HandleContextImpl}.
*
* @param txBody The {@link TransactionBody} of the transaction
* @param functionality The {@link HederaFunctionality} of the transaction
* @param signatureMapSize The size of the {@link com.hedera.hapi.node.base.SignatureMap} of the transaction
* @param payer The {@link AccountID} of the payer
* @param payerKey The {@link Key} of the payer
* @param networkInfo The {@link NetworkInfo} of the network
* @param category The {@link TransactionCategory} of the transaction (either user, preceding, or child)
* @param recordBuilder The main {@link SingleTransactionRecordBuilderImpl}
* @param stack The {@link SavepointStackImpl} used to manage savepoints
* @param configuration The current {@link Configuration}
* @param verifier The {@link KeyVerifier} used to verify signatures and hollow accounts
* @param recordListBuilder The {@link RecordListBuilder} used to build the record stream
* @param checker The {@link TransactionChecker} used to check dispatched transaction
* @param dispatcher The {@link TransactionDispatcher} used to dispatch child transactions
* @param serviceScopeLookup The {@link ServiceScopeLookup} used to look up the scope of a service
* @param feeManager The {@link FeeManager} used to convert usage into fees
* @param exchangeRateManager The {@link ExchangeRateManager} used to obtain exchange rate information
* @param txBody The {@link TransactionBody} of the transaction
* @param functionality The {@link HederaFunctionality} of the transaction
* @param signatureMapSize The size of the {@link com.hedera.hapi.node.base.SignatureMap} of the transaction
* @param payer The {@link AccountID} of the payer
* @param payerKey The {@link Key} of the payer
* @param networkInfo The {@link NetworkInfo} of the network
* @param category The {@link TransactionCategory} of the transaction (either user, preceding, or child)
* @param recordBuilder The main {@link SingleTransactionRecordBuilderImpl}
* @param stack The {@link SavepointStackImpl} used to manage savepoints
* @param configuration The current {@link Configuration}
* @param verifier The {@link KeyVerifier} used to verify signatures and hollow accounts
* @param recordListBuilder The {@link RecordListBuilder} used to build the record stream
* @param checker The {@link TransactionChecker} used to check dispatched transaction
* @param dispatcher The {@link TransactionDispatcher} used to dispatch child transactions
* @param serviceScopeLookup The {@link ServiceScopeLookup} used to look up the scope of a service
* @param feeManager The {@link FeeManager} used to convert usage into fees
* @param exchangeRateManager The {@link ExchangeRateManager} used to obtain exchange rate information
* @param userTransactionConsensusTime The consensus time of the user transaction, not any child transactions
* @param authorizer The {@link Authorizer} used to authorize the transaction
* @param solvencyPreCheck The {@link SolvencyPreCheck} used to validate if the account is able to pay the fees
* @param authorizer The {@link Authorizer} used to authorize the transaction
* @param solvencyPreCheck The {@link SolvencyPreCheck} used to validate if the account is able to pay the fees
* @param childRecordFinalizer The {@link ChildRecordFinalizer} used to finalize child records
*/
public HandleContextImpl(
@NonNull final TransactionBody txBody,
Expand All @@ -178,7 +182,8 @@ public HandleContextImpl(
@NonNull final ExchangeRateManager exchangeRateManager,
@NonNull final Instant userTransactionConsensusTime,
@NonNull final Authorizer authorizer,
@NonNull final SolvencyPreCheck solvencyPreCheck) {
@NonNull final SolvencyPreCheck solvencyPreCheck,
@NonNull final ChildRecordFinalizer childRecordFinalizer) {
this.txBody = requireNonNull(txBody, "txBody must not be null");
this.functionality = requireNonNull(functionality, "functionality must not be null");
this.payer = requireNonNull(payer, "payer must not be null");
Expand All @@ -199,6 +204,7 @@ public HandleContextImpl(
this.userTransactionConsensusTime =
requireNonNull(userTransactionConsensusTime, "userTransactionConsensusTime must not be null");
this.authorizer = requireNonNull(authorizer, "authorizer must not be null");
this.childRecordFinalizer = requireNonNull(childRecordFinalizer, "childRecordFinalizer must not be null");

final var serviceScope = serviceScopeLookup.getServiceName(txBody);
this.writableStoreFactory = new WritableStoreFactory(stack, serviceScope);
Expand Down Expand Up @@ -689,11 +695,15 @@ private void dispatchSyntheticTxn(
exchangeRateManager,
userTransactionConsensusTime,
authorizer,
solvencyPreCheck);
solvencyPreCheck,
childRecordFinalizer);

try {
dispatcher.dispatchHandle(childContext);
childRecordBuilder.status(ResponseCodeEnum.SUCCESS);
final var finalizeContext = new ChildFinalizeContextImpl(
readableStoreFactory, new WritableStoreFactory(childStack, TokenService.NAME), childRecordBuilder);
childRecordFinalizer.finalizeChildRecord(finalizeContext);
childStack.commitFullStack();
} catch (final HandleException e) {
childRecordBuilder.status(e.getStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import com.hedera.node.app.records.BlockRecordManager;
import com.hedera.node.app.service.token.ReadableAccountStore;
import com.hedera.node.app.service.token.api.TokenServiceApi;
import com.hedera.node.app.service.token.records.ChildRecordFinalizer;
import com.hedera.node.app.service.token.records.CryptoUpdateRecordBuilder;
import com.hedera.node.app.service.token.records.ParentRecordFinalizer;
import com.hedera.node.app.services.ServiceScopeLookup;
Expand Down Expand Up @@ -137,6 +138,7 @@ public class HandleWorkflow {
private final StakingPeriodTimeHook stakingPeriodTimeHook;
private final FeeManager feeManager;
private final ExchangeRateManager exchangeRateManager;
private final ChildRecordFinalizer childRecordFinalizer;
private final ParentRecordFinalizer transactionFinalizer;
private final SystemFileUpdateFacility systemFileUpdateFacility;
private final DualStateUpdateFacility dualStateUpdateFacility;
Expand All @@ -160,6 +162,7 @@ public HandleWorkflow(
@NonNull final StakingPeriodTimeHook stakingPeriodTimeHook,
@NonNull final FeeManager feeManager,
@NonNull final ExchangeRateManager exchangeRateManager,
@NonNull final ChildRecordFinalizer childRecordFinalizer,
@NonNull final ParentRecordFinalizer transactionFinalizer,
@NonNull final SystemFileUpdateFacility systemFileUpdateFacility,
@NonNull final DualStateUpdateFacility dualStateUpdateFacility,
Expand All @@ -180,6 +183,7 @@ public HandleWorkflow(
this.stakingPeriodTimeHook = requireNonNull(stakingPeriodTimeHook, "stakingPeriodTimeHook must not be null");
this.feeManager = requireNonNull(feeManager, "feeManager must not be null");
this.exchangeRateManager = requireNonNull(exchangeRateManager, "exchangeRateManager must not be null");
this.childRecordFinalizer = childRecordFinalizer;
this.transactionFinalizer = requireNonNull(transactionFinalizer, "transactionFinalizer must not be null");
this.systemFileUpdateFacility =
requireNonNull(systemFileUpdateFacility, "systemFileUpdateFacility must not be null");
Expand Down Expand Up @@ -376,7 +380,8 @@ private void handleUserTransaction(
exchangeRateManager,
consensusNow,
authorizer,
solvencyPreCheck);
solvencyPreCheck,
childRecordFinalizer);

// Calculate the fee
fees = dispatcher.dispatchComputeFees(context);
Expand Down Expand Up @@ -487,7 +492,8 @@ private void handleUserTransaction(
} catch (final HandleException e) {
// In case of a ContractCall when it reverts, the gas charged should not be rolled back
rollback(e.shouldRollbackStack(), e.getStatus(), stack, recordListBuilder);
if (!hasWaivedFees) {
if (!hasWaivedFees && e.shouldRollbackStack()) {
// Only re-charge fees if we rolled back the stack
feeAccumulator.chargeFees(payer, creator.accountId(), fees);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public <T> T userTransactionRecordBuilder(@NonNull Class<T> recordBuilderClass)
return castRecordBuilder(recordListBuilder.userTransactionRecordBuilder(), recordBuilderClass);
}

@Override
public boolean hasChildRecords() {
return !recordListBuilder.childRecordBuilders().isEmpty();
tinker-michaelj marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
public <T> void forEachChildRecord(@NonNull Class<T> recordBuilderClass, @NonNull Consumer<T> consumer) {
requireNonNull(consumer, "consumer must not be null");
Expand All @@ -105,7 +110,7 @@ public <T> T addUncheckedPrecedingChildRecordBuilder(@NonNull Class<T> recordBui
return castRecordBuilder(result, recordBuilderClass);
}

private static <T> T castRecordBuilder(
static <T> T castRecordBuilder(
@NonNull final SingleTransactionRecordBuilderImpl recordBuilder,
@NonNull final Class<T> recordBuilderClass) {
if (!recordBuilderClass.isInstance(recordBuilder)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ private SingleTransactionRecordBuilderImpl doAddChild(
? userTxnRecordBuilder.consensusNow()
: childRecordBuilders.get(childRecordBuilders.size() - 1).consensusNow();
final var consensusNow = prevConsensusNow.plusNanos(1L);
// Note we do not repeat exchange rates for child transactions
final var recordBuilder = new SingleTransactionRecordBuilderImpl(consensusNow, reversingBehavior, customizer)
.parentConsensus(parentConsensusTimestamp)
.exchangeRate(userTxnRecordBuilder.exchangeRate());
.parentConsensus(parentConsensusTimestamp);
if (!customizer.shouldSuppressRecord()) {
childRecordBuilders.add(recordBuilder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@

/**
* When we update nonce on the record, we need to update the body as well with the same transactionID.
*
* @return the builder
*/
@NonNull
Expand All @@ -382,13 +383,7 @@
.copyBuilder()
.transactionID(newTransactionID)
.build();
final var newBodyBytes = TransactionBody.PROTOBUF.toBytes(body);
final var newSignedTransaction =
SignedTransaction.newBuilder().bodyBytes(newBodyBytes).build();
final var signedTransactionBytes = SignedTransaction.PROTOBUF.toBytes(newSignedTransaction);
this.transaction = Transaction.newBuilder()
.signedTransactionBytes(signedTransactionBytes)
.build();
this.transaction = SingleTransactionRecordBuilder.transactionWith(body);
tinker-michaelj marked this conversation as resolved.
Show resolved Hide resolved
return this;
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down Expand Up @@ -515,6 +510,11 @@
return this;
}

@Override
public List<TokenTransferList> tokenTransferLists() {
return tokenTransferLists;

Check warning on line 515 in hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/record/SingleTransactionRecordBuilderImpl.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/record/SingleTransactionRecordBuilderImpl.java#L515

Added line #L515 was not covered by tests
}

/**
* Adds a tokenTransferList.
*
Expand Down Expand Up @@ -925,6 +925,11 @@
return this;
}

@Override
public List<Long> serialNumbers() {
return serialNumbers;

Check warning on line 930 in hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/record/SingleTransactionRecordBuilderImpl.java

View check run for this annotation

Codecov / codecov/patch

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/record/SingleTransactionRecordBuilderImpl.java#L930

Added line #L930 was not covered by tests
}

/**
* Adds a serialNumber to the receipt.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import com.hedera.node.app.service.token.ReadableAccountStore;
import com.hedera.node.app.service.token.TokenService;
import com.hedera.node.app.service.token.impl.WritableAccountStore;
import com.hedera.node.app.service.token.records.ChildRecordFinalizer;
import com.hedera.node.app.service.token.records.CryptoCreateRecordBuilder;
import com.hedera.node.app.services.ServiceScopeLookup;
import com.hedera.node.app.signature.KeyVerifier;
Expand Down Expand Up @@ -173,6 +174,9 @@ class HandleContextImplTest extends StateTestBase implements Scenarios {
@Mock
private SolvencyPreCheck solvencyPreCheck;

@Mock
private ChildRecordFinalizer childRecordFinalizer;

@Mock
private SelfNodeInfo selfNodeInfo;

Expand Down Expand Up @@ -218,7 +222,8 @@ private HandleContextImpl createContext(final TransactionBody txBody) {
exchangeRateManager,
DEFAULT_CONSENSUS_NOW,
authorizer,
solvencyPreCheck);
solvencyPreCheck,
childRecordFinalizer);
}

@SuppressWarnings("ConstantConditions")
Expand Down Expand Up @@ -246,7 +251,8 @@ void testConstructorWithInvalidArguments() {
exchangeRateManager,
DEFAULT_CONSENSUS_NOW,
authorizer,
solvencyPreCheck
solvencyPreCheck,
childRecordFinalizer
};

final var constructor = HandleContextImpl.class.getConstructors()[0];
Expand Down Expand Up @@ -311,7 +317,8 @@ void setUp() {
exchangeRateManager,
DEFAULT_CONSENSUS_NOW,
authorizer,
solvencyPreCheck);
solvencyPreCheck,
childRecordFinalizer);
}

@Test
Expand Down Expand Up @@ -827,7 +834,8 @@ private HandleContextImpl createContext(final TransactionBody txBody, final Tran
exchangeRateManager,
DEFAULT_CONSENSUS_NOW,
authorizer,
solvencyPreCheck);
solvencyPreCheck,
childRecordFinalizer);
}

@SuppressWarnings("ConstantConditions")
Expand Down
Loading
Loading