Skip to content

Spec for opcode SHL#43

Closed
silathdiir wants to merge 21 commits into
masterfrom
feat/opcode-shl
Closed

Spec for opcode SHL#43
silathdiir wants to merge 21 commits into
masterfrom
feat/opcode-shl

Conversation

@silathdiir
Copy link
Copy Markdown

@silathdiir silathdiir commented May 19, 2022

Circuit: scroll-tech/zkevm-circuits#157

Summary

  1. Integrate both opcode SHL and SHR into mul_div_mod (rename to mul_div_mod_shl_shr).

  2. Consider SHL as MUL (a * (1 << shift) = b) and SHR as DIV (a // (1 << shift) = b).

@silathdiir silathdiir requested a review from z2trillion June 4, 2022 11:39
@silathdiir silathdiir marked this pull request as draft June 7, 2022 02:42
@silathdiir silathdiir marked this pull request as ready for review June 9, 2022 12:51
Comment thread src/zkevm_specs/evm/execution/mul_div_mod_shl_shr.py Outdated
Comment thread specs/opcode/02MUL_04DIV_06MOD_1bSHL_1cSHR.md Outdated
Comment thread specs/opcode/02MUL_04DIV_06MOD_1bSHL_1cSHR.md Outdated
Comment thread src/zkevm_specs/evm/execution_state.py Outdated
Comment thread tests/evm/test_mul_div_mod_shl_shr.py Outdated
@silathdiir silathdiir requested a review from z2trillion June 14, 2022 00:21
@silathdiir
Copy link
Copy Markdown
Author

silathdiir commented Jun 14, 2022

Will move to upstream after synchronizing with code review of the circuit code.

davidnevadoc and others added 2 commits June 15, 2022 11:48
* Add `MULMOD` md draft

* Add `MULMOD` implementation

* Add tests

* Add function `mul_add_words_512`

* Account for overflow in word multiplication

* Add edge case test

* Add additional reduction of factor

* Update specs/opcode/09MULMOD.md

Co-authored-by: Eduard S. <eduardsanou@posteo.net>

* Add `a_reduced < n` constraint

* Add 0 overflow constraint to first reduction

* Update `MULMOD` spec

  - Add mod gadget
  - Fix several overflow related bugs

* Add note justifying first factor reduction

Co-authored-by: Eduard S. <eduardsanou@posteo.net>
@silathdiir silathdiir requested a review from z2trillion June 16, 2022 02:31
@silathdiir
Copy link
Copy Markdown
Author

Thanks for code review. Moved to upstream privacy-ethereum#225.

@silathdiir silathdiir closed this Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants