risc0_circuit_recursion/prove/zkr.rs
1// Copyright 2024 RISC Zero, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use crate::REGISTER_GROUP_CODE;
16use anyhow::Result;
17use risc0_zkp::{adapter::TapsProvider, field::baby_bear::BabyBearElem};
18
19use super::{Program, CIRCUIT, RECURSION_CODE_SIZE};
20
21pub fn get_zkr(name: &str, po2: usize) -> Result<Program> {
22 let code_size = CIRCUIT.get_taps().group_size(REGISTER_GROUP_CODE);
23 assert_eq!(code_size, RECURSION_CODE_SIZE);
24
25 let u32s = crate::zkr::get_zkr(name)?;
26 Ok(Program {
27 code: u32s.iter().cloned().map(BabyBearElem::from).collect(),
28 code_size,
29 po2,
30 })
31}