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: add zklogin verify endpoint to jsonrpc #21166

Merged
merged 2 commits into from
Feb 12, 2025
Merged

Conversation

joyqvq
Copy link
Contributor

@joyqvq joyqvq commented Feb 10, 2025

Description

add zklogin verify to jsonrpc. this is a mirror of whats in graphql already: #16625

Test plan

simtest

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: Adds a new read API endpoint to verify zkLogin signature.
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Feb 10, 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 Feb 11, 2025 11:42pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Feb 11, 2025 11:42pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Feb 11, 2025 11:42pm

@joyqvq joyqvq temporarily deployed to sui-typescript-aws-kms-test-env February 10, 2025 22:37 — with GitHub Actions Inactive
@joyqvq joyqvq force-pushed the joy/add-zklogin-to-rpc branch from 35deb99 to 07c494f Compare February 10, 2025 22:39
@joyqvq joyqvq temporarily deployed to sui-typescript-aws-kms-test-env February 10, 2025 22:39 — with GitHub Actions Inactive
@joyqvq joyqvq changed the title Joy/add zklogin to rpc feat: add zklogin verify endpoint to jsonrpc Feb 10, 2025
@joyqvq joyqvq force-pushed the joy/add-zklogin-to-rpc branch from 07c494f to 345faf7 Compare February 10, 2025 22:47
@joyqvq joyqvq temporarily deployed to sui-typescript-aws-kms-test-env February 10, 2025 22:47 — with GitHub Actions Inactive
_intent_scope: ZkLoginIntentScope,
_author: SuiAddress,
) -> RpcResult<ZkLoginVerifyResult> {
todo!()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

confirming i do not need to add this to indexer api?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, fine to leave this as we don't use this in production anymore -- but let's have it return an error rather than panic.


/// Verify a zklogin signature
#[method(name = "verifyZkLoginSignature")]
async fn verify_zklogin_signature(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could you also document what the parameters are? You can probably lift the docs from what you wrote for GraphQL. The only difference is that here you add the doc comments directly on the parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed that providing better docs for what each of the parameters is expected to be would be nice.

Copy link
Contributor

@amnn amnn left a comment

Choose a reason for hiding this comment

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

The change looks good to me, but I'm less familiar with how things should be done on a fullnode (e.g. is it okay to fetch the per-epoch store inside an RPC method implementation, is there a better way to get the current epoch, etc), so I'll leave it with someone more familiar with that part to review it, but everything else LGTM!

Comment on lines +1085 to +1096
let mut oidc_provider_jwks = ImHashMap::new();
for active_jwk in new_jwks.iter() {
let ActiveJwk { jwk_id, jwk, .. } = active_jwk;
match oidc_provider_jwks.entry(jwk_id.clone()) {
im::hashmap::Entry::Occupied(_) => {
warn!("JWK with kid {:?} already exists", jwk_id);
}
im::hashmap::Entry::Vacant(entry) => {
entry.insert(jwk.clone());
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think its a bit of a shame that we need to load this every time but 🤷🏼 i'm sure its not that big of a deal.

@joyqvq joyqvq force-pushed the joy/add-zklogin-to-rpc branch from 345faf7 to dc8b36d Compare February 11, 2025 23:39
@joyqvq joyqvq temporarily deployed to sui-typescript-aws-kms-test-env February 11, 2025 23:39 — with GitHub Actions Inactive
@joyqvq joyqvq enabled auto-merge (squash) February 11, 2025 23:39
@joyqvq joyqvq merged commit ad1899e into main Feb 12, 2025
47 checks passed
@joyqvq joyqvq deleted the joy/add-zklogin-to-rpc branch February 12, 2025 00:12
zeevmoney added a commit to dwallet-labs/sui that referenced this pull request Feb 12, 2025
* 'main' of https://github.com/MystenLabs/sui: (84 commits)
  [Consensus] enable the new linearize logic for devnet. (MystenLabs#21172)
  Minor change to indicate that GraphQL is at alpha, not at beta (MystenLabs#21169)
  feat: add zklogin verify endpoint to jsonrpc (MystenLabs#21166)
  [sui-adapter] Remove error traces from native functions (MystenLabs#21185)
  [consensus] Enable zstd compression for consensus tonic network in mainnet (MystenLabs#21177)
  Reduce thread stall log level from ERROR to WARN (MystenLabs#21175)
  proto: sort fds files for stable codegen
  rpc: impl Name for google.rpc types
  rpc: properly return error code
  rpc: remove reqwest dependency
  grpc: add protos for more well known types
  proto: rework directory structure to conform with standards
  Update publish.mdx (MystenLabs#21170)
  Update ptb.mdx (MystenLabs#21171)
  [exp-to-insta][14/14] Cleanup of insta_assert macro (MystenLabs#21114)
  fix(sui): fix Option<address> serialization in client_ptb (MystenLabs#21126)
  [exp-to-insta][13/n] Cleanup insta migration (MystenLabs#21113)
  [exp-to-insta][12/n] Migrate move-analyzer (MystenLabs#21112)
  [exp-to-insta][11/n] Migrate move-stackless-bytecode and move-model (MystenLabs#21111)
  [exp-to-insta][10/n] Migrate move-unit-test (MystenLabs#21109)
  ...
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