Skip to content

grpc: add SignatureVerificationService #22207

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bmwill
Copy link
Contributor

@bmwill bmwill commented May 22, 2025

Introduce the SignatureVerificationService which provides support for verifying signatures in the sui ecosystem. This is meant to be a replacement/extention of the JSONRPC method for verifying zklogin signatures.

Description

Describe the changes or additions included in this PR.

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@bmwill bmwill requested review from joyqvq and hayes-mysten May 22, 2025 22:11
Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 3:32pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 23, 2025 3:32pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 23, 2025 3:32pm

@bmwill bmwill temporarily deployed to sui-typescript-aws-kms-test-env May 22, 2025 22:11 — with GitHub Actions Inactive
@bmwill
Copy link
Contributor Author

bmwill commented May 23, 2025

Right now this API is designed to return a non-OK status code on sig verification failure, this probably makes sense to change to be an Ok status code with a payload with a boolean that indicates success as is done in the JSONRPC api

Introduce the SignatureVerificationService which provides support for
verifying signatures in the sui ecosystem. This is meant to be a
replacement/extention of the JSONRPC method for verifying zklogin
signatures.
@bmwill bmwill force-pushed the grpc-signature-verification-service branch from 69d754e to 5275357 Compare May 23, 2025 15:30
@bmwill bmwill temporarily deployed to sui-typescript-aws-kms-test-env May 23, 2025 15:30 — with GitHub Actions Inactive

// The set of JWKs to use when verifying Zklogin signatures.
// If this is empty the current set of valid JWKs stored onchain will be used
repeated sui.rpc.v2beta.ActiveJwk jwks = 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Something I don't think we support in GraphQL yet, but might be nice is an epoch. In GraphQL we can only verify zklogin signatures for a short period after they are created, and have no way to verify historic signatures because they are no longer valid for the current epoch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep I realized this as well, technically the implication as provided by this pr doesn't do epoch checks at all and only does the proof check against the jwks and sig checks

optional sui.rpc.v2beta.Bcs message = 1;

// The siganture to verify.
optional sui.rpc.v2beta.UserSignature signature = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

It might also be nice to be able to pass an address in addition to the signature. For the TS sdk we don't need this, but I could imagine it being useful for other languages where extracting the address from a signature isn't trivial.

One additional thing to account for here is zklogin legacy addresses. ZkLogin signatures have up to 2 different addresses they can be valid for, and being able to validate that a zklogin signature is valid for a specific address is slightly more complicated than extracting the address from the signature, because you need to figure out if the seed in the public key bytes are padded, get the other (padded or unpadded bytes) and then derive a second address from that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh good call out. I saw this in the other implementation but was confused why it existed. This is easy to add as well as easy to account for the zklogin padding issues

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.

2 participants