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

Integrate PoST draft API into node #5042

Closed
Tracked by #259 ...
fasmat opened this issue Sep 20, 2023 · 1 comment
Closed
Tracked by #259 ...

Integrate PoST draft API into node #5042

fasmat opened this issue Sep 20, 2023 · 1 comment
Assignees

Comments

@fasmat
Copy link
Member

fasmat commented Sep 20, 2023

Description

Update node to use the new gRPC API to query for proof from the PoST service instead of using the post library directly for proof generation.

Acceptance criteria

  • Node exposes endpoint a PoST service can connect to
    • For initial implementation assume only one PoST service connects to the node
  • Node queries PoST service when it wants to generate a proof
  • The initial API for the post service is defined in Draft API for Proof generation api#269
    • Completing and integrating this API is the goal of this ticket.

Implementation hints

@fasmat fasmat self-assigned this Sep 20, 2023
@fasmat fasmat moved this to 🏗 Doing in Dev team kanban Sep 20, 2023
bors bot pushed a commit that referenced this issue Oct 5, 2023
## Motivation
Part of #5042

This PR adds the GRPC API for the PoST service and adds tests verifying it works correctly.

## Changes
- PoST service is downloaded with tests and builds, as well as included in the `Dockerfile`
- `PostSetupManager` now uses `zap` directly instead of the `go-spacemesh/log` wrapper
- `grpcserver.PostService` uses the PoST service API is added to gRPCs `PrivateListener` endpoint
  - temporary, will be changed to public + authentication in the future
- Any amount of PoST services can connect to the API but only the first calling `Register` will be able to successfully create a stream
  - in the future this will be extended to allow any number of PoST services to connect
  - a successful `Register` will create a `PostClient` and notify all services that are `postConnectionListener` about the service connecting (and disconnecting)
- TODO: bundled PoST service is started when the node starts 

## Test Plan
- new tests have been added for gRPC API

## TODO
<!-- This section should be removed when all items are complete -->
- [x] Explain motivation or link existing issue(s)
- [x] Test changes and document test plan
- [x] Update documentation as needed
- [x] Update [changelog](../CHANGELOG.md) as needed
bors bot pushed a commit that referenced this issue Oct 6, 2023
## Motivation
Part of #5042

This PR adds the GRPC API for the PoST service and adds tests verifying it works correctly.

## Changes
- PoST service is downloaded with tests and builds, as well as included in the `Dockerfile`
- `PostSetupManager` now uses `zap` directly instead of the `go-spacemesh/log` wrapper
- `grpcserver.PostService` uses the PoST service API is added to gRPCs `PrivateListener` endpoint
  - temporary, will be changed to public + authentication in the future
- Any amount of PoST services can connect to the API but only the first calling `Register` will be able to successfully create a stream
  - in the future this will be extended to allow any number of PoST services to connect
  - a successful `Register` will create a `PostClient` and notify all services that are `postConnectionListener` about the service connecting (and disconnecting)
- TODO: bundled PoST service is started when the node starts 

## Test Plan
- new tests have been added for gRPC API

## TODO
<!-- This section should be removed when all items are complete -->
- [x] Explain motivation or link existing issue(s)
- [x] Test changes and document test plan
- [x] Update documentation as needed
- [x] Update [changelog](../CHANGELOG.md) as needed
bors bot pushed a commit that referenced this issue Oct 11, 2023
## Motivation
Part of #5042
Merge after #5091 

## Changes

- Generating poofs is now done via the GRPC API
  - Foundation laid in #5091
  - Upon connection `PostClient` is passed to services via the `postConnectionListener` interface. At the moment these are: `activation::Builder` and `activation::NIPostBuilder` who use it to generate a proof
  - Instead of starting the `PostSupervisor` when `PostServiceCmd` is set it is started when `StartSmeshing == true`
  - The connection does not require authentication (yet) - will be addressed in #5131 
  - Connection cannot handle multiple post services (yet)
- NiPoSTBuilder doesn't verify PoST proofs any more
  - PoST Service does this already before providing the proof
  - additionally when publishing the ATX it goes through the ATX handler that validates the ATX again before broadcasting it.
- Refactored tests in `activation` package to use new API
  - Integration tests that do not use mocks for generating PoST proofs have been moved to `activation/e2e` to allow the use of the `api/grpcserver` package in them
  - `e2e` tests spin up a post service using the post supervisor and query a proof from there
- Slimmed down `postSetupProvider` interface:
  - it is used by the `activation::Builder` and implemented by `activation::PostSetupManager`
  - some of its functionality has been moved into `PostClient` (`GenerateProof` -> `Proof`)
- Replaced `go-spacemesh/log` with `zap` in a few components in the `activation` package.

## Test Plan
- All existing tests involving proof generation have been migrated to use the new PoST service
- New tests added to test the connection specifically.
- Test added for custom types in config.

## TODO
<!-- This section should be removed when all items are complete -->
- [x] Explain motivation or link existing issue(s)
- [x] Test changes and document test plan
- [x] Update documentation as needed
- [x] Update [changelog](../CHANGELOG.md) as needed
@fasmat fasmat moved this from 🏗 Doing to ✅ Done in Dev team kanban Oct 12, 2023
@fasmat fasmat closed this as completed Oct 12, 2023
@fasmat fasmat moved this from ✅ Done to 🏗 Doing in Dev team kanban Oct 12, 2023
@fasmat
Copy link
Member Author

fasmat commented Oct 12, 2023

Reopened because spacemeshos/api#269 isn't done yet.

@fasmat fasmat reopened this Oct 12, 2023
@fasmat fasmat moved this from 🏗 Doing to ✅ Done in Dev team kanban Oct 19, 2023
@fasmat fasmat closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

1 participant