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(cmd-api-server): add gRPC plugin auto-registration support #3173

Conversation

petermetz
Copy link
Contributor

  1. The API server supports gRPC endpoints, but plugins are not yet able
    to register their own gRPC services to be exposed the same way that was
    already possible for HTTP endpoints to be registered dynamically. This
    was due to an oversight when the original contribution was made by Peter
    (who was the person making the oversight - good job Peter)
  2. The functionality works largely the same as it does for the HTTP
    endpoints but it does so for gRPC services (which is the equivalent of
    endpoints in gRPC terminology, so service === endpoint in this context.)
  3. There are new methods added to the public API surface of the API server
    package which can be used to construct gRPC credential and server objects
    using the instance of the library that is used by the API server.
    This is necessary because the validation logic built into grpc-js fails
    for these mentioned objects if the creds or the server was constructed
    with a different instance of the library than the one used by the API
    server.
  4. Different instance in this context means just that the exact same
    version of the library was imported from a different path for example
    there could be the node_modules directory of the besu connector and also
    the node_modules directory of the API server.
  5. Because of the problem outlined above, the only way we can have functioning
    test cases is if the API server exposes its own instance of grpc-js.

Signed-off-by: Peter Somogyvari peter.somogyvari@accenture.com

Pull Request Requirements

  • Rebased onto upstream/main branch and squashed into single commit to help maintainers review it more efficient and to avoid spaghetti git commit graphs that obfuscate which commit did exactly what change, when and, why.
  • Have git sign off at the end of commit message to avoid being marked red. You can add -s flag when using git commit command. You may refer to this link for more information.
  • Follow the Commit Linting specification. You may refer to this link for more information.

Character Limit

  • Pull Request Title and Commit Subject must not exceed 72 characters (including spaces and special characters).
  • Commit Message per line must not exceed 80 characters (including spaces and special characters).

A Must Read for Beginners
For rebasing and squashing, here's a must read guide for beginners.

1. The API server supports gRPC endpoints, but plugins are not yet able
to register their own gRPC services to be exposed the same way that was
already possible for HTTP endpoints to be registered dynamically. This
was due to an oversight when the original contribution was made by Peter
(who was the person making the oversight - good job Peter)
2. The functionality works largely the same as it does for the HTTP
endpoints but it does so for gRPC services (which is the equivalent of
endpoints in gRPC terminology, so service === endpoint in this context.)
3. There are new methods added to the public API surface of the API server
package which can be used to construct gRPC credential and server objects
using the instance of the library that is used by the API server.
This is necessary because the validation logic built into grpc-js fails
for these mentioned objects if the creds or the server was constructed
with a different instance of the library than the one used by the API
server.
4. Different instance in this context means just that the exact same
version of the library was imported from a different path for example
there could be the node_modules directory of the besu connector and also
the node_modules directory of the API server.
5. Because of the problem outlined above, the only way we can have functioning
test cases is if the API server exposes its own instance of grpc-js.

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz force-pushed the feat-cmd-api-server-grpc-plugin-auto-registration branch from 17fd7b4 to 37e7720 Compare April 4, 2024 15:05
@petermetz petermetz merged commit 5762dad into hyperledger-cacti:main Apr 4, 2024
128 of 141 checks passed
@petermetz petermetz deleted the feat-cmd-api-server-grpc-plugin-auto-registration branch April 4, 2024 15:51
petermetz added a commit to petermetz/cacti that referenced this pull request Apr 4, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on hyperledger-cacti#3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this pull request May 24, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on hyperledger-cacti#3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit to petermetz/cacti that referenced this pull request May 29, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on hyperledger-cacti#3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
petermetz added a commit that referenced this pull request May 29, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on #3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
fazzatti pushed a commit to fazzatti/cacti that referenced this pull request Jun 24, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on hyperledger-cacti#3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
sandeepnRES pushed a commit to sandeepnRES/cacti that referenced this pull request Jul 30, 2024
1. The Besu connector now can be reached via the gRPC interface.
2. The same operations are exposed as via HTTP+SocketIO
3. gRPC supports bi-directional streaming so the block watching is also
supported and test coverage verifies that it works.
4. To see an example of how to use the gRPC client of the Besu connector
read the source code of the test case that provides the verification that
the functionality works:
```
packages/cactus-test-plugin-ledger-connector-besu/src/test/typescript/
integration/grpc-services/connector-besu-grpc-services.test.ts
```

Depends on hyperledger-cacti#3173

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
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.

3 participants