【Decompose】 电路执行顺序问题 #52
-
在 Decompose 代码里,有一个地方没明白:
以上是我打印出的各个函数执行的顺序信息, 为什么 MyCircuit 的 synthesize 执行了 2 次? 第一次 Layouter 没有干事,第二次才开始赋值
这说明第一次执行 fn synthesize(
&self,
config: Self::Config,
mut layouter: impl Layouter<F>,
) -> Result<(), Error> {
println!("MyCircuit - synthesize");
config.table.load(&mut layouter)?;
println!("self.value {:?}",self.value );
let value = layouter.assign_region(
|| "Witness value",
|mut region| {
region.assign_advice(|| "Witness value", config.running_sum, 0, || self.value)
},
)?;
config.assign(
layouter.namespace(|| "synthesize decompose value"),
value, // value 0x9a.
self.num_bits, // 8, the len of binary form of the num `154`.
)?;
Ok(())
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
我当时也有这个困惑,我的理解第一次是生成没有witness的电路,第二次是把witness放到里面去。至于为什么这么做,我也不太清楚(模模糊糊感觉是为了做sanity check) |
Beta Was this translation helpful? Give feedback.
-
What you put here is the callee not caller, which might not buy us any good. Take MockProver as an example
It states clearly. First time it only gets shape of region, while second time it assigns concrete values. |
Beta Was this translation helpful? Give feedback.
What you put here is the callee not caller, which might not buy us any good.
Take MockProver as an example
call stack: