Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
zkevm-circuits
zkevm-circuits
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

  • zkp
  • zkevm-circuitszkevm-circuits
  • Wiki
    • Zkevm docs
  • 10 public

10 public · Changes

Page history
chore: update 10-public doc authored Jul 11, 2024 by gzxu's avatar gzxu
Show whitespace changes
Inline Side-by-side
Showing with 32 additions and 33 deletions
+32 -33
  • zkevm-docs/10-public.markdown zkevm-docs/10-public.markdown +32 -33
  • No files found.
zkevm-docs/10-public.markdown
View page @ db5f8875
......@@ -58,73 +58,72 @@ values: [Column<Instance>; NUM_VALUES],
| :--: | :--: | :--: | :--: | :--: | :--: |
| ChainId | 0 | chain_id[..16] | chain_id[16..] | 0 | 0 |
#### tag为BlockCoinbase时,该行数据值为:
#### tag为BlockNumber时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockCoinbase | 0 | coinbase[..4] | coinbase[4..] | 0 | 0 |
| BlockNumber | 0 | 0 | Block_Number_first | 0 | Block_Num_in_chunk |
#### tag为BlockTimeStamp时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockTimestamp | 0 | BlockTimestamp[..16] | BlockTimestamp[16..] | 0 | 0 |
当前block的 BlockNumber_cur = Block_Number_first + block_idx_cur
#### tag为BlockNumber时,该行数据值为:
#### tag为BlockHash的时候,遍历最近的history_hash,每行存放数据值如下:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockNumber | 0 | 0 | BlockNumber | 0 | 0 |
| BlockHash | max_block_idx | hash[..16] | hash[16..] | 0 | 0 |
#### tag为BlockDifficulty时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockDifficulty | 0 | BlockDifficulty[..16] | BlockDifficulty[16..] | 0 | 0 |
block\_tx\_idx  存  max\_block\_idx  (表示该hash最多能被 chunk 内第几个block读取到),value\[2\] 存 block\_number(表示当前hahs对应的block\_number)
从stack中弹出要读取的 blcok\_number\_pop,读取当前区块的 blcok\_number\_cur,block\_idx\_cur。这样 lookup 时相关的约束就改成了:
1. max\_block\_idx = blcok\_number\_pop + 256 - block\_number\_first
#### tag为BlockGasLimit时,该行数据值为:
2. value2 = blcok\_number\_pop
3. 另外,max\_block\_idx - block\_idx\_cur - 1 需要约束 U8 lookup。
#### tag为BlockCoinbaseAndTimestamp时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockGasLimit | 0 | BlockGasLimit[..16] | BlockGasLimit[16..] | 0 | 0 |
| BlockCoinbaseAndTimestamp | block index | coinbase[..4] | coinbase[4..] | BlockTimestamp[..16] | BlockTimestamp[16..] |
#### tag为BlockBaseFee时,该行数据值为:
#### tag为BlockGasLimitAndBaseFee时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockBaseFee | 0 | BlockBaseFee[..16] | BlockBaseFee[16..] | 0 | 0 |
| BlockGasLimitAndBaseFee | block index | BlockGasLimit[..16] | BlockGasLimit[16..] | BlockBaseFee[..16] | BlockBaseFee[16..] |
#### tag为BlockHash的时候,遍历最近的history_hash,每行存放数据值如下,其中index代表在history_hash中的次序(也是当前区块number-此区块number的差值),hash为该次序对应的hash值:
#### tag为BlockTxLogNumAndDifficulty时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| BlockHash | index | hash[..16] | hash[16..] | 0 | 0 |
| BlockTxLogNumAndDifficulty | block index | tx_num | log_num | BlockDifficulty[..16] | BlockDifficulty[16..] |
### 区块交易相关数据存放
对区块中的每一笔交易遍历存放如下数据类型,其中tx_idx为该交易在区块中的交易列表中的序号(从1开始)
#### tag为TxFromValue时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxFromValue | tx_idx | from[..4] | from[4..] | value[..16] | value[16..] |
| TxFromValue | block_tx_idx | from[..4] | from[4..] | value[..16] | value[16..] |
#### tag为TxToCallDataSize时,该行数据值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxToCallDataSize | tx_idx | to_hi | to_lo | 0 | tx.input.len |
| TxToCallDataSize | block_tx_idx | to_hi | to_lo | 0 | tx.input.len |
#### tag为TxIsCreate时,该行数值为:
#### tag为TxIsCreateAndStatus时,该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxIsCreate | tx_idx | 0 | 1/0(创建合约为1,普通合约调用为0) | 0 | 0 |
| TxIsCreateAndStatus | block_tx_idx | 1/0(if create contract is 1,else 0) | call data gas cost | call data size | tx status |
#### tag为TxGasLimit时,该行数值为:
#### tag为TxGasLimitAndGasPrice时,该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxGasLimit | tx_idx | gas[..16] | gas[16..] | 0 | 0 |
| TxGasLimitAndGasPrice | block_tx_idx | None | tx.gas | gas_price[..16] | gas_price[16..] |
#### tag为TxGasPrice时,该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxGasPrice | tx_idx | gas_price[..16] | gas_price[16..] | 0 | 0 |
#### 将合约的输入数据按byte遍历, 每个byte存放进TxCalldata的数据行,其中idx为该byte在合约的输入数据中的次序,byte为该次序对应的byte数据,该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxCalldata | tx_idx | idx | byte | 0 | 0 |
| TxCalldata | block_tx_idx | 0 | 0 | idx | byte |
### 区块log数据存放
区块中每笔交易可以产生多条log,遍历区块中每笔交易的每个log,其中topic_num为该log中topics的数目(不超过4);tx_idx为该log所属的transaction_index;log_index为该log的log_index;address为该log所属的地址;如果topic_num为0的话,log_tag为AddrWith0Topic;如果topic_num为1/2/3/4的话,log_tag为AddrWith1/2/3/4Topic。
......@@ -132,12 +131,12 @@ values: [Column<Instance>; NUM_VALUES],
#### tag为TxLog,该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxLog | tx_idx | log_index | log_tag | address[..4] | address[4..] |
| TxLog | block_tx_idx | log_index | log_tag | address[..4] | address[4..] |
#### tag为TxLog的时候,根据topic的数目,依次存放topic1/2/3/4的数据,其中topic_hash为该topic对应的hash,topic_log_tag为Topic1/2/3/4,每行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
| :--: | :--: | :--: | :--: | :--: | :--: |
| TxLog | tx_idx | log_index | topic_log_tag | topic_hash[..16] | topic_hash[16..] |
| TxLog | block_tx_idx | log_index | topic_log_tag | topic_hash[..16] | topic_hash[16..] |
#### tag为TxLog时候,记录了log的data长度(data_len),该行数值为:
| tag | block_tx_idx | value[0] | values[1] | values[2] | values[3] |
......
Clone repository
  • basics
    • evm
    • halo2
  • code notes
    • binary_number_with_real_selector
    • how to use macro
    • simple_lt
    • simple_lt_word
  • Home
  • image
  • zkevm docs
    • 1 introduction
    • 10 public
    • 11 fixed
    • 12 exp
    • 13 keccak
    • 14 comparisons
    • 15 differences
View All Pages

Copyright © 2024 ChainWeaver Org. All Rights Reserved. 版权所有。

京ICP备2023035722号-3

京公网安备 11010802044225号