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

[AppGate] Implement the MVP AppGateServer #108

Merged
merged 42 commits into from
Nov 10, 2023
Merged

[AppGate] Implement the MVP AppGateServer #108

merged 42 commits into from
Nov 10, 2023

Conversation

red-0ne
Copy link
Contributor

@red-0ne red-0ne commented Oct 28, 2023

Summary

Human Summary

AppGateServer implementation that supports JSONRPC over HTTP. Used to sign and send RelayRequests, verify the corresponding RelayResponse's supplier signature and reply to the client with the original service response.

The appGateServer will build rings for the application and cache them in order to send relays to the network signed. This PR also implements signature verification for the RelayerProxy.

This PR adds the cobra cmd to start the AppGateServer from the CLI.

Outstanding TODOs:

  • Move the rign creation and caching logic into a shared package
  • Emit delegation events from the App module and listen for these to know when to invalidate a cached ring

AI Summary

Summary generated by Reviewpad on 10 Nov 23 22:45 UTC

This pull request introduces various changes to several files. Here is a summary of the changes:

  1. root.go: Adds support for an appgate server command to the existing root command.

  2. go.sum: Adds new dependencies to the project.

  3. simple_signer.go: Adds the implementation of the SimpleSigner type, which provides functionality for signing messages using a keyring and key name.

  4. appgateserver.go: Provides logic related to creating and managing rings for signing relays in the appgateserver package.

  5. relay_verifier.go: Makes changes related to verifying relay request and response signatures.

  6. endpoint_selector.go: Adds functionality for selecting a relayer endpoint based on service ID and JSON RPC type.

  7. errors.go: Defines error variables registered using sdkerrors.Register for the appgateserver and relayer packages.

  8. interface.go: Introduces the Signer interface, which abstracts the signing of a message.

  9. options.go: Adds functions for setting signing information and listening URL for the appgate server.

  10. session.go: Adds functionality for retrieving the current session for a given service in the appgateserver package.

  11. relay.go: Adds methods for generating signable bytes for relay requests and responses.

  12. proxy package: Adds functions related to creating and managing rings for signing relays in the proxy package.

  13. options.go: Adds functions for setting signing information and listening URL for the appgate server.

  14. session.go: Adds functionality for retrieving the current session for a given service in the appgateserver package.

  15. relay.go: Adds methods for generating signable bytes for relay requests and responses.

  16. errors.go: Makes changes to error variables in the relayer/proxy package.

  17. go.mod: Adds new dependencies to the project.

  18. pkg/client/block/client.go: Updates the block client functionality and error handling.

  19. prog.go: Deletes the file containing code for generating a package using GoMock reflections.

  20. proxy.go: Adds new import statements and additional fields related to the application module and ring caching.

  21. appGateServer.go: Contains the implementation of the appGateServer struct, which handles listening to application requests, signing and relaying them, and verifying response signatures.

Please review these changes for your pull request.

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make go_develop_and_test
  • Verify Localnet manually: See the instructions [here](TODO: add link to instructions)

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@red-0ne red-0ne added application Changes related to the Application actor off-chain Off-chain business logic labels Oct 28, 2023
@red-0ne red-0ne added this to the Shannon TestNet milestone Oct 28, 2023
@red-0ne red-0ne self-assigned this Oct 28, 2023
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/jsonrpc.go Outdated Show resolved Hide resolved
h5law
h5law previously requested changes Oct 28, 2023
Copy link
Contributor

@h5law h5law left a comment

Choose a reason for hiding this comment

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

Left a few comments on adding some TODOs for me to pick up. But this is great work bringing over the MVP 10/10

pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/appclient.go Outdated Show resolved Hide resolved
pkg/appclient/jsonrpc.go Outdated Show resolved Hide resolved
pkg/appclient/jsonrpc.go Outdated Show resolved Hide resolved
pkg/appclient/jsonrpc.go Outdated Show resolved Hide resolved
pkg/appclient/relay_verifier.go Outdated Show resolved Hide resolved
pkg/appclient/relay_verifier.go Outdated Show resolved Hide resolved
@h5law
Copy link
Contributor

