Skip to content

Commit

Permalink
fix(crypto): update snark-vk to be used in server and update args for…
Browse files Browse the repository at this point in the history
… proof wrapping (#240)

# What ❔

* fix(crypto): update snark-vk to be used in server and update args for
proof wrapping

## Why ❔

* Rn the server sends the blob with protocol version using scheduler_vk
which is different from the one used in prover(snark_scheduler_vk)

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ *] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ *] Tests for the changes have been added / updated.
- [ *] Documentation comments have been added / updated.
- [ *] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
akash-chandrakar committed Oct 20, 2023
1 parent 9e20703 commit 4a5c54c
Show file tree
Hide file tree
Showing 8 changed files with 269 additions and 255 deletions.
6 changes: 5 additions & 1 deletion core/lib/config/src/configs/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct ContractsConfig {
pub fri_recursion_node_level_vk_hash: H256,
pub fri_recursion_leaf_level_vk_hash: H256,
pub governance_addr: Option<Address>,
pub snark_wrapper_vk_hash: H256,
}

impl ContractsConfig {
Expand Down Expand Up @@ -95,6 +96,9 @@ mod tests {
"0x72167c43a46cf38875b267d67716edc4563861364a3c03ab7aee73498421e828",
),
governance_addr: None,
snark_wrapper_vk_hash: hash(
"0x4be443afd605a782b6e56d199df2460a025c81b3dea144e135bece83612563f2",
),
}
}

Expand Down Expand Up @@ -128,7 +132,7 @@ CONTRACTS_L1_MULTICALL3_ADDR="0xcA11bde05977b3631167028862bE2a173976CA11"
CONTRACTS_FRI_RECURSION_SCHEDULER_LEVEL_VK_HASH="0x201d4c7d8e781d51a3bbd451a43a8f45240bb765b565ae6ce69192d918c3563d"
CONTRACTS_FRI_RECURSION_NODE_LEVEL_VK_HASH="0x5a3ef282b21e12fe1f4438e5bb158fc5060b160559c5158c6389d62d9fe3d080"
CONTRACTS_FRI_RECURSION_LEAF_LEVEL_VK_HASH="0x72167c43a46cf38875b267d67716edc4563861364a3c03ab7aee73498421e828"
CONTRACTS_SNARK_WRAPPER_VK_HASH="0x4be443afd605a782b6e56d199df2460a025c81b3dea144e135bece83612563f2"
"#;
lock.set_env(config);

Expand Down
66 changes: 33 additions & 33 deletions core/lib/dal/sqlx-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6376,6 +6376,39 @@
},
"query": "\n SELECT id, circuit_input_blob_url FROM prover_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND circuit_input_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n "
},
"892ad2bed255401e020b4cf89c9e43e32c333dc6627e1e2d2535e13b73d1c508": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Int8"
},
{
"name": "status",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "attempts",
"ordinal": 2,
"type_info": "Int2"
}
],
"nullable": [
false,
false,
false
],
"parameters": {
"Left": [
"Interval",
"Int2"
]
}
},
"query": "\n UPDATE prover_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'in_gpu_proof' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING id, status, attempts\n "
},
"8996a1794585dfe0f9c16a11e113831a63d5d944bc8061d7caa25ea33f12b19d": {
"describe": {
"columns": [
Expand Down Expand Up @@ -10206,39 +10239,6 @@
},
"query": "SELECT timestamp, virtual_blocks FROM miniblocks WHERE number BETWEEN $1 AND $2 ORDER BY number"
},
"e1ad7a51afef6bd7a95df3294f64b7b1bdc4c4fc7ae5c4195802177986f3e876": {
"describe": {
"columns": [
{
"name": "id",
"ordinal": 0,
"type_info": "Int8"
},
{
"name": "status",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "attempts",
"ordinal": 2,
"type_info": "Int2"
}
],
"nullable": [
false,
false,
false
],
"parameters": {
"Left": [
"Interval",
"Int2"
]
}
},
"query": "\n UPDATE prover_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING id, status, attempts\n "
},
"e29d263f33257a37f391907b7ff588f416a0350b606f16f4779fa1d3bf4be08b": {
"describe": {
"columns": [
Expand Down
1 change: 1 addition & 0 deletions core/lib/dal/src/fri_prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl FriProverDal<'_, '_> {
UPDATE prover_jobs_fri
SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()
WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)
OR (status = 'in_gpu_proof' AND processing_started_at <= now() - $1::interval AND attempts < $2)
OR (status = 'failed' AND attempts < $2)
RETURNING id, status, attempts
",
Expand Down
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/proof_data_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn fri_l1_verifier_config_from_env() -> anyhow::Result<L1VerifierConfig> {
// The base layer commitment is not used in the FRI prover verification.
recursion_circuits_set_vks_hash: H256::zero(),
},
recursion_scheduler_level_vk_hash: config.fri_recursion_scheduler_level_vk_hash,
recursion_scheduler_level_vk_hash: config.snark_wrapper_vk_hash,
})
}

Expand Down
Loading

0 comments on commit 4a5c54c

Please sign in to comment.