Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Barret reduction for modexp #170

Draft
wants to merge 59 commits into
base: main
Choose a base branch
from
Draft

Commits on Sep 22, 2023

  1. Initial new implementation

    ilitteri committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    7e59313 View commit details
    Browse the repository at this point in the history
  2. Fix compilation error

    ilitteri committed Sep 22, 2023
    Configuration menu
    Copy the full SHA
    9206d42 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2023

  1. Configuration menu
    Copy the full SHA
    9f11e74 View commit details
    Browse the repository at this point in the history
  2. Implement Big UInt Left Shift (#139)

    * Add `bigUIntShl` implementation
    
    * Add constants
    
    * Fix compilation
    ilitteri authored Sep 26, 2023
    Configuration menu
    Copy the full SHA
    db34989 View commit details
    Browse the repository at this point in the history
  3. Implement Big UInt Right Shift (#137)

    * Add `bigUIntShr` implementation
    
    * Add constants
    ilitteri authored Sep 26, 2023
    Configuration menu
    Copy the full SHA
    c954c0c View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2023

  1. Implement Big UInt Bitwise Or for modexp (#135)

    * Implement bigUIntBitOr
    
    * Fix bigUIntBitOr
    
    * Fix bigUIntBitOr
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Fix missing closing brackets
    
    ---------
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    jpcenteno and ilitteri authored Sep 27, 2023
    Configuration menu
    Copy the full SHA
    16558cb View commit details
    Browse the repository at this point in the history
  2. Implement big uint conditional select for modexp (#148)

    * Implement bigUIntCondSelect
    
    * Fix missing curly braces
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Implement Big UInt Right Shift (#137)
    
    * Add `bigUIntShr` implementation
    
    * Add constants
    
    * Implement Big UInt Bitwise Or for modexp (#135)
    
    * Implement bigUIntBitOr
    
    * Fix bigUIntBitOr
    
    * Fix bigUIntBitOr
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Fix missing closing brackets
    
    ---------
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    jpcenteno and ilitteri authored Sep 27, 2023
    Configuration menu
    Copy the full SHA
    b1645c0 View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2023

  1. Implement mul operation for big UInts (#151)

    * First implementation of mul operation for bigints
    
    * Fix multiplication for big integers
    
    * Fix some merge issues
    
    * Improve comments and function docs
    
    * Delete whitespaces
    IAvecilla authored Sep 29, 2023
    Configuration menu
    Copy the full SHA
    02db93f View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2023

  1. Substraction with borrow (#149)

    * First substraction draft
    
    * Fix compile problems
    
    * Working implementation
    
    * Updated code
    
    * Updated code
    
    * Update subtract implementation
    
    * Remove console_log
    
    * Add docs for function
    
    * Update function docs
    
    * Remove tests from from ModExp.yul
    
    * Fix typo
    
    * Restore horrible whitespaces to avoid an ugly merge conflict
    
    * Update precompiles/Modexp.yul
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Revert "Update precompiles/Modexp.yul"
    
    This reverts commit 582bc41.
    
    ---------
    
    Co-authored-by: Joaquín P. Centeno <jpcenteno@users.noreply.github.com>
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    3 people authored Oct 2, 2023
    Configuration menu
    Copy the full SHA
    2ff02cc View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2023

  1. Refactor modexp reimplementation (#156)

    * Make Big UInt API functions naming consistent
    
    * Refactor `bigUIntAdd` variable names
    
    * Refactor `bigUIntMul` variable names
    
    * Refactor `subLimbsWithBorrow`
    
    * Refactor `bigUintSubtractionWithBorrow`
    
    * Refactor `bigUIntAdd`
    
    * Fix `bigUIntSubWithBorrow`
    
    * Format `storeLimbValueAtOffset`
    
    * Refactor `bigUIntBitOr`
    
    Made it consistent with the rest of the code convention and naming
    
    * Refactor `bigUIntCondSelect`
    
    Made it consistent with the rest of the code convention and naming
    
    * Reorder `overflowingSubWithBorrow`
    
    * Move comment to modexp API Docs section
    ilitteri authored Oct 3, 2023
    Configuration menu
    Copy the full SHA
    b86bed6 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. Biguint division (#159)

    * Division draft
    
    * Non working draft
    
    * Fix compile errors
    
    * Use proper pointers for quotient and remainder
    
    * Add fix note, some more changes
    
    * Add comment
    
    * Implement `big_uint_bit_size`
    
    * Increase pointer to prevent it from steping over console_log
    
    * WIP divrem
    
    * Fix loop and zero initializer
    
    * Push test cases
    
    * Add other test case
    
    * Add docs and tests for `big_uint_inplace_or_1`
    
    * Fix bug related to bit shifting
    
    * Fix borrow return in big uint sub function
    
    * Delete playground file used for debugging
    
    * Fix sub with borrow function
    
    * Add playground again to check more big integer division tests
    
    * Remove playground used for testing
    
    * Write documentation for new shift functions
    
    * Improve naming and documentation for new helper functions
    
    * Rename bigUIntOrWith1 to bigUintInPlaceOrWith1
    
    * Add tmp buffer parameters to bigUIntDivRem. Improve docs.
    
    * Simplify subLimbsWithBorrow
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Remove `mul` call from `bigUIntInPlaceOrWith1`
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Remove multiplications from copyBigUint
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Optimize bigUIntBitSize loop
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Simplify zeroWithLimbSizeAt
    
    ---------
    
    Co-authored-by: Francisco Krause Arnim <fkrausear@gmail.com>
    Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    4 people authored Oct 5, 2023
    Configuration menu
    Copy the full SHA
    4a6a723 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2023

  1. Implement mul mod operation for big UInts (#161)

    * Division draft
    
    * Non working draft
    
    * Fix compile errors
    
    * Use proper pointers for quotient and remainder
    
    * Add fix note, some more changes
    
    * Add comment
    
    * Implement `big_uint_bit_size`
    
    * Increase pointer to prevent it from steping over console_log
    
    * WIP divrem
    
    * Fix loop and zero initializer
    
    * Push test cases
    
    * Add other test case
    
    * Add docs and tests for `big_uint_inplace_or_1`
    
    * Fix bug related to bit shifting
    
    * Fix borrow return in big uint sub function
    
    * Delete playground file used for debugging
    
    * Fix sub with borrow function
    
    * Add playground again to check more big integer division tests
    
    * Remove playground used for testing
    
    * Write documentation for new shift functions
    
    * Improve naming and documentation for new helper functions
    
    * Rename bigUIntOrWith1 to bigUintInPlaceOrWith1
    
    * Add tmp buffer parameters to bigUIntDivRem. Improve docs.
    
    * Add big uint mul mod skeleton
    
    * Remove wrong comment
    
    * Update algorithm comment
    
    * Add limb size doubling and divide by two for mul mod operation
    
    * Functions to duplicate and halve limb size work in place
    
    * Use camelCase
    
    * Remove console_log
    
    * Add docs
    
    * Update doc
    
    ---------
    
    Co-authored-by: Francisco Krause Arnim <fkrausear@gmail.com>
    Co-authored-by: Joaquín P. Centeno <jpcenteno@users.noreply.github.com>
    3 people authored Oct 6, 2023
    Configuration menu
    Copy the full SHA
    06df32c View commit details
    Browse the repository at this point in the history
  2. Add parseCallData function

    fkrause98 committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    1fc184d View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2023

  1. Configuration menu
    Copy the full SHA
    174b160 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'main' of github.com:lambdaclass/zksync_era_precompiles …

    …into modexp_reimplementation
    ilitteri committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    92010d6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    776dc1d View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2023

  1. Configuration menu
    Copy the full SHA
    3c0f00c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1b8b2f6 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b775975 View commit details
    Browse the repository at this point in the history
  4. Free memory pointer (#169)

    * Add free memory pointer function
    
    * Update precompiles/Modexp.yul
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    * Update precompiles/Modexp.yul
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    fkrause98 and ilitteri authored Oct 10, 2023
    Configuration menu
    Copy the full SHA
    ebc92a8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    55ace22 View commit details
    Browse the repository at this point in the history
  6. Correctly parse call data

    fkrause98 committed Oct 10, 2023
    Configuration menu
    Copy the full SHA
    bfbcbae View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2023

  1. Configuration menu
    Copy the full SHA
    4fabd3c View commit details
    Browse the repository at this point in the history
  2. Add pad if needed function

    fkrause98 committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    1f51a9e View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2023

  1. Modexp for big UInts skeleton (#164)

    * WIP: modexp skeleton
    
    * Use of mul mod function for big integers
    
    * imlement aux function to check if big uint is larger than 1
    
    * minor fix
    
    * Restore modexp from target branch
    
    * Fix mul mod
    
    * Finish modexp implementation
    
    * Remove playground used for debugging
    
    * Update modexp with final state of modular exponentiation function
    
    * Fix merge issue
    
    * Change all names to camel case
    
    * fix typo
    
    Co-authored-by: Francisco Krause Arnim <56402156+fkrause98@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: IAvecilla <iavecilla@fi.uba.ar>
    Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
    Co-authored-by: Francisco Krause Arnim <56402156+fkrause98@users.noreply.github.com>
    4 people authored Oct 12, 2023
    Configuration menu
    Copy the full SHA
    730931e View commit details
    Browse the repository at this point in the history
  2. Add simple integration

    fkrause98 committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    54fe792 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2ecd8a3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    027ccfe View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    01f69aa View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b7da051 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    cbb07c4 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    41e541c View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Fix modexp result length

    IAvecilla committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    9f8dd97 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1152581 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    84fabdb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    938f5a6 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Remove unused functions

    IAvecilla committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    da8f686 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4f6f6ae View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    385fbf2 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2023

  1. Include basic optimizations

    IAvecilla committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    961c3aa View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2023

  1. Configuration menu
    Copy the full SHA
    633447a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cc40942 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2023

  1. Configuration menu
    Copy the full SHA
    4defc61 View commit details
    Browse the repository at this point in the history
  2. Add modex reference script

    fkrause98 committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    0e358ba View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    453747b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6f6424a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a7c12d0 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Working hardcoded example

    fkrause98 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    bf6a8e2 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Configuration menu
    Copy the full SHA
    6fc4dfd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c5754a9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    981e462 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2023

  1. Working with multiple limbs

    fkrause98 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    dccb796 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Configuration menu
    Copy the full SHA
    45af45a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9a3fb62 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7dd345a View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2023

  1. Configuration menu
    Copy the full SHA
    cef359b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e27a09c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    859435c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fdcd6c6 View commit details
    Browse the repository at this point in the history