Skip to content

Commit

Permalink
feat: refactor pedersen hash standard (#2592)
Browse files Browse the repository at this point in the history
This PR is a follow up to #1945 and our Pedersen hash refactor project
https://hackmd.io/XYBiWhHPT9C1bo4nrtoo0A?view

The PR updates all existing usage of Pedersen commitments and Pedersen
hashes to use the new, more straightforward definition in the hackmd and
implemented in #1945

This requires wide changes to the codebase as the barretenberg interface
used for the Pedersen hash has changed.

The large static generator lists that were computed for every
barretenberg process have been removed, and replaced with a streamlined
generator_data class

All uses of `pedersen::compress` have been removed and replaced with
`pedersen::hash`

We should no longer ever take the x-coordinate of `pedersen::commit`
outside of pedersen::hash`.

The Schnorr signature stdlib method now uses `cycle_group` instead of
its own independent scalar multiplication method

The ACIR fixed-base scalar mul opcode now actually evaluates a
fixed-base scalar mul

All of the code that implemented the old Pedersen functionality has been
deleted

The stdlib class `point` has been deleted. All code instances that used
`point` now use `cycle_group` (don't want two independent types in the
stdlib that both represent embedded elliptic curve points)

---------

Co-authored-by: Charlie Lye <[email protected]>
Co-authored-by: kevaundray <[email protected]>
Co-authored-by: Leila Wang <[email protected]>
Co-authored-by: sirasistant <[email protected]>
Co-authored-by: ludamad <[email protected]>
  • Loading branch information
6 people authored Oct 24, 2023
1 parent 51efbce commit 3085676
Show file tree
Hide file tree
Showing 224 changed files with 2,520 additions and 6,909 deletions.
4 changes: 2 additions & 2 deletions barretenberg/acir_tests/run_acir_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -eu
BIN=${BIN:-../cpp/build/bin/bb}
FLOW=${FLOW:-prove_and_verify}
CRS_PATH=~/.bb-crs
BRANCH="master"
BRANCH=kw/mv/new-pedersen
VERBOSE=${VERBOSE:-}
NAMED_TEST=${1:-}

Expand Down Expand Up @@ -41,7 +41,7 @@ fi
cd acir_tests

# Convert them to array
SKIP_ARRAY=(diamond_deps_0 workspace workspace_default_member)
SKIP_ARRAY=(diamond_deps_0 workspace workspace_default_member merkle_insert simple_shield pedersen_check schnorr)

function test() {
cd $1
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/scripts/bb-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ TESTS=(
crypto_blake2s_tests
crypto_blake3s_tests
crypto_ecdsa_tests
crypto_pedersen_commitment_tests
crypto_schnorr_tests
crypto_sha256_tests
ecc_tests
Expand Down
3 changes: 0 additions & 3 deletions barretenberg/cpp/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ add_library(
$<TARGET_OBJECTS:crypto_blake2s_objects>
$<TARGET_OBJECTS:crypto_blake3s_objects>
$<TARGET_OBJECTS:crypto_ecdsa_objects>
$<TARGET_OBJECTS:crypto_generators_objects>
$<TARGET_OBJECTS:crypto_keccak_objects>
$<TARGET_OBJECTS:crypto_pedersen_commitment_objects>
$<TARGET_OBJECTS:crypto_pedersen_hash_objects>
Expand Down Expand Up @@ -142,7 +141,6 @@ if(WASM)
$<TARGET_OBJECTS:crypto_blake2s_objects>
$<TARGET_OBJECTS:crypto_blake3s_objects>
$<TARGET_OBJECTS:crypto_ecdsa_objects>
$<TARGET_OBJECTS:crypto_generators_objects>
$<TARGET_OBJECTS:crypto_keccak_objects>
$<TARGET_OBJECTS:crypto_pedersen_commitment_objects>
$<TARGET_OBJECTS:crypto_pedersen_hash_objects>
Expand Down Expand Up @@ -178,7 +176,6 @@ if(WASM)
$<TARGET_OBJECTS:ecc_objects>
$<TARGET_OBJECTS:crypto_blake2s_objects>
$<TARGET_OBJECTS:crypto_keccak_objects>
$<TARGET_OBJECTS:crypto_generators_objects>
$<TARGET_OBJECTS:crypto_schnorr_objects>
$<TARGET_OBJECTS:crypto_pedersen_hash_objects>
$<TARGET_OBJECTS:crypto_pedersen_commitment_objects>
Expand Down
4 changes: 1 addition & 3 deletions barretenberg/cpp/src/barretenberg/barretenberg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "serialize/test_helper.hpp"
#include "srs/global_crs.hpp"
#include "stdlib/commitment/pedersen/pedersen.hpp"
#include "stdlib/commitment/pedersen/pedersen_plookup.hpp"
#include "stdlib/encryption/ecdsa/ecdsa.hpp"
#include "stdlib/encryption/schnorr/schnorr.hpp"
#include "stdlib/hash/blake2s/blake2s.hpp"
Expand All @@ -60,9 +59,8 @@
#include "stdlib/primitives/curves/bn254.hpp"
#include "stdlib/primitives/field/array.hpp"
#include "stdlib/primitives/field/field.hpp"
#include "stdlib/primitives/group/group.hpp"
#include "stdlib/primitives/group/cycle_group.hpp"
#include "stdlib/primitives/packed_byte_array/packed_byte_array.hpp"
#include "stdlib/primitives/point/point.hpp"
#include "stdlib/primitives/uint/uint.hpp"
#include "stdlib/primitives/witness/witness.hpp"
#include "stdlib/recursion/aggregation_state/aggregation_state.hpp"
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/src/barretenberg/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
add_subdirectory(hmac)
add_subdirectory(generators)
add_subdirectory(blake2s)
add_subdirectory(blake3s)
add_subdirectory(blake3s_full)
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3085676

Please sign in to comment.