diff --git a/Cargo.lock b/Cargo.lock index 7c45ba3dad99..6d25b1b6858b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8213,6 +8213,7 @@ dependencies = [ "rand 0.8.5", "secrecy", "serde", + "serde_json", "tracing", "url", "zksync_basic_types", diff --git a/core/lib/basic_types/src/protocol_version.rs b/core/lib/basic_types/src/protocol_version.rs index 265c06987afd..640a92c00da0 100644 --- a/core/lib/basic_types/src/protocol_version.rs +++ b/core/lib/basic_types/src/protocol_version.rs @@ -238,7 +238,12 @@ impl Detokenize for VerifierParams { #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Serialize, Deserialize)] pub struct L1VerifierConfig { - pub recursion_scheduler_level_vk_hash: H256, + // Rename is required to not introduce breaking changes in the API for existing clients. + #[serde( + alias = "recursion_scheduler_level_vk_hash", + rename(serialize = "recursion_scheduler_level_vk_hash") + )] + pub snark_wrapper_vk_hash: H256, } impl From for VmVersion { @@ -394,4 +399,22 @@ mod tests { assert_eq!(version, unpacked); } + + #[test] + fn test_verifier_config_serde() { + let de = [ + r#"{"recursion_scheduler_level_vk_hash": "0x1111111111111111111111111111111111111111111111111111111111111111"}"#, + r#"{"snark_wrapper_vk_hash": "0x1111111111111111111111111111111111111111111111111111111111111111"}"#, + ]; + for de in de.iter() { + let _: L1VerifierConfig = serde_json::from_str(de) + .unwrap_or_else(|err| panic!("Failed deserialization. String: {de}, error {err}")); + } + let ser = L1VerifierConfig { + snark_wrapper_vk_hash: H256::repeat_byte(0x11), + }; + let ser_str = serde_json::to_string(&ser).unwrap(); + let expected_str = r#"{"recursion_scheduler_level_vk_hash":"0x1111111111111111111111111111111111111111111111111111111111111111"}"#; + assert_eq!(ser_str, expected_str); + } } diff --git a/core/lib/config/Cargo.toml b/core/lib/config/Cargo.toml index b13948448cdd..d1ab5ce8438f 100644 --- a/core/lib/config/Cargo.toml +++ b/core/lib/config/Cargo.toml @@ -24,6 +24,9 @@ rand.workspace = true secrecy.workspace = true serde = { workspace = true, features = ["derive"] } +[dev-dependencies] +serde_json.workspace = true + [features] default = [] observability_ext = ["zksync_vlog", "tracing"] diff --git a/core/lib/config/src/configs/genesis.rs b/core/lib/config/src/configs/genesis.rs index 2c5c91128431..6c4bacc3a6e2 100644 --- a/core/lib/config/src/configs/genesis.rs +++ b/core/lib/config/src/configs/genesis.rs @@ -20,7 +20,14 @@ pub struct GenesisConfig { pub l1_chain_id: L1ChainId, pub sl_chain_id: Option, pub l2_chain_id: L2ChainId, - pub recursion_scheduler_level_vk_hash: H256, + // Note: `serde` isn't used with protobuf config. The same alias is implemented in + // `zksync_protobuf_config` manually. + // Rename is required to not introduce breaking changes in the API for existing clients. + #[serde( + alias = "recursion_scheduler_level_vk_hash", + rename(serialize = "recursion_scheduler_level_vk_hash") + )] + pub snark_wrapper_vk_hash: H256, pub fee_account: Address, pub dummy_verifier: bool, pub l1_batch_commit_data_generator_mode: L1BatchCommitmentMode, @@ -37,7 +44,7 @@ impl GenesisConfig { GenesisConfig { genesis_root_hash: Some(H256::repeat_byte(0x01)), rollup_last_leaf_index: Some(26), - recursion_scheduler_level_vk_hash: H256::repeat_byte(0x02), + snark_wrapper_vk_hash: H256::repeat_byte(0x02), fee_account: Default::default(), genesis_commitment: Some(H256::repeat_byte(0x17)), bootloader_hash: Default::default(), @@ -54,3 +61,37 @@ impl GenesisConfig { } } } + +#[cfg(test)] +mod tests { + use super::GenesisConfig; + + // This test checks that serde overrides (`rename`, `alias`) work for `snark_wrapper_vk_hash` field. + #[test] + fn genesis_serde_snark_wrapper_vk_hash() { + let genesis = GenesisConfig::for_tests(); + let genesis_str = serde_json::to_string(&genesis).unwrap(); + + // Check that we use backward-compatible name in serialization. + // If you want to remove this check, make sure that all the potential clients are updated. + assert!( + genesis_str.contains("recursion_scheduler_level_vk_hash"), + "Serialization should use backward-compatible name" + ); + + let genesis2: GenesisConfig = serde_json::from_str(&genesis_str).unwrap(); + assert_eq!(genesis, genesis2); + + let genesis_json = r#"{ + "snark_wrapper_vk_hash": "0x1111111111111111111111111111111111111111111111111111111111111111", + "l1_chain_id": 1, + "l2_chain_id": 1, + "fee_account": "0x1111111111111111111111111111111111111111", + "dummy_verifier": false, + "l1_batch_commit_data_generator_mode": "Rollup" + }"#; + serde_json::from_str::(genesis_json).unwrap_or_else(|err| { + panic!("Failed to parse genesis config with a new name: {}", err) + }); + } +} diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index ea27bf8ab3ab..028b5e38055f 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -728,7 +728,7 @@ impl Distribution for EncodeDist { l1_chain_id: L1ChainId(self.sample(rng)), sl_chain_id: None, l2_chain_id: L2ChainId::default(), - recursion_scheduler_level_vk_hash: rng.gen(), + snark_wrapper_vk_hash: rng.gen(), dummy_verifier: rng.gen(), l1_batch_commit_data_generator_mode: match rng.gen_range(0..2) { 0 => L1BatchCommitmentMode::Rollup, diff --git a/core/lib/dal/.sqlx/query-e89e8cc58a2078157d06f3064ccad9773d45ef6d548f03d643007d3bc1072526.json b/core/lib/dal/.sqlx/query-3e49b1b3790ca3909b346d13458c1f7ec6ace3cd291606a96c89a3a05141e419.json similarity index 69% rename from core/lib/dal/.sqlx/query-e89e8cc58a2078157d06f3064ccad9773d45ef6d548f03d643007d3bc1072526.json rename to core/lib/dal/.sqlx/query-3e49b1b3790ca3909b346d13458c1f7ec6ace3cd291606a96c89a3a05141e419.json index 68b595b50274..5784de74f1bd 100644 --- a/core/lib/dal/.sqlx/query-e89e8cc58a2078157d06f3064ccad9773d45ef6d548f03d643007d3bc1072526.json +++ b/core/lib/dal/.sqlx/query-3e49b1b3790ca3909b346d13458c1f7ec6ace3cd291606a96c89a3a05141e419.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n protocol_versions.id AS \"minor!\",\n protocol_versions.timestamp,\n protocol_versions.bootloader_code_hash,\n protocol_versions.default_account_code_hash,\n protocol_patches.patch,\n protocol_patches.recursion_scheduler_level_vk_hash\n FROM\n protocol_versions\n JOIN protocol_patches ON protocol_patches.minor = protocol_versions.id\n WHERE\n id = $1\n ORDER BY\n protocol_patches.patch DESC\n LIMIT\n 1\n ", + "query": "\n SELECT\n protocol_versions.id AS \"minor!\",\n protocol_versions.timestamp,\n protocol_versions.bootloader_code_hash,\n protocol_versions.default_account_code_hash,\n protocol_patches.patch,\n protocol_patches.recursion_scheduler_level_vk_hash as snark_wrapper_vk_hash\n FROM\n protocol_versions\n JOIN protocol_patches ON protocol_patches.minor = protocol_versions.id\n WHERE\n id = $1\n ORDER BY\n protocol_patches.patch DESC\n LIMIT\n 1\n ", "describe": { "columns": [ { @@ -30,7 +30,7 @@ }, { "ordinal": 5, - "name": "recursion_scheduler_level_vk_hash", + "name": "snark_wrapper_vk_hash", "type_info": "Bytea" } ], @@ -48,5 +48,5 @@ false ] }, - "hash": "e89e8cc58a2078157d06f3064ccad9773d45ef6d548f03d643007d3bc1072526" + "hash": "3e49b1b3790ca3909b346d13458c1f7ec6ace3cd291606a96c89a3a05141e419" } diff --git a/core/lib/dal/.sqlx/query-d93ebd47a227a6086a5eb963c7ed36e6c9d9e70dc52677c6b335b3ed4025db85.json b/core/lib/dal/.sqlx/query-53acc82f1dc81732923e96fb9f1bc1a2995aad9e8690c28c4fa1f5f88724e560.json similarity index 51% rename from core/lib/dal/.sqlx/query-d93ebd47a227a6086a5eb963c7ed36e6c9d9e70dc52677c6b335b3ed4025db85.json rename to core/lib/dal/.sqlx/query-53acc82f1dc81732923e96fb9f1bc1a2995aad9e8690c28c4fa1f5f88724e560.json index 0fd16adc474d..c6dfd96e1bb9 100644 --- a/core/lib/dal/.sqlx/query-d93ebd47a227a6086a5eb963c7ed36e6c9d9e70dc52677c6b335b3ed4025db85.json +++ b/core/lib/dal/.sqlx/query-53acc82f1dc81732923e96fb9f1bc1a2995aad9e8690c28c4fa1f5f88724e560.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n recursion_scheduler_level_vk_hash\n FROM\n protocol_patches\n WHERE\n minor = $1\n AND patch = $2\n ", + "query": "\n SELECT\n recursion_scheduler_level_vk_hash as snark_wrapper_vk_hash\n FROM\n protocol_patches\n WHERE\n minor = $1\n AND patch = $2\n ", "describe": { "columns": [ { "ordinal": 0, - "name": "recursion_scheduler_level_vk_hash", + "name": "snark_wrapper_vk_hash", "type_info": "Bytea" } ], @@ -19,5 +19,5 @@ false ] }, - "hash": "d93ebd47a227a6086a5eb963c7ed36e6c9d9e70dc52677c6b335b3ed4025db85" + "hash": "53acc82f1dc81732923e96fb9f1bc1a2995aad9e8690c28c4fa1f5f88724e560" } diff --git a/core/lib/dal/src/models/storage_protocol_version.rs b/core/lib/dal/src/models/storage_protocol_version.rs index c19fa560b67c..e53bf7b9d0a4 100644 --- a/core/lib/dal/src/models/storage_protocol_version.rs +++ b/core/lib/dal/src/models/storage_protocol_version.rs @@ -13,7 +13,7 @@ pub struct StorageProtocolVersion { pub minor: i32, pub patch: i32, pub timestamp: i64, - pub recursion_scheduler_level_vk_hash: Vec, + pub snark_wrapper_vk_hash: Vec, pub bootloader_code_hash: Vec, pub default_account_code_hash: Vec, } @@ -29,9 +29,7 @@ pub(crate) fn protocol_version_from_storage( }, timestamp: storage_version.timestamp as u64, l1_verifier_config: L1VerifierConfig { - recursion_scheduler_level_vk_hash: H256::from_slice( - &storage_version.recursion_scheduler_level_vk_hash, - ), + snark_wrapper_vk_hash: H256::from_slice(&storage_version.snark_wrapper_vk_hash), }, base_system_contracts_hashes: BaseSystemContractsHashes { bootloader: H256::from_slice(&storage_version.bootloader_code_hash), diff --git a/core/lib/dal/src/protocol_versions_dal.rs b/core/lib/dal/src/protocol_versions_dal.rs index 0d17044e6c51..42af22ca02fa 100644 --- a/core/lib/dal/src/protocol_versions_dal.rs +++ b/core/lib/dal/src/protocol_versions_dal.rs @@ -78,9 +78,7 @@ impl ProtocolVersionsDal<'_, '_> { "#, version.minor as i32, version.patch.0 as i32, - l1_verifier_config - .recursion_scheduler_level_vk_hash - .as_bytes(), + l1_verifier_config.snark_wrapper_vk_hash.as_bytes(), ) .instrument("save_protocol_version#patch") .with_arg("version", &version) @@ -235,7 +233,7 @@ impl ProtocolVersionsDal<'_, '_> { protocol_versions.bootloader_code_hash, protocol_versions.default_account_code_hash, protocol_patches.patch, - protocol_patches.recursion_scheduler_level_vk_hash + protocol_patches.recursion_scheduler_level_vk_hash AS snark_wrapper_vk_hash FROM protocol_versions JOIN protocol_patches ON protocol_patches.minor = protocol_versions.id @@ -265,10 +263,11 @@ impl ProtocolVersionsDal<'_, '_> { &mut self, version: ProtocolSemanticVersion, ) -> Option { + // `recursion_scheduler_level_vk_hash` actually stores `snark_wrapper_vk_hash` let row = sqlx::query!( r#" SELECT - recursion_scheduler_level_vk_hash + recursion_scheduler_level_vk_hash AS snark_wrapper_vk_hash FROM protocol_patches WHERE @@ -282,17 +281,16 @@ impl ProtocolVersionsDal<'_, '_> { .await .unwrap()?; Some(L1VerifierConfig { - recursion_scheduler_level_vk_hash: H256::from_slice( - &row.recursion_scheduler_level_vk_hash, - ), + snark_wrapper_vk_hash: H256::from_slice(&row.snark_wrapper_vk_hash), }) } pub async fn get_patch_versions_for_vk( &mut self, minor_version: ProtocolVersionId, - recursion_scheduler_level_vk_hash: H256, + snark_wrapper_vk_hash: H256, ) -> DalResult> { + // `recursion_scheduler_level_vk_hash` actually stores `snark_wrapper_vk_hash` let rows = sqlx::query!( r#" SELECT @@ -306,7 +304,7 @@ impl ProtocolVersionsDal<'_, '_> { patch DESC "#, minor_version as i32, - recursion_scheduler_level_vk_hash.as_bytes() + snark_wrapper_vk_hash.as_bytes() ) .instrument("get_patch_versions_for_vk") .fetch_all(self.storage) diff --git a/core/lib/env_config/src/genesis.rs b/core/lib/env_config/src/genesis.rs index 1eb83ae2f39e..bf30fd4cc339 100644 --- a/core/lib/env_config/src/genesis.rs +++ b/core/lib/env_config/src/genesis.rs @@ -72,7 +72,7 @@ impl FromEnv for GenesisConfig { l1_chain_id: L1ChainId(network_config.network.chain_id().0), sl_chain_id: Some(network_config.network.chain_id()), l2_chain_id: network_config.zksync_network_id, - recursion_scheduler_level_vk_hash: contracts_config.snark_wrapper_vk_hash, + snark_wrapper_vk_hash: contracts_config.snark_wrapper_vk_hash, fee_account: state_keeper .fee_account_addr .context("Fee account required for genesis")?, diff --git a/core/lib/protobuf_config/src/genesis.rs b/core/lib/protobuf_config/src/genesis.rs index 92f639aa224e..59896aa244d8 100644 --- a/core/lib/protobuf_config/src/genesis.rs +++ b/core/lib/protobuf_config/src/genesis.rs @@ -43,6 +43,13 @@ impl ProtoRepr for proto::Genesis { 0.into(), ) }; + // Check either of fields, use old name as a fallback. + let snark_wrapper_vk_hash = match (&prover.snark_wrapper_vk_hash, &prover.recursion_scheduler_level_vk_hash) { + (Some(x), _) => parse_h256(x).context("snark_wrapper_vk_hash")?, + (_, Some(x)) => parse_h256(x).context("recursion_scheduler_level_vk_hash")?, + _ => anyhow::bail!("Either snark_wrapper_vk_hash or recursion_scheduler_level_vk_hash should be presented"), + }; + Ok(Self::Type { protocol_version: Some(protocol_version), genesis_root_hash: Some( @@ -75,9 +82,7 @@ impl ProtoRepr for proto::Genesis { l2_chain_id: required(&self.l2_chain_id) .and_then(|x| L2ChainId::try_from(*x).map_err(|a| anyhow::anyhow!(a))) .context("l2_chain_id")?, - recursion_scheduler_level_vk_hash: required(&prover.recursion_scheduler_level_vk_hash) - .and_then(|x| parse_h256(x)) - .context("recursion_scheduler_level_vk_hash")?, + snark_wrapper_vk_hash, fee_account: required(&self.fee_account) .and_then(|x| parse_h160(x)) .context("fee_account")?, @@ -104,11 +109,9 @@ impl ProtoRepr for proto::Genesis { l1_chain_id: Some(this.l1_chain_id.0), l2_chain_id: Some(this.l2_chain_id.as_u64()), prover: Some(proto::Prover { - recursion_scheduler_level_vk_hash: Some(format!( - "{:?}", - this.recursion_scheduler_level_vk_hash - )), + recursion_scheduler_level_vk_hash: None, // Deprecated field. dummy_verifier: Some(this.dummy_verifier), + snark_wrapper_vk_hash: Some(format!("{:?}", this.snark_wrapper_vk_hash)), }), l1_batch_commit_data_generator_mode: Some( proto::L1BatchCommitDataGeneratorMode::new( diff --git a/core/lib/protobuf_config/src/proto/config/genesis.proto b/core/lib/protobuf_config/src/proto/config/genesis.proto index 6e679d865d92..08cbb954fcbc 100644 --- a/core/lib/protobuf_config/src/proto/config/genesis.proto +++ b/core/lib/protobuf_config/src/proto/config/genesis.proto @@ -8,8 +8,9 @@ enum L1BatchCommitDataGeneratorMode { } message Prover { - optional string recursion_scheduler_level_vk_hash = 1; // required; H256 + optional string recursion_scheduler_level_vk_hash = 1; // optional and deprecated, used as alias for `snark_wrapper_vk_hash`; H256 optional bool dummy_verifier = 5; + optional string snark_wrapper_vk_hash = 6; // optional (required if `recursion_scheduler_level_vk_hash` is not set); H256 reserved 2, 3, 4; reserved "recursion_node_level_vk_hash", "recursion_leaf_level_vk_hash", "recursion_circuits_set_vks_hash"; } diff --git a/core/lib/types/src/protocol_upgrade.rs b/core/lib/types/src/protocol_upgrade.rs index bc9bd7667e82..1afb108a0536 100644 --- a/core/lib/types/src/protocol_upgrade.rs +++ b/core/lib/types/src/protocol_upgrade.rs @@ -282,14 +282,14 @@ impl ProtocolVersion { pub fn apply_upgrade( &self, upgrade: ProtocolUpgrade, - new_scheduler_vk_hash: Option, + new_snark_wrapper_vk_hash: Option, ) -> ProtocolVersion { ProtocolVersion { version: upgrade.version, timestamp: upgrade.timestamp, l1_verifier_config: L1VerifierConfig { - recursion_scheduler_level_vk_hash: new_scheduler_vk_hash - .unwrap_or(self.l1_verifier_config.recursion_scheduler_level_vk_hash), + snark_wrapper_vk_hash: new_snark_wrapper_vk_hash + .unwrap_or(self.l1_verifier_config.snark_wrapper_vk_hash), }, base_system_contracts_hashes: BaseSystemContractsHashes { bootloader: upgrade diff --git a/core/node/api_server/src/web3/namespaces/en.rs b/core/node/api_server/src/web3/namespaces/en.rs index 604d38ef94ab..ca15352fd1ac 100644 --- a/core/node/api_server/src/web3/namespaces/en.rs +++ b/core/node/api_server/src/web3/namespaces/en.rs @@ -157,7 +157,7 @@ impl EnNamespace { l1_chain_id: self.state.api_config.l1_chain_id, sl_chain_id: Some(self.state.api_config.l1_chain_id.into()), l2_chain_id: self.state.api_config.l2_chain_id, - recursion_scheduler_level_vk_hash: verifier_config.recursion_scheduler_level_vk_hash, + snark_wrapper_vk_hash: verifier_config.snark_wrapper_vk_hash, fee_account, dummy_verifier: self.state.api_config.dummy_verifier, l1_batch_commit_data_generator_mode: self diff --git a/core/node/eth_sender/src/aggregator.rs b/core/node/eth_sender/src/aggregator.rs index de6a6982088b..1e0bd315b9d9 100644 --- a/core/node/eth_sender/src/aggregator.rs +++ b/core/node/eth_sender/src/aggregator.rs @@ -333,16 +333,13 @@ impl Aggregator { // keys that correspond to one on L1. let allowed_patch_versions = storage .protocol_versions_dal() - .get_patch_versions_for_vk( - minor_version, - l1_verifier_config.recursion_scheduler_level_vk_hash, - ) + .get_patch_versions_for_vk(minor_version, l1_verifier_config.snark_wrapper_vk_hash) .await .unwrap(); if allowed_patch_versions.is_empty() { tracing::warn!( "No patch version corresponds to the verification key on L1: {:?}", - l1_verifier_config.recursion_scheduler_level_vk_hash + l1_verifier_config.snark_wrapper_vk_hash ); return None; }; diff --git a/core/node/eth_sender/src/eth_tx_aggregator.rs b/core/node/eth_sender/src/eth_tx_aggregator.rs index 7f304e2f72b7..6e9e71d74ea4 100644 --- a/core/node/eth_sender/src/eth_tx_aggregator.rs +++ b/core/node/eth_sender/src/eth_tx_aggregator.rs @@ -317,7 +317,7 @@ impl EthTxAggregator { } /// Loads current verifier config on L1 - async fn get_recursion_scheduler_level_vk_hash( + async fn get_snark_wrapper_vk_hash( &mut self, verifier_address: Address, ) -> Result { @@ -344,15 +344,15 @@ impl EthTxAggregator { })?; let contracts_are_pre_shared_bridge = protocol_version_id.is_pre_shared_bridge(); - let recursion_scheduler_level_vk_hash = self - .get_recursion_scheduler_level_vk_hash(verifier_address) + let snark_wrapper_vk_hash = self + .get_snark_wrapper_vk_hash(verifier_address) .await .map_err(|err| { tracing::error!("Failed to get VK hash from the Verifier {err:?}"); err })?; let l1_verifier_config = L1VerifierConfig { - recursion_scheduler_level_vk_hash, + snark_wrapper_vk_hash, }; if let Some(agg_op) = self .aggregator diff --git a/core/node/genesis/src/lib.rs b/core/node/genesis/src/lib.rs index 6713e5a4bcc2..1f30d314bb06 100644 --- a/core/node/genesis/src/lib.rs +++ b/core/node/genesis/src/lib.rs @@ -175,8 +175,7 @@ pub fn mock_genesis_config() -> GenesisConfig { l1_chain_id: L1ChainId(9), sl_chain_id: None, l2_chain_id: L2ChainId::default(), - recursion_scheduler_level_vk_hash: first_l1_verifier_config - .recursion_scheduler_level_vk_hash, + snark_wrapper_vk_hash: first_l1_verifier_config.snark_wrapper_vk_hash, fee_account: Default::default(), dummy_verifier: false, l1_batch_commit_data_generator_mode: Default::default(), @@ -190,7 +189,7 @@ pub async fn insert_genesis_batch( ) -> Result { let mut transaction = storage.start_transaction().await?; let verifier_config = L1VerifierConfig { - recursion_scheduler_level_vk_hash: genesis_params.config.recursion_scheduler_level_vk_hash, + snark_wrapper_vk_hash: genesis_params.config.snark_wrapper_vk_hash, }; create_genesis_l1_batch( @@ -297,10 +296,10 @@ pub async fn validate_genesis_params( .call(query_client) .await?; - if verification_key_hash != genesis_params.config().recursion_scheduler_level_vk_hash { + if verification_key_hash != genesis_params.config().snark_wrapper_vk_hash { return Err(anyhow::anyhow!( "Verification key hash mismatch: {verification_key_hash:?} on contract, {:?} in config", - genesis_params.config().recursion_scheduler_level_vk_hash + genesis_params.config().snark_wrapper_vk_hash )); } diff --git a/prover/crates/bin/prover_cli/src/commands/insert_version.rs b/prover/crates/bin/prover_cli/src/commands/insert_version.rs index 7f30719a713b..e89d2024e26f 100644 --- a/prover/crates/bin/prover_cli/src/commands/insert_version.rs +++ b/prover/crates/bin/prover_cli/src/commands/insert_version.rs @@ -35,7 +35,7 @@ pub async fn run(args: Args, config: ProverCLIConfig) -> anyhow::Result<()> { let protocol_version_patch = VersionPatch(args.patch); - let snark_wrapper = H256::from_str(&args.snark_wrapper).unwrap_or_else(|_| { + let snark_wrapper_vk_hash = H256::from_str(&args.snark_wrapper).unwrap_or_else(|_| { panic!("Invalid snark wrapper hash"); }); @@ -43,7 +43,7 @@ pub async fn run(args: Args, config: ProverCLIConfig) -> anyhow::Result<()> { .save_prover_protocol_version( ProtocolSemanticVersion::new(protocol_version, protocol_version_patch), L1VerifierConfig { - recursion_scheduler_level_vk_hash: snark_wrapper, + snark_wrapper_vk_hash, }, ) .await; diff --git a/prover/crates/bin/prover_cli/src/commands/status/l1.rs b/prover/crates/bin/prover_cli/src/commands/status/l1.rs index 16cecc103828..4b403215e9c2 100644 --- a/prover/crates/bin/prover_cli/src/commands/status/l1.rs +++ b/prover/crates/bin/prover_cli/src/commands/status/l1.rs @@ -78,7 +78,7 @@ pub(crate) async fn run() -> anyhow::Result<()> { .await?; let node_l1_verifier_config = L1VerifierConfig { - recursion_scheduler_level_vk_hash: node_verification_key_hash, + snark_wrapper_vk_hash: node_verification_key_hash, }; let prover_connection_pool = ConnectionPool::::builder( @@ -149,7 +149,7 @@ fn pretty_print_l1_verifier_config( ) { print_hash_comparison( "Verifier key", - node_l1_verifier_config.recursion_scheduler_level_vk_hash, - db_l1_verifier_config.recursion_scheduler_level_vk_hash, + node_l1_verifier_config.snark_wrapper_vk_hash, + db_l1_verifier_config.snark_wrapper_vk_hash, ); } diff --git a/prover/crates/bin/witness_generator/src/main.rs b/prover/crates/bin/witness_generator/src/main.rs index 2dca22c24579..06414e43be3c 100644 --- a/prover/crates/bin/witness_generator/src/main.rs +++ b/prover/crates/bin/witness_generator/src/main.rs @@ -81,8 +81,7 @@ async fn ensure_protocol_alignment( } }; let keystore = Keystore::new_with_setup_data_path(setup_data_path); - // `recursion_scheduler_level_vk_hash` actually stores `scheduler_vk_hash` for historical reasons. - let scheduler_vk_hash = vk_commitments_in_db.recursion_scheduler_level_vk_hash; + let scheduler_vk_hash = vk_commitments_in_db.snark_wrapper_vk_hash; keystore .verify_scheduler_vk_hash(scheduler_vk_hash) .with_context(|| diff --git a/prover/crates/lib/prover_dal/.sqlx/query-1bf5ce7fbebe3e3552bbf88d229160892b5c4336c571d633ecebd30a78f9b68d.json b/prover/crates/lib/prover_dal/.sqlx/query-1bf5ce7fbebe3e3552bbf88d229160892b5c4336c571d633ecebd30a78f9b68d.json new file mode 100644 index 000000000000..50f00c9c5148 --- /dev/null +++ b/prover/crates/lib/prover_dal/.sqlx/query-1bf5ce7fbebe3e3552bbf88d229160892b5c4336c571d633ecebd30a78f9b68d.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n recursion_scheduler_level_vk_hash as snark_wrapper_vk_hash\n FROM\n prover_fri_protocol_versions\n WHERE\n id = $1\n AND protocol_version_patch = $2\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "snark_wrapper_vk_hash", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [ + "Int4", + "Int4" + ] + }, + "nullable": [ + false + ] + }, + "hash": "1bf5ce7fbebe3e3552bbf88d229160892b5c4336c571d633ecebd30a78f9b68d" +} diff --git a/prover/crates/lib/prover_dal/.sqlx/query-4f26bae35dd959448d9728ef7321fc79400930dddc84e042c5a4dc8a2e8508a5.json b/prover/crates/lib/prover_dal/.sqlx/query-4f26bae35dd959448d9728ef7321fc79400930dddc84e042c5a4dc8a2e8508a5.json deleted file mode 100644 index 73cd88457cd1..000000000000 --- a/prover/crates/lib/prover_dal/.sqlx/query-4f26bae35dd959448d9728ef7321fc79400930dddc84e042c5a4dc8a2e8508a5.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n recursion_scheduler_level_vk_hash\n FROM\n prover_fri_protocol_versions\n WHERE\n id = $1\n AND protocol_version_patch = $2\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "recursion_scheduler_level_vk_hash", - "type_info": "Bytea" - } - ], - "parameters": { - "Left": [ - "Int4", - "Int4" - ] - }, - "nullable": [ - false - ] - }, - "hash": "4f26bae35dd959448d9728ef7321fc79400930dddc84e042c5a4dc8a2e8508a5" -} diff --git a/prover/crates/lib/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json b/prover/crates/lib/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json deleted file mode 100644 index c713af9a210d..000000000000 --- a/prover/crates/lib/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n l1_batch_number\n FROM\n prover_jobs_fri\n WHERE\n status <> 'skipped'\n AND status <> 'successful'\n AND aggregation_round = $1\n ORDER BY\n l1_batch_number ASC\n LIMIT\n 1\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "l1_batch_number", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Int2" - ] - }, - "nullable": [ - false - ] - }, - "hash": "61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513" -} diff --git a/prover/crates/lib/prover_dal/.sqlx/query-6abe9c53a05a6ea156b84fc66c42778bee814722e3b2fbadc12847fc080899b4.json b/prover/crates/lib/prover_dal/.sqlx/query-6abe9c53a05a6ea156b84fc66c42778bee814722e3b2fbadc12847fc080899b4.json new file mode 100644 index 000000000000..dfb4ea4c2920 --- /dev/null +++ b/prover/crates/lib/prover_dal/.sqlx/query-6abe9c53a05a6ea156b84fc66c42778bee814722e3b2fbadc12847fc080899b4.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT\n recursion_scheduler_level_vk_hash as snark_wrapper_vk_hash\n FROM\n prover_fri_protocol_versions\n ORDER BY\n id DESC\n LIMIT\n 1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "snark_wrapper_vk_hash", + "type_info": "Bytea" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false + ] + }, + "hash": "6abe9c53a05a6ea156b84fc66c42778bee814722e3b2fbadc12847fc080899b4" +} diff --git a/prover/crates/lib/prover_dal/.sqlx/query-ed0f22d3d2c8b0d9bd1b4360a0f7999388451886a3eb9b4481b55404b16b89ac.json b/prover/crates/lib/prover_dal/.sqlx/query-ed0f22d3d2c8b0d9bd1b4360a0f7999388451886a3eb9b4481b55404b16b89ac.json deleted file mode 100644 index d699aae174c7..000000000000 --- a/prover/crates/lib/prover_dal/.sqlx/query-ed0f22d3d2c8b0d9bd1b4360a0f7999388451886a3eb9b4481b55404b16b89ac.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n recursion_scheduler_level_vk_hash\n FROM\n prover_fri_protocol_versions\n ORDER BY\n id DESC\n LIMIT\n 1\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "recursion_scheduler_level_vk_hash", - "type_info": "Bytea" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false - ] - }, - "hash": "ed0f22d3d2c8b0d9bd1b4360a0f7999388451886a3eb9b4481b55404b16b89ac" -} diff --git a/prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs b/prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs index caf620882bc2..5d9c16b154a6 100644 --- a/prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs +++ b/prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs @@ -17,6 +17,7 @@ impl FriProtocolVersionsDal<'_, '_> { id: ProtocolSemanticVersion, l1_verifier_config: L1VerifierConfig, ) { + // `recursion_scheduler_level_vk_hash` column actually stores `snark_wrapper_vk_hash` sqlx::query!( r#" INSERT INTO @@ -27,7 +28,7 @@ impl FriProtocolVersionsDal<'_, '_> { "#, id.minor as i32, l1_verifier_config - .recursion_scheduler_level_vk_hash + .snark_wrapper_vk_hash .as_bytes(), id.patch.0 as i32 ) @@ -43,7 +44,7 @@ impl FriProtocolVersionsDal<'_, '_> { sqlx::query!( r#" SELECT - recursion_scheduler_level_vk_hash + recursion_scheduler_level_vk_hash AS snark_wrapper_vk_hash FROM prover_fri_protocol_versions WHERE @@ -57,9 +58,7 @@ impl FriProtocolVersionsDal<'_, '_> { .await .unwrap() .map(|row| L1VerifierConfig { - recursion_scheduler_level_vk_hash: H256::from_slice( - &row.recursion_scheduler_level_vk_hash, - ), + snark_wrapper_vk_hash: H256::from_slice(&row.snark_wrapper_vk_hash), }) } @@ -67,7 +66,7 @@ impl FriProtocolVersionsDal<'_, '_> { let result = sqlx::query!( r#" SELECT - recursion_scheduler_level_vk_hash + recursion_scheduler_level_vk_hash AS snark_wrapper_vk_hash FROM prover_fri_protocol_versions ORDER BY @@ -80,9 +79,7 @@ impl FriProtocolVersionsDal<'_, '_> { .await?; Ok(L1VerifierConfig { - recursion_scheduler_level_vk_hash: H256::from_slice( - &result.recursion_scheduler_level_vk_hash, - ), + snark_wrapper_vk_hash: H256::from_slice(&result.snark_wrapper_vk_hash), }) }