您当前的位置: 首页 > 

mutourend

暂无认证

  • 1浏览

    0关注

    661博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

appliedzkp zkevm(9)中的Bytecode Proof

mutourend 发布时间:2022-06-26 20:34:54 ,浏览量:1

1. 引言

bytecode proof可帮助EVM proof,使得bytecode更易于访问(bytecode以其code hash来标识)。bytecode中的每个byte可通过其在该bytecode中的位置来访问。同时标注了一个flag来标识该byte 是一个opcode 还是 给前一PUSH指令的data。

2. Bytecode Circuit Layout ColumnDescriptionq_first1 on the first row, else 0q_last1 on the last row, else 0hashThe keccak hash of the bytecodetagTag indicates whether value is a byte or length of the bytecodeindexThe position of the byte in the bytecodevalueThe byte data for the current position, or length of the bytecodeis_code1 if the byte is code, 0 if the byte is PUSH datapush_data_leftThe number of PUSH data bytes that still follow the current rowhash_rlcThe accumulator containing the current and previous byteshash_lengthThe bytecode lengthbyte_push_sizeThe number of bytes pushed for the current byteis_final1 if the current byte is the last byte of the bytecode, else 0padding1 if the current row is padding, else 0push_data_left_invThe inverse of push_data_left (IsZeroChip helper)push_table.bytePush Table: A byte valuepush_table.push_sizePush Table: The number of bytes pushed for this byte as opcode 3. Push lookup table

push lookup table用于find how many bytes an opcode pushes,用于探测哪个byte是code,哪个byte不是code。

由于会对每个byte进行lookup,该table也可间接用于range check the byte inputs。

ByteNum bytes pushed[0, OpcodeId::PUSH1]0[OpcodeId::PUSH1, OpcodeId::PUSH32][1..32][OpcodeId::PUSH32, 256]0 3.1 Circuit behavior

该circuit 以通过设置tag = Length添加bytecode length的行 开始,然后自位置0开始,遍历该bytecode的所有bytes。

参考资料

[1] zkevm-specs Bytecode Proof

关注
打赏
1664532908
查看更多评论
立即登录/注册

微信扫码登录

0.0374s