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

Generate constraints in black box functions #74

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

Commits on Mar 17, 2023

  1. Update test programs

    Due to the new fixed bugs, new test programs could run properly using our backend
    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    f4c226e View commit details
    Browse the repository at this point in the history
  2. Remove test program

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    c34d2a0 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'main' of github.com:lambdaclass/noir_backend_using_gnar…

    …k into update_test_programs
    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    84168be View commit details
    Browse the repository at this point in the history
  4. Remove test program

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    db02fac View commit details
    Browse the repository at this point in the history
  5. Remove test program

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    5da78de View commit details
    Browse the repository at this point in the history
  6. Remove test program

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    0fe4cba View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a0fa660 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e52ea33 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    aa0fe58 View commit details
    Browse the repository at this point in the history
  10. Change types visibility

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    ce7aed3 View commit details
    Browse the repository at this point in the history
  11. handleBlackBoxFunctionOpcode

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    bef6ec9 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    1d17777 View commit details
    Browse the repository at this point in the history
  13. Reorder functions

    ilitteri committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    63d2dcf View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f094f24 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2023

  1. Handle some black box functions

    - AND
    - XOR
    - RANGE
    - SHA256
    - Blake2s
    - HashToField128Security
    - EcdsaSecp256k1
    ilitteri committed Mar 20, 2023
    Configuration menu
    Copy the full SHA
    b93b61d View commit details
    Browse the repository at this point in the history
  2. cargo fmt

    ilitteri committed Mar 20, 2023
    Configuration menu
    Copy the full SHA
    2996fa1 View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2023

  1. Configuration menu
    Copy the full SHA
    292f6d3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    89f2ce9 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    34a828b View commit details
    Browse the repository at this point in the history
  4. Fix Opcode's UnmarshalJSON

    ilitteri committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    0cfb20c View commit details
    Browse the repository at this point in the history
  5. Update components

    ilitteri committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    c55ccfc View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Configuration menu
    Copy the full SHA
    ff46497 View commit details
    Browse the repository at this point in the history

