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

[Merged by Bors] - GRPC service to retrieve state of post proving #5651

Closed
wants to merge 12 commits into from

Conversation

poszu
Copy link
Contributor

@poszu poszu commented Mar 7, 2024

Description

Added a new GRPC service that provides a way to get the state of POST proving for all registered identities.

Each identity starts as Idle and transitions to Proving when POST proving phase starts (when the post-service becomes required). This informs the operator that it is time to switch the post-service ON.
The state transitions back to Idle in one of two conditions:

  • post proving completed successfully,
  • we selected a new nipost challenge. In this situation, the node will need to re-register in poet and will not need to prove until it gets a new poet proof (i.e. for ~2 weeks).

The state does NOT transition from Proving to Idle when post proving fails because it might retry (and hence need the post-service again) and we don't want to confuse the operator with multiple state switches.

Test Plan

Added unit tests

TODO

  • Explain motivation or link existing issue(s)
  • Test changes and document test plan
  • Update documentation as needed
  • Update changelog as needed

activation/post_states.go Outdated Show resolved Hide resolved
api/grpcserver/interface.go Outdated Show resolved Hide resolved
api/grpcserver/config.go Outdated Show resolved Hide resolved
activation/post_states.go Outdated Show resolved Hide resolved
@poszu poszu force-pushed the post-info-service branch from 610eb08 to 00b45c0 Compare March 7, 2024 12:11
@poszu poszu changed the base branch from develop to register-supervised-id-after-init March 7, 2024 12:11
@spacemesh-bors spacemesh-bors bot changed the base branch from register-supervised-id-after-init to develop March 7, 2024 12:12
@poszu poszu force-pushed the post-info-service branch from 00b45c0 to 43f1961 Compare March 7, 2024 12:50
Co-authored-by: Matthias Fasching <[email protected]>
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 90.54054% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 79.7%. Comparing base (3e59df3) to head (32bce25).
Report is 3 commits behind head on develop.

Files Patch % Lines
api/grpcserver/post_info_service.go 80.0% 4 Missing ⚠️
common/types/post.go 75.0% 2 Missing ⚠️
node/node.go 83.3% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #5651    +/-   ##
========================================
  Coverage     79.7%   79.7%            
========================================
  Files          274     279     +5     
  Lines        27883   28259   +376     
========================================
+ Hits         22228   22550   +322     
- Misses        4108    4145    +37     
- Partials      1547    1564    +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1432,6 +1436,10 @@ func (app *App) grpcService(svc grpcserver.Service, lg log.Log) (grpcserver.Serv
service := grpcserver.NewPostService(app.addLogger(PostServiceLogger, lg).Zap())
app.grpcServices[svc] = service
return service, nil
case grpcserver.PostInfo:
service := grpcserver.NewPostInfoService(app.addLogger(PostInfoServiceLogger, lg).Zap(), app.atxBuilder)
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to pass postStates here instead of app.atxBuilder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but it would require making more code use the types.IdentityDescriptor because the PostInfoService needs to map types.IdentityDescriptor -> types.PostState (not types.NodeID). I think about changing Nipostbuilder::Proof to use it (instead of NodeID) so that it can log the name too in post service not connected - waiting for reconnection {"service id": "5ea2c9975a185eeaa40bc9351297aa98c85952553f0fde4707ad783943c65e2e", "error": "post service not registered"} in a follow up.

@poszu
Copy link
Contributor Author

poszu commented Mar 7, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Mar 7, 2024
@spacemesh-bors
Copy link

spacemesh-bors bot commented Mar 7, 2024

Build failed:

@poszu
Copy link
Contributor Author

poszu commented Mar 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Mar 8, 2024
@poszu
Copy link
Contributor Author

poszu commented Mar 8, 2024

bors cancel

@spacemesh-bors
Copy link

spacemesh-bors bot commented Mar 8, 2024

Canceled.

@poszu
Copy link
Contributor Author

poszu commented Mar 8, 2024

bors merge

spacemesh-bors bot pushed a commit that referenced this pull request Mar 8, 2024
@spacemesh-bors
Copy link

spacemesh-bors bot commented Mar 8, 2024

Pull request successfully merged into develop.

Build succeeded:

@spacemesh-bors spacemesh-bors bot changed the title GRPC service to retrieve state of post proving [Merged by Bors] - GRPC service to retrieve state of post proving Mar 8, 2024
@spacemesh-bors spacemesh-bors bot closed this Mar 8, 2024
@spacemesh-bors spacemesh-bors bot deleted the post-info-service branch March 8, 2024 10:59
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.

2 participants