From 869e1e5b2818e9ec264a890d4e116ad699081e29 Mon Sep 17 00:00:00 2001 From: zhoujunma Date: Sun, 4 Feb 2024 10:34:28 -0800 Subject: [PATCH] jwk #1: validator txn for publishing updates (#11853) * jwk types update * update * update * jwk txn and execution * update * fix dummy * update * update * update * update * update * update * remove dummy txns * check voting power than verify signature * fix warnings * update * update QuorumCertifiedUpdate struct GitOrigin-RevId: 793563fc9a022994fbc1d1c073e7090fc8091fe1 --- aptos-framework/doc/jwks.md | 45 +++++++++++++++++ aptos-framework/sources/jwks.move | 6 +++ move-stdlib/doc/features.md | 60 +++++++++++++++++++++++ move-stdlib/sources/configs/features.move | 10 ++++ 4 files changed, 121 insertions(+) diff --git a/aptos-framework/doc/jwks.md b/aptos-framework/doc/jwks.md index 778cf010d..216615462 100644 --- a/aptos-framework/doc/jwks.md +++ b/aptos-framework/doc/jwks.md @@ -620,6 +620,51 @@ This is what applications should consume. + + + + +
const ENATIVE_INCORRECT_VERSION: u64 = 259;
+
+ + + + + + + +
const ENATIVE_MISSING_RESOURCE_OBSERVED_JWKS: u64 = 258;
+
+ + + + + + + +
const ENATIVE_MISSING_RESOURCE_VALIDATOR_SET: u64 = 257;
+
+ + + + + + + +
const ENATIVE_MULTISIG_VERIFICATION_FAILED: u64 = 260;
+
+ + + + + + + +
const ENATIVE_NOT_ENOUGH_VOTING_POWER: u64 = 261;
+
+ + + diff --git a/aptos-framework/sources/jwks.move b/aptos-framework/sources/jwks.move index f40590620..b87a71c85 100644 --- a/aptos-framework/sources/jwks.move +++ b/aptos-framework/sources/jwks.move @@ -29,6 +29,12 @@ module aptos_framework::jwks { const EISSUER_NOT_FOUND: u64 = 5; const EJWK_ID_NOT_FOUND: u64 = 6; + const ENATIVE_MISSING_RESOURCE_VALIDATOR_SET: u64 = 0x0101; + const ENATIVE_MISSING_RESOURCE_OBSERVED_JWKS: u64 = 0x0102; + const ENATIVE_INCORRECT_VERSION: u64 = 0x0103; + const ENATIVE_MULTISIG_VERIFICATION_FAILED: u64 = 0x0104; + const ENATIVE_NOT_ENOUGH_VOTING_POWER: u64 = 0x0105; + /// An OIDC provider. struct OIDCProvider has drop, store { /// The utf-8 encoded issuer string. E.g., b"https://www.facebook.com". diff --git a/move-stdlib/doc/features.md b/move-stdlib/doc/features.md index a56f3f691..87f2ec811 100644 --- a/move-stdlib/doc/features.md +++ b/move-stdlib/doc/features.md @@ -88,6 +88,8 @@ return true. - [Function `zkid_feature_enabled`](#0x1_features_zkid_feature_enabled) - [Function `get_zkid_zkless_feature`](#0x1_features_get_zkid_zkless_feature) - [Function `zkid_zkless_feature_enabled`](#0x1_features_zkid_zkless_feature_enabled) +- [Function `get_jwk_consensus_feature`](#0x1_features_get_jwk_consensus_feature) +- [Function `jwk_consensus_enabled`](#0x1_features_jwk_consensus_enabled) - [Function `change_feature_flags`](#0x1_features_change_feature_flags) - [Function `is_enabled`](#0x1_features_is_enabled) - [Function `set`](#0x1_features_set) @@ -369,6 +371,18 @@ Lifetime: transient + + +The JWK consensus feature. + +Lifetime: permanent + + +
const JWK_CONSENSUS: u64 = 49;
+
+ + + @@ -1918,6 +1932,52 @@ Lifetime: transient + + + + +## Function `get_jwk_consensus_feature` + + + +
public fun get_jwk_consensus_feature(): u64
+
+ + + +
+Implementation + + +
public fun get_jwk_consensus_feature(): u64 { JWK_CONSENSUS }
+
+ + + +
+ + + +## Function `jwk_consensus_enabled` + + + +
public fun jwk_consensus_enabled(): bool
+
+ + + +
+Implementation + + +
public fun jwk_consensus_enabled(): bool acquires Features {
+    is_enabled(JWK_CONSENSUS)
+}
+
+ + +
diff --git a/move-stdlib/sources/configs/features.move b/move-stdlib/sources/configs/features.move index 8db36f003..53189fc24 100644 --- a/move-stdlib/sources/configs/features.move +++ b/move-stdlib/sources/configs/features.move @@ -355,6 +355,16 @@ module std::features { is_enabled(ZK_ID_ZKLESS_SIGNATURE) } + /// The JWK consensus feature. + /// + /// Lifetime: permanent + const JWK_CONSENSUS: u64 = 49; + + public fun get_jwk_consensus_feature(): u64 { JWK_CONSENSUS } + + public fun jwk_consensus_enabled(): bool acquires Features { + is_enabled(JWK_CONSENSUS) + } // ============================================================================================ // Feature Flag Implementation