Commits on Mar 27, 2023

  1. assertIsBoolean component (#71)

    * Add first implementation of  gadget
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Add function to get the one wire's index
    
    * Fix function signature
    
    * Improve documentation
    
    * Add secret variables instead of internal ones for the intermediate variables
    
    * Return the mutated secret variables
    
    * Refactor a function (abstract it from the ACIR)
    
    * Add tests for `assertIsBoolean` component
    
    * Fix `assertIsBoolean` constraint component
    
    * Remove useless function
    
    * Update naming
    
    * Fix
    ilitteri authored Mar 27, 2023
    Configuration menu
    Copy the full SHA
    56f8e93 View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2023

  1. And component (#72)

    * Add first implementation of  gadget
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Add function to get the one wire's index
    
    * Fix function signature
    
    * Improve documentation
    
    * Add secret variables instead of internal ones for the intermediate variables
    
    * Return the mutated secret variables
    
    * Refactor a function (abstract it from the ACIR)
    
    * Add tests for `assertIsBoolean` component
    
    * Add tests for bit and component
    
    * Add bit and component
    
    * Add multiple-bit and component
    
    * Update result's secret variable name
    
    * Fix `assertIsBoolean` constraint component
    
    * Remove useless function
    
    * Update naming
    
    * Fix
    
    * Add `assertIsEqual` component
    
    * Refactor repeated code in tests
    
    * Add `assertIsEqual` component tests
    
    * Implement `add` `mul` & `assertIsEqual` components
    
    * Fix `toBinaryConversion` component
    
    * Update secret variables naming
    
    * Add `toBinaryConversion` tests
    
    * Remove print
    
    * Add missing boolean assertion when converting to binary
    
    * Improve variable labels
    
    * Fix `toBinaryConversion`
    
    * Flag to generate constraint over `and` inputs
    
    * Update `And`
    
    * Shift coefficient after every iteration
    
    * Implement `fromBinaryConversion` component
    
    * Update tests naming
    
    * Finish `And` implementation
    
    * Update `accumulator` label name
    
    * Remove needless boolean assertion
    
    It is asserted above
    
    * Document components
    
    * Cleanup components
    
    * Rename module
    
    * Doc `assertIsEqual`
    ilitteri authored Mar 30, 2023
    Configuration menu
    Copy the full SHA
    a100932 View commit details
    Browse the repository at this point in the history
  2. Xor component (#73)

    * Add first implementation of  gadget
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Add function to get the one wire's index
    
    * Fix function signature
    
    * Improve documentation
    
    * Add secret variables instead of internal ones for the intermediate variables
    
    * Return the mutated secret variables
    
    * Refactor a function (abstract it from the ACIR)
    
    * Add tests for `assertIsBoolean` component
    
    * Add tests for bit and component
    
    * Add bit and component
    
    * Add multiple-bit and component
    
    * Update result's secret variable name
    
    * Add xor component implementation
    
    Both for bit-to-bit and multiple bits
    
    * Fix append
    
    * Add tests for single bit xor
    
    * Fix `assertIsBoolean` constraint component
    
    * Remove useless function
    
    * Update naming
    
    * Fix
    
    * Add `assertIsEqual` component
    
    * Refactor repeated code in tests
    
    * Add `assertIsEqual` component tests
    
    * Implement `add` `mul` & `assertIsEqual` components
    
    * Fix `toBinaryConversion` component
    
    * Update secret variables naming
    
    * Add `toBinaryConversion` tests
    
    * Remove print
    
    * Add missing boolean assertion when converting to binary
    
    * Improve variable labels
    
    * Fix `toBinaryConversion`
    
    * Flag to generate constraint over `and` inputs
    
    * Update `And`
    
    * Shift coefficient after every iteration
    
    * Implement `fromBinaryConversion` component
    
    * Update tests naming
    
    * Finish `And` implementation
    
    * Update `accumulator` label name
    
    * Remove needless boolean assertion
    
    It is asserted above
    
    * Document components
    
    * Cleanup components
    
    * Rename module
    
    * Doc `assertIsEqual`
    
    * Finish `Xor` & `xor` components implementations
    
    * Update doc
    ilitteri authored Mar 30, 2023
    Configuration menu
    Copy the full SHA
    69ccd6f View commit details
    Browse the repository at this point in the history
  3. Integrate AND and XOR black box functions (#75)

    * Add first implementation of  gadget
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Update gnark_backend_ffi/backend/plonk/components.go
    
    * Add function to get the one wire's index
    
    * Fix function signature
    
    * Improve documentation
    
    * Add secret variables instead of internal ones for the intermediate variables
    
    * Return the mutated secret variables
    
    * Refactor a function (abstract it from the ACIR)
    
    * Add tests for `assertIsBoolean` component
    
    * Add tests for bit and component
    
    * Add bit and component
    
    * Add multiple-bit and component
    
    * Update result's secret variable name
    
    * Add xor component implementation
    
    Both for bit-to-bit and multiple bits
    
    * Fix append
    
    * Add tests for single bit xor
    
    * Fix `assertIsBoolean` constraint component
    
    * Remove useless function
    
    * Update naming
    
    * Fix
    
    * Add `assertIsEqual` component
    
    * Refactor repeated code in tests
    
    * Add `assertIsEqual` component tests
    
    * Implement `add` `mul` & `assertIsEqual` components
    
    * Fix `toBinaryConversion` component
    
    * Update secret variables naming
    
    * Add `toBinaryConversion` tests
    
    * Remove print
    
    * Add missing boolean assertion when converting to binary
    
    * Improve variable labels
    
    * Fix `toBinaryConversion`
    
    * Flag to generate constraint over `and` inputs
    
    * Update `And`
    
    * Shift coefficient after every iteration
    
    * Implement `fromBinaryConversion` component
    
    * Update tests naming
    
    * Finish `And` implementation
    
    * Update `accumulator` label name
    
    * Remove needless boolean assertion
    
    It is asserted above
    
    * Document components
    
    * Cleanup components
    
    * Rename module
    
    * Doc `assertIsEqual`
    
    * Finish `Xor` & `xor` components implementations
    
    * Update doc
    
    * Update variable usage
    
    In the previous iteration, only secret variables were assumed to be the only ones used for the component. In reality, both secret and public variables could be used with components. Given that in components, the intermediate variables are treated as secret, then we must track them, but we also need to use the full variables vector (public+secret in order).
    
    This is just another iteration, it seems that having some mutable Context data structure would clean the code a lot, because it is really messy as it is and the user must take care of updating the secret, and the full variables vectors.
    
    * `HandleValues` returns a full variables vector too
    
    Public + secret in order
    
    * Both `handleOpcodes`and `handleBlackBoxFunctionOpcode` must now return the added secret variables (that are the internal ones).
    
    If we manage to handle these internal variables as internal and not as secret, this would be useless.
    
    * First iteration of integrating AND & XOR opcodes
    
    On this iteration we do not handle the `variablesMap` and we do not compare the incoming output with the computed one.
    
    * Bring back Go tests
    
    At the moment we're just running Plonk's components tests because the ACIR's are to be fixed
    
    * Update package name
    
    * Sort imports
    
    * Update imports
    
    * Add missing function
    
    * `Context` refactor (#76)
    
    * Add `Context`
    
    * Handle `Context` in components
    
    * Update tests
    
    * Comment out `go` job until fixed
    
    * Temporarily fix integration
    
    For some reason, having a third level module (`components`) makes the `cc` crate not to compile when building `nargo`. It seems that the module is not being found.
    ilitteri authored Mar 30, 2023
    Configuration menu
    Copy the full SHA
    0c97afe View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2023

  1. assertIsInRange component (#79)

    * `Select` component (#78)
    
    * `Sub` component (#77)
    
    * Add `sub` component (subtraction)
    
    * Update test
    
    * Add `Select` component (if condition)
    
    * Add components to `components.go`
    
    * Add `assertIsInRange` component
    
    * Handle `Range` black box function
    ilitteri authored Mar 31, 2023
    Configuration menu
    Copy the full SHA
    d91495c View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Merge branch 'main' of github.com:lambdaclass/noir_backend_using_gnar…

    …k into generate_constraints_in_black_box_functions
    ilitteri committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    15fb7d4 View commit details
    Browse the repository at this point in the history
  2. Fix merge error

    ilitteri committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    7aeec13 View commit details
    Browse the repository at this point in the history
  3. Fix merge error

    ilitteri committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    0aabeb0 View commit details
    Browse the repository at this point in the history