... | ... | @@ -427,7 +427,7 @@ fn gen_witness(&self, trace: &GethExecStep, current_state: &mut WitnessExecHelpe |
|
|
|
|
|
#### get_lookups
|
|
|
|
|
|
从core row, cnt=1,vers[24]~vers[31]的位置位置获取值,去向为Bytecode进行lookup, 这里使用的lookUp类型为`LookupEntry::BytecodeFull`
|
|
|
从core row, cnt=1,vers[24]~vers[31]的位置获取值,去向为Bytecode进行lookup, 这里使用的LookUp类型为`LookupEntry::BytecodeFull`
|
|
|
|
|
|
```rust
|
|
|
fn get_lookups(
|
... | ... | @@ -466,7 +466,7 @@ fn gen_witness(&self, trace: &GethExecStep, current_state: &mut WitnessExecHelpe |
|
|
}
|
|
|
```
|
|
|
|
|
|
## CODECOPY/EXTCODECOPY
|
|
|
## EXTCODECOPY
|
|
|
|
|
|
### 概述
|
|
|
|
... | ... | @@ -495,7 +495,7 @@ STOP |
|
|
|
|
|
|
|
|
|
|
|
### Witness Code Row
|
|
|
### Witness Core Row
|
|
|
|
|
|
core row的表格设计如下:
|
|
|
|
... | ... | @@ -556,6 +556,7 @@ cnt=2, vers[8]~vers[17] 为padding copy row进行LookUp的值 |
|
|
) -> (Vec<copy::Row>, Vec<state::Row>, u64, u64, u64) {
|
|
|
//...
|
|
|
|
|
|
// NoPaddingCopyRow赋值
|
|
|
let codecopy_stamp = self.state_stamp;
|
|
|
if code_copy_length > 0 {
|
|
|
for i in 0..code_copy_length {
|
... | ... | @@ -578,6 +579,7 @@ cnt=2, vers[8]~vers[17] 为padding copy row进行LookUp的值 |
|
|
}
|
|
|
}
|
|
|
|
|
|
// PaddingCopyRow赋值
|
|
|
let codecopy_padding_stamp = self.state_stamp;
|
|
|
if padding_length > 0 {
|
|
|
for i in 0..padding_length {
|
... | ... | @@ -615,14 +617,7 @@ fn gen_witness(&self, trace: &GethExecStep, current_state: &mut WitnessExecHelpe |
|
|
let (stack_pop_0, address) = current_state.get_pop_stack_row_value(&trace);
|
|
|
assert!(address.leading_zeros() >= ADDRESS_ZERO_COUNT);
|
|
|
//let address_code = current_state.bytecode.get(&address).unwrap();
|
|
|
let (stack_pop_1, mem_offset) = current_state.get_pop_stack_row_value(&trace);
|
|
|
|
|
|
let (stack_pop_2, code_offset) = current_state.get_pop_stack_row_value(&trace);
|
|
|
|
|
|
let (stack_pop_3, size) = current_state.get_pop_stack_row_value(&trace);
|
|
|
|
|
|
let mut core_row_2 = current_state.get_core_row_without_versatile(&trace, 2);
|
|
|
|
|
|
// ...
|
|
|
let (copy_rows, mem_rows, input_length, padding_length, code_copy_length) =
|
|
|
current_state.get_code_copy_rows_new(address, mem_offset, code_offset, size);
|
|
|
|
... | ... | @@ -635,27 +630,7 @@ fn gen_witness(&self, trace: &GethExecStep, current_state: &mut WitnessExecHelpe |
|
|
default_padding_row = ©_rows[code_copy_length as usize]
|
|
|
}
|
|
|
|
|
|
core_row_2.insert_copy_lookup_new(
|
|
|
default_copy_row,
|
|
|
default_padding_row,
|
|
|
code_copy_length,
|
|
|
padding_length,
|
|
|
);
|
|
|
|
|
|
let mut core_row_1 = current_state.get_core_row_without_versatile(&trace, 1);
|
|
|
|
|
|
core_row_1.insert_state_lookups([&stack_pop_0, &stack_pop_1, &stack_pop_2, &stack_pop_3]);
|
|
|
let core_row_0 = ExecutionState::EXTCODECOPY.into_exec_state_core_row(
|
|
|
trace,
|
|
|
current_state,
|
|
|
NUM_STATE_HI_COL,
|
|
|
NUM_STATE_LO_COL,
|
|
|
);
|
|
|
|
|
|
let mut state_vec = vec![stack_pop_0, stack_pop_1, stack_pop_2, stack_pop_3];
|
|
|
if mem_rows.len() > 0 {
|
|
|
state_vec.extend(mem_rows);
|
|
|
}
|
|
|
// ...
|
|
|
if input_length > 0 {
|
|
|
Witness {
|
|
|
copy: copy_rows,
|
... | ... | @@ -798,13 +773,3 @@ LookUp约束被放在cnt=2的CopyRow,被分为两个种约束:NoPaddingCopy |
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|