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

Get signature endpoint #475

Closed
wants to merge 66 commits into from
Closed

Get signature endpoint #475

wants to merge 66 commits into from

Conversation

cam-schultz
Copy link
Contributor

@cam-schultz cam-schultz commented Feb 1, 2023

Why this should be merged

Adds an endpoint warp_getSignature that returns the signature for a given message ID from the warp backend. This will likely be used primarily for testing purposes, but could act as an alternative to VM AppRequests.

Fixes #446

How this works

Adds a new WarpAPI and method GetSignature, and a corresponding client WarpClient and method.

How this was tested

CI tests. Manual testing via CURL and a standalone app that uses WarpClient

@aaronbuchwald
Copy link
Collaborator

We should test that this endpoint correctly returns an error both via a CURL request and through the implemented client.go.

Looking at the implementation, I don't think it will right now because it uses message.SignatureRequest which does not include JSON tags.

@cam-schultz cam-schultz marked this pull request as draft February 6, 2023 23:22
@cam-schultz cam-schultz changed the title get signature endpoint Get signature endpoint Feb 6, 2023
// NewClient returns a Client for interacting with EVM [chain]
func NewWarpClient(uri, chain string) WarpClient {
return &warpClient{
requester: rpc.NewEndpointRequester(fmt.Sprintf("%s/ext/bc/%s/warp", uri, chain)),

Choose a reason for hiding this comment

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

nit: where is this endpoint from? Do we need the same chainID twice in the endpoint or does one work as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The implementation has been updated since you left this comment, but the endpoint is the same as the eth rpc API, i.e. /rpc. Methods are denoted by warp_methodName in the method field.

@cam-schultz
Copy link
Contributor Author

I tested this endpoint both with CURL and the warp client struct. I modeled the API after internal/ethapi/api.go, which has imposes following properties:

  • The method syntax is warp_getSignature, delimited by an underscore
  • The endpoint is /rpc
  • The parameters are positional, and the ids.ID parameter of GetSignature should be cb58 encoded

@cam-schultz cam-schultz marked this pull request as ready for review February 7, 2023 20:54
@darioush
Copy link
Collaborator

darioush commented Feb 9, 2023

Base automatically changed from signature-handler to master February 9, 2023 01:19
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Co-authored-by: aaronbuchwald <aaron.buchwald56@gmail.com>
Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
Co-authored-by: cam-schultz <78878559+cam-schultz@users.noreply.github.com>
@aaronbuchwald
Copy link
Collaborator

Closing in favor of #507

@darioush darioush deleted the get-signature-endpoint branch February 23, 2023 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
4 participants