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
    • Code notes
  • how to use macro

how to use macro · Changes

Page history
update authored Nov 14, 2023 by geruiwang's avatar geruiwang
Show whitespace changes
Inline Side-by-side
Showing with 11 additions and 9 deletions
+11 -9
  • code-notes/how-to-use-macro.markdown code-notes/how-to-use-macro.markdown +11 -9
  • No files found.
code-notes/how-to-use-macro.markdown 0 → 100644
View page @ 76467712
# 使用宏(macro)使代码更精简
- `get_every_execution_gadgets`可以获得一个Vec<ExecutionGadget>。每开发一个ExecutionGadget,都要在其定义处加上gadget的new函数。这样我们在core里或者witness生成的地方就可以直接调用它获取所有的ExecutionGadget。
- `generate_execution_gadget_test_circuit`在每个execution gadget文件里的`mod test`中使用,可以帮助你定义一个TestCircuit并生成相应的接口实现代码。
- `prepare_witness_and_prover`在每个execution gadget文件里的测试函数`fn text_xx()`中使用,能生成witness并将其放入一个TestCircuit的实例中,然后生成对应的MockProver。
- `extract_lookup_expression`对于我们定义的enum `LookupEntry`,可以展开其中的成员。不过必须要输入表示其类型的字符串。例如`let (a,b,c,d,e,f,g,h) = extract_lookup_expression!(state, lookup_entry);` 其中state是字符串。
- `assign_or_panic`是对于Witness表格中一个格子进行赋值。如果格子已经被赋值,则报错。多用于多功能列中,防止同一个格子被使用多次。
\ No newline at end of file
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号