Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Exponentiation circuit and EXP opcode#255

Merged
ChihChengLiang merged 26 commits into
privacy-ethereum:masterfrom
scroll-tech:feat/exp
Oct 25, 2022
Merged

Exponentiation circuit and EXP opcode#255
ChihChengLiang merged 26 commits into
privacy-ethereum:masterfrom
scroll-tech:feat/exp

Conversation

@roynalnaruto
Copy link
Copy Markdown
Collaborator

@roynalnaruto roynalnaruto commented Aug 23, 2022

This PR implements the following:

  • EXP Gadget
  • Exponentiation Circuit
  • Exponentiation Table (verified within Exponentiation Circuit)

The EXP opcode computes the exponentiation result of an integer base to an integer exponent:

base ^ exponent == exponentiation (mod 2^256)

The exponentiation circuit verifies the exponentiation trace, i.e. intermediate multiplication steps generated by the Exponentiation by Squaring algorithm.

The EXP opcode gadget does lookups (conditional based on the exponent value) to the exponentiation table.

Comment thread tests/evm/test_exp.py Outdated
@roynalnaruto roynalnaruto requested a review from adria0 September 23, 2022 03:30
Copy link
Copy Markdown
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the text description parts.
There are many unorganized questions. Feel free to pick just the ones you feel important to answer

Comment thread specs/exp-proof.md Outdated
Comment thread specs/exp-proof.md Outdated
Comment thread specs/exp-proof.md Outdated
Comment thread specs/tables.md Outdated
Comment thread specs/tables.md
Comment thread specs/exp-proof.md Outdated
Comment thread specs/tables.md Outdated
Comment thread specs/tables.md Outdated
Comment thread specs/tables.md Outdated
Comment thread specs/opcode/0AEXP.md
Comment thread src/zkevm_specs/exp_circuit.py
@adria0
Copy link
Copy Markdown
Contributor

adria0 commented Sep 28, 2022

@roynalnaruto really nice written spec, very easy to follow the py code from it!

I am not able to find anything, just curious about your answers, to approve the PR.

@adria0
Copy link
Copy Markdown
Contributor

adria0 commented Oct 11, 2022

@roynalnaruto any blocker for finishing this PR?

@roynalnaruto
Copy link
Copy Markdown
Collaborator Author

@adria0 no blockers. I am updating the specs repo and also the design document. Should push an update this week

@adria0
Copy link
Copy Markdown
Contributor

adria0 commented Oct 11, 2022

Thanks for the update, @roynalnaruto!

@roynalnaruto
Copy link
Copy Markdown
Collaborator Author

@ChihChengLiang @adria0 Apologies I was a little occupied with some other tasks. I will post updates to the design doc as well as the specs PR this week. Will also post answers to all your comments. Thanks for the review :)

Copy link
Copy Markdown
Contributor

@adria0 adria0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@roynalnaruto
Copy link
Copy Markdown
Collaborator Author

@ChihChengLiang I've answered all your questions and updated the documents/specs. Could you review again?

@roynalnaruto roynalnaruto requested a review from adria0 October 20, 2022 06:55
@ChihChengLiang
Copy link
Copy Markdown
Collaborator

rereviewing now. Thanks for waiting.

Copy link
Copy Markdown
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Epic PR! I added some nitpicks.

Comment thread specs/exp-proof.md Outdated
Comment thread specs/exponentiation-circuit.md Outdated
Comment thread specs/exp-proof.md Outdated
Comment thread specs/exponentiation-circuit.md Outdated
roynalnaruto and others added 4 commits October 25, 2022 03:06
Co-authored-by: Chih Cheng Liang <chihchengliang@gmail.com>
Co-authored-by: Chih Cheng Liang <chihchengliang@gmail.com>
@roynalnaruto
Copy link
Copy Markdown
Collaborator Author

@ChihChengLiang updated the PR with all suggestions. Shall we merge it now?

@ChihChengLiang ChihChengLiang merged commit 9ec6663 into privacy-ethereum:master Oct 25, 2022
@silathdiir silathdiir deleted the feat/exp branch February 20, 2023 04:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants