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] - node, api: split out private api and rework api configuration #4213

Closed
wants to merge 15 commits into from

Conversation

dshulyak
Copy link
Contributor

@dshulyak dshulyak commented Mar 28, 2023

closes: #3883
needs: spacemeshos/api#226

      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.


🤖 Generated by Copilot at 2abafcf

This pull request refactors the API configuration and implementation to support multiple GRPC servers and services, and adds a new feature to allow smeshers to update and switch between PoET servers. It also updates the tests, logging, and presets to use the new configuration and services. It modifies the following files: api/config/config.go, api/grpcserver/grpc.go, api/grpcserver/grpcserver_test.go, api/grpcserver/http_server.go, api/grpcserver/node_service.go, api/grpcserver/smesher_service.go, api/grpcserver/transaction_service_test.go, cmd/base.go, cmd/node/node_test.go, cmd/node/node.go, activation/interface.go, activation/mocks.go, api/grpcserver/smesher_service_test.go, api/node.go, cmd/bootstrapper/generator_test.go, cmd/root.go, config/presets/fastnet.go, config/presets/testnet.go, go.mod, and systest/parameters/fastnet/smesher.json.

@codecov
Copy link

codecov bot commented Mar 28, 2023

Codecov Report

Merging #4213 (2abafcf) into develop (5325c04) will increase coverage by 0.0%.
The diff coverage is 88.3%.

@@           Coverage Diff           @@
##           develop   #4213   +/-   ##
=======================================
  Coverage     76.3%   76.3%           
=======================================
  Files          240     240           
  Lines        25086   25078    -8     
=======================================
- Hits         19151   19145    -6     
+ Misses        4728    4726    -2     
  Partials      1207    1207           
Impacted Files Coverage Δ
api/grpcserver/node_service.go 65.9% <ø> (-2.8%) ⬇️
config/presets/fastnet.go 100.0% <ø> (+3.1%) ⬆️
config/presets/testnet.go 100.0% <ø> (+3.1%) ⬆️
api/grpcserver/http_server.go 88.4% <60.0%> (-3.5%) ⬇️
api/grpcserver/smesher_service.go 63.9% <90.9%> (+1.7%) ⬆️
api/config/config.go 100.0% <100.0%> (+3.2%) ⬆️
api/grpcserver/grpc.go 88.8% <100.0%> (+7.8%) ⬆️

... and 17 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.

@brusherru
Copy link
Member

One important moment, NodeService contains some endpoints that should work well on a remote API: Status, Build, Version, Echo, StatusStream. However, the rest endpoints should be private or completely removed: UpdatePoetServers, ErrorStream, SyncStart (remove?), Shutdown (already deprecated as I know).

Instead of doing some complicated separation of endpoints within the Service, I propose to move them to another Service (e.g. AdminService). What do you think?

@dshulyak
Copy link
Contributor Author

Instead of doing some complicated separation of endpoints within the Service, I propose to move them to another Service (e.g. AdminService). What do you think?

sure, if thats what you prefer i will move them

@dshulyak
Copy link
Contributor Author

@brusherru actually does it makes sense if i remove Shutdown/StartSync completely, and move UpdatePoetServers to Smeshing api. and move Node to the list of public services?

@brusherru
Copy link
Member

@dshulyak yes, sounds good to me! And much better than one more service! :)

@dshulyak
Copy link
Contributor Author

@brusherru i moved stuff around the way we discussedd

Copy link
Contributor

@countvonzero countvonzero left a comment

Choose a reason for hiding this comment

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

please update the PR description. thanks

SmesherStreamInterval: defaultSmesherStreamInterval,
PublicServices: []Service{Debug, Gateway, GlobalState, Mesh, Transaction, Node},
PublicListener: "0.0.0.0:9092",
PrivateServices: []Service{Smesher},
Copy link
Contributor

Choose a reason for hiding this comment

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

it almost feels like we should call this Admin

Copy link
Member

@brusherru brusherru left a comment

Choose a reason for hiding this comment

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

LGTM

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@dshulyak
Copy link
Contributor Author

bors cancel

@bors
Copy link

bors bot commented Apr 11, 2023

Canceled.

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@bors
Copy link

bors bot commented Apr 11, 2023

Build failed:

  • systest-status

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@bors
Copy link

bors bot commented Apr 11, 2023

Build failed:

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@bors
Copy link

bors bot commented Apr 11, 2023

Build failed:

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@bors
Copy link

bors bot commented Apr 11, 2023

Build failed:

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 11, 2023
closes: #3883
needs: spacemeshos/api#226

```
      --grpc-json-listener string                     Socket for the grpc gateway for the list of services in grpc-public-services. If left empty - grpc gateway won't be enabled.
      --grpc-private-listener string                  Socket for the list of services specified in grpc-private-services. (default "127.0.0.1:9093")
      --grpc-private-services strings                 List of services that must be kept private or exposed only in secure environments. (default [smesher])
      --grpc-public-listener string                   Socket for the list of services specified in grpc-public-services. (default "0.0.0.0:9092")
      --grpc-public-services strings                  List of services that are safe to open for the network. (default [debug,gateway,global,mesh,transaction,node])
      --grpc-recv-msg-size int                        GRPC api recv message size (default 10485760)
      --grpc-send-msg-size int                        GRPC api send message size (default 10485760)
```

we support two different sockets where services can be enabled. public (default to 0.0.0.0:9092) and private (defaults to 127.0.0.1:9093). by default we run smesher on private, and everything else on public. this can be changed by option above.
@bors
Copy link

bors bot commented Apr 11, 2023

Pull request successfully merged into develop.

Build succeeded:

@bors bors bot changed the title node, api: split out private api and rework api configuration [Merged by Bors] - node, api: split out private api and rework api configuration Apr 11, 2023
@bors bors bot closed this Apr 11, 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.

Extract Node Management commands from public APIs to IPC
4 participants