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

Implement FreezeService preHandle #5988

Merged
merged 8 commits into from Apr 7, 2023
Merged

Conversation

kimbor
Copy link
Member

@kimbor kimbor commented Apr 5, 2023

Implement FreezeService preHandle for Admin module

Issue #4464

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>
@kimbor kimbor self-assigned this Apr 5, 2023
@kimbor kimbor marked this pull request as ready for review April 5, 2023 20:10
@kimbor kimbor requested review from a team and povolev15 as code owners April 5, 2023 20:10
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Node: Unit Test Results

  1 298 files    1 298 suites   1h 51m 11s ⏱️
97 051 tests 97 044 ✔️ 7 💤 0
98 691 runs  98 684 ✔️ 7 💤 0

Results for commit d4f5a25.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Patch coverage: 71.42% and project coverage change: +23.19 🎉

Comparison is base (c43b5f1) 68.14% compared to head (d4f5a25) 91.34%.

Additional details and impacted files
@@              Coverage Diff               @@
##             develop    #5988       +/-   ##
==============================================
+ Coverage      68.14%   91.34%   +23.19%     
+ Complexity     21953    16984     -4969     
==============================================
  Files           1960     1274      -686     
  Lines         133554    48540    -85014     
  Branches        7519     4849     -2670     
==============================================
- Hits           91013    44339    -46674     
+ Misses         41079     3275    -37804     
+ Partials        1462      926      -536     
Impacted Files Coverage Δ
...p/service/admin/impl/ReadableSpecialFileStore.java 0.00% <0.00%> (ø)
...admin/impl/codec/MonoSpecialFilesAdapterCodec.java 95.00% <ø> (ø)
...-app/src/main/java/com/hedera/node/app/Hedera.java 0.00% <0.00%> (ø)
...edera/node/app/state/merkle/MerkleHederaState.java 61.86% <0.00%> (ø)
...app/workflows/dispatcher/ReadableStoreFactory.java 53.84% <0.00%> (-9.80%) ⬇️
...pp/workflows/dispatcher/TransactionDispatcher.java 44.44% <0.00%> (ø)
...e/app/service/network/impl/NetworkServiceImpl.java 100.00% <ø> (ø)
...app/service/admin/impl/handlers/FreezeHandler.java 90.47% <89.47%> (-9.53%) ⬇️
...node/app/service/admin/impl/FreezeServiceImpl.java 100.00% <100.00%> (ø)

... and 921 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Node: E2E Test Results

    1 files      1 suites   16m 45s ⏱️
308 tests 308 ✔️ 0 💤 0
326 runs  326 ✔️ 0 💤 0

Results for commit d4f5a25.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

Node: Integration Test Results

    3 files      3 suites   13m 32s ⏱️
150 tests 150 ✔️ 0 💤 0
151 runs  151 ✔️ 0 💤 0

Results for commit d4f5a25.

♻️ This comment has been updated with latest results.

Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>
netopyr
netopyr previously approved these changes Apr 6, 2023
Copy link
Contributor

@netopyr netopyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from a hedera-app perspective.

netopyr and others added 3 commits April 6, 2023 11:35
Signed-off-by: Michael Heinrichs <netopyr@users.noreply.github.com>
Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>
Signed-off-by: Kim Rader <kim.rader@swirldslabs.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 6, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

81.7% 81.7% Coverage
2.0% 2.0% Duplication

@kimbor kimbor requested review from iwsimon and netopyr April 6, 2023 19:11
Copy link
Contributor

@netopyr netopyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from hedera-app perspective

Copy link
Contributor

@iwsimon iwsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@povolev15 povolev15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kimbor kimbor merged commit 1c85769 into develop Apr 7, 2023
9 of 11 checks passed
@kimbor kimbor deleted the 04464-AdminService-preHandle branch April 7, 2023 00:08
Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review post merge.


// FREEZE_ONLY requires a valid start_time
case FREEZE_ONLY -> verifyFreezeStartTimeIsInFuture(
freezeTxn, context.getTxn().transactionID().transactionValidStart());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a new variable for context.getTxn().transactionID().transactionValidStart() on line 82


FreezeTransactionBody freezeTxn = context.getTxn().freeze();

try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest all validation go into a method called validate or preCheck or similar. And we call that method as first step in preHandle

Comment on lines +116 to +118

// all checks have passed
context.status(OK);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the default status is OK if nothing is set. So, I think this is not needed

Comment on lines +119 to +123
} catch (PreCheckException e) {
// instead of catching this exception, would like to allow it to propagate up
// this will be implemented in issue #5880
context.status(e.responseCode());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be catching any exceptions and setting status on context. It should be thrown as PrecheckException

Comment on lines +77 to +81
/**
* Get a {@link ReadableScheduleStore}
*
* @return a new {@link ReadableScheduleStore}
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo ReadableSpecialFileStore

@nickpoorman nickpoorman added this to the v0.38.0 milestone Apr 14, 2023
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.

None yet

7 participants