h5law commented Nov 6, 2023

@red-0ne @Olshansk I will be picking this up tmrw 20231107 and bringing it into main for the E2E relay and will address all the comments when I do <3 exciting times!!!!

@red-0ne
Copy link
Contributor Author

red-0ne commented Nov 7, 2023

@red-0ne @Olshansk I will be picking this up tmrw 20231107 and bringing it into main for the E2E relay and will address all the comments when I do <3 exciting times!!!!

I addressed most of the comments, but haven't touched the signature parts yet. As per @Olshansk comments signatures should go into Relay(Request/Reply) methods.

@red-0ne red-0ne requested a review from h5law November 7, 2023 11:23
@red-0ne red-0ne assigned h5law and unassigned red-0ne Nov 7, 2023
@h5law h5law dismissed their stale review November 10, 2023 21:18

I am now making the changes

@h5law h5law requested a review from Olshansk November 10, 2023 21:18
pkg/appgateserver/options.go Outdated Show resolved Hide resolved
pkg/appgateserver/relay_verifier.go Outdated Show resolved Hide resolved
pkg/appgateserver/relay_verifier.go Outdated Show resolved Hide resolved
pkg/appgateserver/relay_verifier.go Show resolved Hide resolved
pkg/appgateserver/relay_verifier.go Outdated Show resolved Hide resolved
pkg/appgateserver/rings.go Outdated Show resolved Hide resolved
pkg/appgateserver/rings.go Outdated Show resolved Hide resolved
pkg/appgateserver/rings.go Outdated Show resolved Hide resolved
pkg/appgateserver/cmd/cmd.go Outdated Show resolved Hide resolved
pkg/appgateserver/cmd/cmd.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Show resolved Hide resolved
pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Show resolved Hide resolved
pkg/appgateserver/server.go Outdated Show resolved Hide resolved
pkg/appgateserver/server.go Show resolved Hide resolved
pkg/relayer/proxy/rings.go Show resolved Hide resolved
pkg/appgateserver/cmd/cmd.go Outdated Show resolved Hide resolved
pkg/appgateserver/cmd/cmd.go Outdated Show resolved Hide resolved
"github.com/cometbft/cometbft/crypto"
accounttypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/noot/ring-go"
Copy link
Member

Choose a reason for hiding this comment

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

Just FYI that this is finally happening @noot :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Big up @noot loving the ring library <3

pkg/relayer/proxy/relay_verifier.go Outdated Show resolved Hide resolved
pkg/client/block/client.go Show resolved Hide resolved
pkg/appgateserver/session.go Show resolved Hide resolved
@Olshansk Olshansk mentioned this pull request Nov 10, 2023
10 tasks
@h5law h5law requested a review from Olshansk November 10, 2023 22:41
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

DALL·E 2023-11-10 15 06 47 - Impressionist style mixed media painting crafted with metallic ink and watercolor, depicting a captivating scene symbolic of the Pocket Network's AppG

@h5law h5law merged commit 81a808a into main Nov 10, 2023
7 checks passed
@h5law h5law deleted the feat/app-client branch November 10, 2023 23:18
bryanchriswhite added a commit that referenced this pull request Nov 11, 2023
* pokt/relayer/cli:
  [AppGate] Implement the MVP AppGateServer (#108)
  chore: Improve comment about startig relayer proxy
  [Relayer] feat: Add Relayer struct (#172)
  feat: Use relay miner to start
  chore: Reflect responsibility changes of session manager
  [Miner] feat: add `Miner` component (#168)
  fix: Update Miner interface
  chore: update start mining comment
  chore: Remove unused RelayerOption parameter
  chore: Rename relay miner file
  chore: Rename to RelayMiner
  feat: Add Relayer struct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application Changes related to the Application actor off-chain Off-chain business logic
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants