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

Add Orchestrator gRPC API #1771

Merged
merged 11 commits into from
Apr 8, 2020
Merged

Add Orchestrator gRPC API #1771

merged 11 commits into from
Apr 8, 2020

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Apr 3, 2020

Related to #1764

This PR adds the Orchestrator API.

This API requires authentication by verifying a base64-encoded signature of the request, set in the request's metadata using the key mesg_request_signature.

It defines the following RPC functions:

service Event {
  // Stream returns a stream of events that satisfy criteria specified.
  rpc Stream(EventStreamRequest) returns (stream types.Event) {}
}

service Execution {
  // Create an execution on the blockchain.
  rpc Create(ExecutionCreateRequest) returns (ExecutionCreateResponse) {}

  // Stream returns a stream of executions that satisfy specified filter.
  rpc Stream(ExecutionStreamRequest) returns (stream types.Execution) {}
}

service Runner {
  // Register registers a new runner to the Engine.
  // This endpoint should only be called when the runner is ready to receive execution and emit events.
  // This endpoint returns a credential token that must be use to reach the Runner APIs.
  rpc Register(RunnerRegisterRequest) returns (RunnerRegisterResponse) {}

  // Delete a runner from the blockchain.
  rpc Delete(RunnerDeleteRequest) returns (RunnerDeleteResponse) {}
}

Note: the runner register rpc has been moved from Runner API to this Orchestrator API.

@NicolasMahe NicolasMahe requested a review from antho1404 April 3, 2020 12:15
@NicolasMahe NicolasMahe self-assigned this Apr 3, 2020
@NicolasMahe NicolasMahe added this to the next milestone Apr 3, 2020
@NicolasMahe NicolasMahe added the release:add Pull requests that add something label Apr 3, 2020
server/grpc/admin/admin.go Outdated Show resolved Hide resolved
server/grpc/admin/admin.proto Outdated Show resolved Hide resolved
server/grpc/server.go Outdated Show resolved Hide resolved
@antho1404
Copy link
Member

I had some issues with the validation of the pub key. Here is my config.yml file (generated from mesg-foundation/js-sdk#221). The key seems valid but the engines send me an error.

AuthorizedPubKeys[0] must be a valid bech32accpubkey
authorized_pubkeys:
  - mesgtestpub1pakk3s28ym3pjj443e4g3u3jnch04cuhgjdfqx
account:
  mnemonic: >-
    guard paddle nature laptop space patient one wait airport side buffalo
    ceiling prevent ten planet immune sample duty fox box option know slot bone

What am I missing?

@NicolasMahe
Copy link
Member Author

I had some issues with the validation of the pub key. Here is my config.yml file (generated from mesg-foundation/js-sdk#221). The key seems valid but the engines send me an error.

AuthorizedPubKeys[0] must be a valid bech32accpubkey
authorized_pubkeys:
  - mesgtestpub1pakk3s28ym3pjj443e4g3u3jnch04cuhgjdfqx
account:
  mnemonic: >-
    guard paddle nature laptop space patient one wait airport side buffalo
    ceiling prevent ten planet immune sample duty fox box option know slot bone

What am I missing?

Your pubkey seems truncated. The one I'm using is much longer: mesgtestpub1addwnpepqwl7axwafcqnc9z92eyrl835w6j54r8806x3lnnqedydt47j6papjmn0439

@NicolasMahe NicolasMahe force-pushed the feature/admin-grpc-api branch from 489b6b7 to 258ff4d Compare April 6, 2020 10:26
@NicolasMahe NicolasMahe marked this pull request as ready for review April 6, 2020 10:26
@NicolasMahe NicolasMahe changed the title Add admin gRPC API Add Orchestrator gRPC API Apr 6, 2020
@NicolasMahe NicolasMahe mentioned this pull request Apr 6, 2020
3 tasks
Comment on lines +32 to +33
// TODO: to switch when e2e tests doesn't create any event
// EventClient orchestrator.EventClient
Copy link
Member Author

@NicolasMahe NicolasMahe Apr 6, 2020

Choose a reason for hiding this comment

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

alreadySeeHashes[attr] = true
hash, err := hash.Decode(attr)
if err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

Is it a good thing to return the error here, shouldn't we have an error channel?
Here the first error will actually stop the whole stream.
Might have the same issue on the runner API which might be more critical

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no error channel with gRPC streams. The only way to return the error to the client is to return it as it does.

server/grpc/orchestrator/execution.proto Outdated Show resolved Hide resolved
server/grpc/orchestrator/execution.proto Outdated Show resolved Hide resolved
server/grpc/orchestrator/runner.go Show resolved Hide resolved
server/grpc/server.go Show resolved Hide resolved
@antho1404 antho1404 merged commit 8a81e80 into dev Apr 8, 2020
@antho1404 antho1404 deleted the feature/admin-grpc-api branch April 8, 2020 09:16
@NicolasMahe NicolasMahe mentioned this pull request Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:add Pull requests that add something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants