From 2b18655dc8ace86aa7066e15df6331c35da406b0 Mon Sep 17 00:00:00 2001 From: Alin Tomescu Date: Thu, 9 Jan 2025 14:11:23 -1000 Subject: [PATCH] no more default devnet VK; it should now be set manually via GenesisConfiguration during (re)deployment --- aptos-move/vm-genesis/src/lib.rs | 23 +++++++++++------------ crates/aptos-genesis/src/lib.rs | 6 +++--- crates/aptos-genesis/src/mainnet.rs | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/aptos-move/vm-genesis/src/lib.rs b/aptos-move/vm-genesis/src/lib.rs index 239713079c6165..ea57e7b377de2b 100644 --- a/aptos-move/vm-genesis/src/lib.rs +++ b/aptos-move/vm-genesis/src/lib.rs @@ -27,8 +27,7 @@ use aptos_types::{ secure_test_rsa_jwk, }, keyless::{ - self, test_utils::get_sample_iss, Groth16VerificationKey, DEVNET_VERIFICATION_KEY, - KEYLESS_ACCOUNT_MODULE_NAME, + self, test_utils::get_sample_iss, Groth16VerificationKey, KEYLESS_ACCOUNT_MODULE_NAME, }, move_utils::as_move_value::AsMoveValue, on_chain_config::{ @@ -111,7 +110,7 @@ pub struct GenesisConfiguration { pub randomness_config_override: Option, pub jwk_consensus_config_override: Option, pub initial_jwks: Vec, - pub keyless_groth16_vk_override: Option, + pub keyless_groth16_vk: Option, } pub static GENESIS_KEYPAIR: Lazy<(Ed25519PrivateKey, Ed25519PublicKey)> = Lazy::new(|| { @@ -312,7 +311,7 @@ pub fn encode_genesis_change_set( &module_storage, chain_id, genesis_config.initial_jwks.clone(), - genesis_config.keyless_groth16_vk_override.clone(), + genesis_config.keyless_groth16_vk.clone(), ); set_genesis_end(&mut session, &module_storage); @@ -686,7 +685,7 @@ fn initialize_keyless_accounts( module_storage: &impl AptosModuleStorage, chain_id: ChainId, mut initial_jwks: Vec, - vk_override: Option, + vk: Option, ) { let config = keyless::Configuration::new_for_devnet(); exec_function( @@ -700,9 +699,8 @@ fn initialize_keyless_accounts( config.as_move_value(), ]), ); - if !chain_id.is_mainnet() { - let vk = - vk_override.unwrap_or_else(|| Groth16VerificationKey::from(&*DEVNET_VERIFICATION_KEY)); + + if vk.is_some() { exec_function( session, module_storage, @@ -711,10 +709,11 @@ fn initialize_keyless_accounts( vec![], serialize_values(&vec![ MoveValue::Signer(CORE_CODE_ADDRESS), - vk.as_move_value(), + vk.unwrap().as_move_value(), ]), ); - + } + if !chain_id.is_mainnet() { let additional_jwk_patch = IssuerJWK { issuer: get_sample_iss(), jwk: JWK::RSA(secure_test_rsa_jwk()), @@ -1255,7 +1254,7 @@ pub fn generate_test_genesis( randomness_config_override: None, jwk_consensus_config_override: None, initial_jwks: vec![], - keyless_groth16_vk_override: None, + keyless_groth16_vk: None, }, &OnChainConsensusConfig::default_for_genesis(), &OnChainExecutionConfig::default_for_genesis(), @@ -1307,7 +1306,7 @@ fn mainnet_genesis_config() -> GenesisConfiguration { randomness_config_override: None, jwk_consensus_config_override: None, initial_jwks: vec![], - keyless_groth16_vk_override: None, + keyless_groth16_vk: None, } } diff --git a/crates/aptos-genesis/src/lib.rs b/crates/aptos-genesis/src/lib.rs index 8fed37e85cfa66..7f6624af564367 100644 --- a/crates/aptos-genesis/src/lib.rs +++ b/crates/aptos-genesis/src/lib.rs @@ -79,7 +79,7 @@ pub struct GenesisInfo { pub randomness_config_override: Option, pub jwk_consensus_config_override: Option, pub initial_jwks: Vec, - pub keyless_groth16_vk_override: Option, + pub keyless_groth16_vk: Option, } impl GenesisInfo { @@ -120,7 +120,7 @@ impl GenesisInfo { randomness_config_override: genesis_config.randomness_config_override.clone(), jwk_consensus_config_override: genesis_config.jwk_consensus_config_override.clone(), initial_jwks: genesis_config.initial_jwks.clone(), - keyless_groth16_vk_override: genesis_config.keyless_groth16_vk_override.clone(), + keyless_groth16_vk: genesis_config.keyless_groth16_vk_override.clone(), }) } @@ -157,7 +157,7 @@ impl GenesisInfo { randomness_config_override: self.randomness_config_override.clone(), jwk_consensus_config_override: self.jwk_consensus_config_override.clone(), initial_jwks: self.initial_jwks.clone(), - keyless_groth16_vk_override: self.keyless_groth16_vk_override.clone(), + keyless_groth16_vk: self.keyless_groth16_vk.clone(), }, &self.consensus_config, &self.execution_config, diff --git a/crates/aptos-genesis/src/mainnet.rs b/crates/aptos-genesis/src/mainnet.rs index 37ece1845d719c..e78e619694ee24 100644 --- a/crates/aptos-genesis/src/mainnet.rs +++ b/crates/aptos-genesis/src/mainnet.rs @@ -144,7 +144,7 @@ impl MainnetGenesisInfo { randomness_config_override: self.randomness_config_override.clone(), jwk_consensus_config_override: self.jwk_consensus_config_override.clone(), initial_jwks: vec![], - keyless_groth16_vk_override: None, + keyless_groth16_vk: None, }, ) }