From 2d8fa7213794bd3f83938a564ce15622ff9b0dd1 Mon Sep 17 00:00:00 2001 From: Joy Wang <108701016+joyqvq@users.noreply.github.com> Date: Thu, 17 Aug 2023 23:59:55 -0400 Subject: [PATCH] fix tests and comments --- crates/sui-core/src/authority/authority_per_epoch_store.rs | 2 +- crates/sui-core/src/signature_verifier.rs | 4 ++-- crates/sui-node/src/lib.rs | 3 ++- crates/sui-open-rpc/spec/openrpc.json | 3 +-- crates/sui-types/src/base_types.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/sui-core/src/authority/authority_per_epoch_store.rs b/crates/sui-core/src/authority/authority_per_epoch_store.rs index 942be085bb51d..7c575ec5101c3 100644 --- a/crates/sui-core/src/authority/authority_per_epoch_store.rs +++ b/crates/sui-core/src/authority/authority_per_epoch_store.rs @@ -473,7 +473,7 @@ impl AuthorityPerEpochStore { let supported_providers = protocol_config .zklogin_supported_providers() .iter() - .map(|a| OIDCProvider::from_str(&a).expect("Invalid provider string")) + .map(|s| OIDCProvider::from_str(s).expect("Invalid provider string")) .collect::>(); let signature_verifier = SignatureVerifier::new( diff --git a/crates/sui-core/src/signature_verifier.rs b/crates/sui-core/src/signature_verifier.rs index 713bfb9546f7f..24374643abaff 100644 --- a/crates/sui-core/src/signature_verifier.rs +++ b/crates/sui-core/src/signature_verifier.rs @@ -109,9 +109,9 @@ pub struct SignatureVerifier { /// Contains two parameters to pass in to verify a ZkLogin signature. #[derive(Clone)] struct ZkLoginParams { - /// A list of supported providers for ZkLogin supports. + /// A list of supported OAuth providers for ZkLogin. pub supported_providers: Vec, - /// The environment (prod/test) the code runs in. + /// The environment (prod/test) the code runs in. It decides which verifying key to use in fastcrypto. pub env: ZkLoginEnv, } diff --git a/crates/sui-node/src/lib.rs b/crates/sui-node/src/lib.rs index 710169e2d4309..1ac782d97bc9b 100644 --- a/crates/sui-node/src/lib.rs +++ b/crates/sui-node/src/lib.rs @@ -211,7 +211,7 @@ impl SuiNode { .protocol_config() .zklogin_supported_providers() .iter() - .map(|s| OIDCProvider::from_str(s).unwrap()) + .map(|s| OIDCProvider::from_str(s).expect("Invalid provider string")) .collect::>(); let fetch_and_sleep = async move { // Update the JWK value in the authority server @@ -263,6 +263,7 @@ impl SuiNode { #[allow(unused_variables)] async fn fetch_jwks(supported_providers: &[OIDCProvider]) -> SuiResult> { use fastcrypto_zkp::bn254::zk_login::parse_jwks; + // Just load a default Twitch jwk for testing. parse_jwks( sui_types::zk_login_util::DEFAULT_JWK_BYTES, &OIDCProvider::Twitch, diff --git a/crates/sui-open-rpc/spec/openrpc.json b/crates/sui-open-rpc/spec/openrpc.json index 12ba534abe352..cdb9dd611cd3e 100644 --- a/crates/sui-open-rpc/spec/openrpc.json +++ b/crates/sui-open-rpc/spec/openrpc.json @@ -1369,8 +1369,7 @@ "simplified_unwrap_then_delete": false, "txn_base_cost_as_multiplier": false, "upgraded_multisig_supported": false, - "zklogin_auth": false, - "zklogin_use_secure_vk": false + "zklogin_auth": false }, "attributes": { "address_from_bytes_cost_base": { diff --git a/crates/sui-types/src/base_types.rs b/crates/sui-types/src/base_types.rs index c8b8cd4fd3799..ef6bed2ce85f0 100644 --- a/crates/sui-types/src/base_types.rs +++ b/crates/sui-types/src/base_types.rs @@ -604,7 +604,7 @@ impl From<&MultiSigPublicKey> for SuiAddress { } /// Sui address for [struct ZkLoginAuthenticator] is defined as the black2b hash of -/// [zklogin_flag || bcs bytes of AddressParams || address seed in bytes] where +/// [zklogin_flag || bcs bytes of AddressParams || address_seed in bytes] where /// AddressParams contains iss and aud string. impl From<&ZkLoginAuthenticator> for SuiAddress { fn from(authenticator: &ZkLoginAuthenticator) -> Self {