Skip to content

Commit

Permalink
no more default devnet VK; it should now be set manually via GenesisC…
Browse files Browse the repository at this point in the history
…onfiguration during (re)deployment
  • Loading branch information
alinush committed Jan 10, 2025
1 parent 366f027 commit 2b18655
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
23 changes: 11 additions & 12 deletions aptos-move/vm-genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -111,7 +110,7 @@ pub struct GenesisConfiguration {
pub randomness_config_override: Option<OnChainRandomnessConfig>,
pub jwk_consensus_config_override: Option<OnChainJWKConsensusConfig>,
pub initial_jwks: Vec<IssuerJWK>,
pub keyless_groth16_vk_override: Option<Groth16VerificationKey>,
pub keyless_groth16_vk: Option<Groth16VerificationKey>,
}

pub static GENESIS_KEYPAIR: Lazy<(Ed25519PrivateKey, Ed25519PublicKey)> = Lazy::new(|| {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -686,7 +685,7 @@ fn initialize_keyless_accounts(
module_storage: &impl AptosModuleStorage,
chain_id: ChainId,
mut initial_jwks: Vec<IssuerJWK>,
vk_override: Option<Groth16VerificationKey>,
vk: Option<Groth16VerificationKey>,
) {
let config = keyless::Configuration::new_for_devnet();
exec_function(
Expand All @@ -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,
Expand All @@ -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()),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/aptos-genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct GenesisInfo {
pub randomness_config_override: Option<OnChainRandomnessConfig>,
pub jwk_consensus_config_override: Option<OnChainJWKConsensusConfig>,
pub initial_jwks: Vec<IssuerJWK>,
pub keyless_groth16_vk_override: Option<Groth16VerificationKey>,
pub keyless_groth16_vk: Option<Groth16VerificationKey>,
}

impl GenesisInfo {
Expand Down Expand Up @@ -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(),
})
}

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/aptos-genesis/src/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)
}
Expand Down

0 comments on commit 2b18655

Please sign in to comment.