|
|
|
|
|
## EVM-LOG指令定义
|
|
|
> 参考:<https://ethervm.io/#LOG0>
|
|
|
|
... | ... | @@ -15,7 +14,7 @@ |
|
|
**LOG0**
|
|
|
```
|
|
|
flowchart LR
|
|
|
LogBytes
|
|
|
LogBytes --> LogTopicNumAddr
|
|
|
```
|
|
|
|
|
|
**LOG1-LOG4**
|
... | ... | @@ -30,11 +29,19 @@ flowchart LR |
|
|
- LogTopic: 处理每一个TopicHash处理(Public Lookup)
|
|
|
|
|
|
|
|
|
|
|
|
## 具体Gadget设计
|
|
|
### LogBytesGadget设计
|
|
|
处理memory[offset:offset+length],数据从Memory拷贝到PulbicLog
|
|
|
|
|
|
主要约束:
|
|
|
- state_stamp = pre + 2
|
|
|
- log_stamp = pre + 1
|
|
|
- next_pc = pc
|
|
|
|
|
|
gen_witness状态变化
|
|
|
- log_stamp += 1
|
|
|
|
|
|
|
|
|
|cnt| | | | |
|
|
|
|---|-------|-------|---------|---------|
|
|
|
| 2 | COPY(9) |-| -|PUBLIC(6) |
|
... | ... | @@ -78,6 +85,15 @@ flowchart LR |
|
|
|
|
|
### LogTopicNumAddrGadget设计
|
|
|
|
|
|
主要约束:
|
|
|
- state_stamp = pre
|
|
|
- log_stamp = pre
|
|
|
- next_pc = pc + (1 * topic_left_0)
|
|
|
|
|
|
gen_witness状态变化
|
|
|
- 根据opcode 初始化state.topic_left
|
|
|
|
|
|
|
|
|
|cnt| | | | |
|
|
|
|---|-------|-------|---------|---------|
|
|
|
| 2 | - |-| -|PUBLIC(6) |
|
... | ... | @@ -100,6 +116,13 @@ flowchart LR |
|
|
|
|
|
|
|
|
### LogTopicGadget设计
|
|
|
主要约束:
|
|
|
- state_stamp = pre
|
|
|
- log_stamp = pre
|
|
|
- next_pc = pc + (1 * topic_left_0)
|
|
|
|
|
|
gen_witness状态变化
|
|
|
- state.topic_left-=1
|
|
|
|
|
|
|cnt| | | | |
|
|
|
|---|-------|-------|---------|---------|
|
... | ... | |