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: Implement consumer handler in the Simulator #360

Merged
merged 7 commits into from
Dec 6, 2024

Conversation

georgi-l95
Copy link
Contributor

@georgi-l95 georgi-l95 commented Nov 22, 2024

Description:
This pull request aims to make use of the consumer mode in the simulator, by adding needed implementations.
We add:

  • gRPC client and observer for consuming blocks, which utilizes SubscribeStreamRequest and SubscribeStreamResponse, which are part of the subscribeBlockStream rpc.
  • Makes the neccessery changes to initilize managers and clients, depending on mode.
  • Adds neccessery unit and integration tests for sufficient code coverage, by making use of as less mocks as possible.

Related issue(s):

Fixes #121

Notes for reviewer:

Checklist

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

@georgi-l95 georgi-l95 added the Simulator Issue related to Block Stream Simulator label Nov 22, 2024
@georgi-l95 georgi-l95 added this to the 0.3.0 milestone Nov 22, 2024
@georgi-l95 georgi-l95 self-assigned this Nov 22, 2024
@georgi-l95 georgi-l95 linked an issue Nov 22, 2024 that may be closed by this pull request
@georgi-l95 georgi-l95 marked this pull request as ready for review November 27, 2024 21:49
@georgi-l95 georgi-l95 requested a review from a team as a code owner November 27, 2024 21:49
@georgi-l95 georgi-l95 changed the title feat: WIP Implement consumer handler in the Simulator feat: Implement consumer handler in the Simulator Nov 27, 2024
Copy link
Contributor

@mattp-swirldslabs mattp-swirldslabs left a comment

Choose a reason for hiding this comment

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

I left a few suggestions

Copy link
Contributor

@ata-nas ata-nas left a comment

Choose a reason for hiding this comment

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

@georgi-l95 generally looks good on my first pass! It is nice to see a clear distinction of different components.

I do have some comments left here and there.

Also, please consider to write javadocs for the tests, since it is not possible to see what is the intent of the test and it is very hard to review them.

@georgi-l95 georgi-l95 force-pushed the 121-implement-consumer-logic-in-the-simulator branch from 8ac1a91 to b802207 Compare December 6, 2024 15:13
Signed-off-by: georgi-l95 <[email protected]>

chore: fix unit tests

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>

test: add unit tests

Signed-off-by: georgi-l95 <[email protected]>

test: add unit tests

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>

add temporary code

Signed-off-by: georgi-l95 <[email protected]>

fix unit tests

Signed-off-by: georgi-l95 <[email protected]>

fix loading block manager in consumer mode

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>

remove wildcard import

Signed-off-by: georgi-l95 <[email protected]>

address feedback

Signed-off-by: georgi-l95 <[email protected]>

address feedback

Signed-off-by: georgi-l95 <[email protected]>

address feedback

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
@georgi-l95 georgi-l95 force-pushed the 121-implement-consumer-logic-in-the-simulator branch from 10b59e7 to 40aca65 Compare December 6, 2024 15:53
Copy link
Contributor

@ata-nas ata-nas left a comment

Choose a reason for hiding this comment

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

Looks good @georgi-l95 !

Copy link
Contributor

@mattp-swirldslabs mattp-swirldslabs left a comment

Choose a reason for hiding this comment

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

Looks good

@georgi-l95 georgi-l95 merged commit b0270c1 into main Dec 6, 2024
11 checks passed
@georgi-l95 georgi-l95 deleted the 121-implement-consumer-logic-in-the-simulator branch December 6, 2024 17:18
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 99.01961% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.96%. Comparing base (a278936) to head (40aca65).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../block/simulator/generator/BlockStreamManager.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #360      +/-   ##
============================================
- Coverage     97.23%   96.96%   -0.27%     
- Complexity      375      395      +20     
============================================
  Files            76       79       +3     
  Lines          1338     1417      +79     
  Branches         91       93       +2     
============================================
+ Hits           1301     1374      +73     
- Misses           28       32       +4     
- Partials          9       11       +2     
Files with missing lines Coverage Δ
...a/com/hedera/block/common/utils/Preconditions.java 100.00% <100.00%> (ø)
...edera/block/simulator/BlockStreamSimulatorApp.java 80.43% <100.00%> (+3.83%) ⬆️
...ulator/generator/BlockAsDirBlockStreamManager.java 100.00% <100.00%> (ø)
...lator/generator/BlockAsFileBlockStreamManager.java 90.90% <100.00%> (-9.10%) ⬇️
...dera/block/simulator/grpc/GrpcInjectionModule.java 0.00% <ø> (ø)
...ulator/grpc/impl/ConsumerStreamGrpcClientImpl.java 100.00% <100.00%> (ø)
...ck/simulator/grpc/impl/ConsumerStreamObserver.java 100.00% <100.00%> (ø)
...mulator/grpc/impl/PublishStreamGrpcClientImpl.java 90.38% <100.00%> (ø)
...ock/simulator/grpc/impl/PublishStreamObserver.java 100.00% <100.00%> (ø)
.../block/simulator/metrics/SimulatorMetricTypes.java 100.00% <100.00%> (ø)
... and 4 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simulator Issue related to Block Stream Simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement consumer logic in the Simulator
3 participants