-
Notifications
You must be signed in to change notification settings - Fork 143
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
refactor: adapt StatsSigningTestingTool to work with Bytes wrapper for transactions #17144
base: main
Are you sure you want to change the base?
refactor: adapt StatsSigningTestingTool to work with Bytes wrapper for transactions #17144
Conversation
Signed-off-by: Mustafa Uzun <[email protected]>
…r transactions Signed-off-by: Ivan Kavaldzhiev <[email protected]>
…igningTestingTool-to-work-with-Bytes
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
…ransactions' into 16871-adapt-StatsSigningTestingTool-to-work-with-Bytes # Conflicts: # platform-sdk/platform-apps/tests/StatsSigningTestingTool/src/main/java/com/swirlds/demo/stats/signing/StatsSigningTestingToolState.java Signed-off-by: Ivan Kavaldzhiev <[email protected]>
…ransactions' into 16871-adapt-StatsSigningTestingTool-to-work-with-Bytes
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #17144 +/- ##
=============================================
+ Coverage 64.28% 64.40% +0.11%
- Complexity 20886 20921 +35
=============================================
Files 2549 2549
Lines 95969 95983 +14
Branches 10041 10045 +4
=============================================
+ Hits 61690 61814 +124
+ Misses 30653 30532 -121
- Partials 3626 3637 +11
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
@@ -313,4 +315,9 @@ public PlatformMerkleStateRoot newMerkleStateRoot() { | |||
public BasicSoftwareVersion getSoftwareVersion() { | |||
return softwareVersion; | |||
} | |||
|
|||
@Override | |||
public Bytes encodeSystemTransaction(@NonNull StateSignatureTransaction transaction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add final
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
if (areTransactionBytesSystemOnes((ConsensusTransaction) transaction)) { | ||
stateSignatureTransactions.accept( | ||
new ScopedSystemTransaction(event.getCreatorId(), event.getSoftwareVersion(), transaction)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can return after this, since the application should not do anything with the system transactions other than invoke the callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Fixed
round.forEachTransaction(this::handleTransaction); | ||
|
||
round.forEachEventTransaction((event, transaction) -> { | ||
final var transactionWithSystemBytes = handleTransaction(transaction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check if it is a system transaction here in the lambda before invoking handleTransaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
…igningTestingTool-to-work-with-Bytes # Conflicts: # platform-sdk/platform-apps/demos/CryptocurrencyDemo/src/main/java/com/swirlds/demo/crypto/CryptocurrencyDemoState.java # platform-sdk/platform-apps/demos/HelloSwirldDemo/src/main/java/com/swirlds/demo/hello/HelloSwirldDemoState.java # platform-sdk/platform-apps/demos/StatsDemo/src/main/java/com/swirlds/demo/stats/StatsDemoState.java # platform-sdk/platform-apps/tests/AddressBookTestingTool/src/main/java/com/swirlds/demo/addressbook/AddressBookTestingToolState.java # platform-sdk/platform-apps/tests/ConsistencyTestingTool/src/main/java/com/swirlds/demo/consistency/ConsistencyTestingToolState.java # platform-sdk/platform-apps/tests/ISSTestingTool/src/main/java/com/swirlds/demo/iss/ISSTestingToolState.java # platform-sdk/platform-apps/tests/MigrationTestingTool/src/main/java/com/swirlds/demo/migration/MigrationTestingToolState.java # platform-sdk/platform-apps/tests/PlatformTestingTool/src/main/java/com/swirlds/demo/platform/PlatformTestingToolState.java # platform-sdk/platform-apps/tests/StatsSigningTestingTool/src/main/java/com/swirlds/demo/stats/signing/StatsSigningTestingToolState.java # platform-sdk/platform-apps/tests/StressTestingTool/src/main/java/com/swirlds/demo/stress/StressTestingToolState.java # platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/PlatformMerkleStateRoot.java # platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/system/SwirldState.java # platform-sdk/swirlds-platform-core/src/test/java/com/swirlds/platform/turtle/runner/TurtleTestingToolState.java # platform-sdk/swirlds-platform-core/src/testFixtures/java/com/swirlds/platform/test/fixtures/state/BlockingSwirldState.java Signed-off-by: Ivan Kavaldzhiev <[email protected]>
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
private boolean areTransactionBytesSystemOnes(final ConsensusTransaction transaction) { | ||
// We have maximum allocation of 100 bytes for the transaction + 10 bytes for the preamble size in | ||
// TransactionCodec | ||
// + 64 bytes for the maximum public key size + 64 bytes for the maximum signature size + 12 bytes for 3 | ||
// integers | ||
final var maximumSignedEncodedTransactionSize = 100 + 10 + 64 + 64 + 12; | ||
return transaction.getApplicationTransaction().length() > maximumSignedEncodedTransactionSize; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this app has a configurable transaction size, so size cannot be used to differentiate between system and app
Description:
This PR updates StatsSigningTestingTool to work with the new Bytes format of system transactions.
Related issue(s):
Fixes #16871
Notes for reviewer:
Checklist