-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into alexg/feat/noir-wasm
- Loading branch information
Showing
220 changed files
with
13,655 additions
and
1,541 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
".": "0.11.1", | ||
"barretenberg": "0.11.1", | ||
"barretenberg/ts": "0.11.1" | ||
".": "0.12.0", | ||
"barretenberg": "0.12.0", | ||
"barretenberg/ts": "0.12.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.11.1 x-release-please-version | ||
v0.12.0 x-release-please-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.11.1 x-release-please-version | ||
v0.12.0 x-release-please-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 6 additions & 37 deletions
43
barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind_new.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,18 @@ | ||
#include "c_bind_new.hpp" | ||
#include "../pedersen_hash/pedersen.hpp" | ||
#include "barretenberg/common/serialize.hpp" | ||
#include "c_bind.hpp" | ||
#include "pedersen.hpp" | ||
|
||
extern "C" { | ||
|
||
using namespace barretenberg; | ||
|
||
WASM_EXPORT void pedersen___init() {} | ||
|
||
WASM_EXPORT void pedersen___compress_fields(fr::in_buf left, fr::in_buf right, fr::out_buf result) | ||
{ | ||
auto lhs = barretenberg::fr::serialize_from_buffer(left); | ||
auto rhs = barretenberg::fr::serialize_from_buffer(right); | ||
auto r = crypto::pedersen_hash::hash({ lhs, rhs }); | ||
barretenberg::fr::serialize_to_buffer(r, result); | ||
} | ||
|
||
WASM_EXPORT void pedersen___compress(fr::vec_in_buf inputs_buffer, fr::out_buf output) | ||
{ | ||
std::vector<grumpkin::fq> to_compress; | ||
read(inputs_buffer, to_compress); | ||
auto r = crypto::pedersen_hash::hash(to_compress); | ||
barretenberg::fr::serialize_to_buffer(r, output); | ||
} | ||
|
||
WASM_EXPORT void pedersen___compress_with_hash_index(fr::vec_in_buf inputs_buffer, | ||
uint32_t const* hash_index, | ||
fr::out_buf output) | ||
{ | ||
std::vector<grumpkin::fq> to_compress; | ||
read(inputs_buffer, to_compress); | ||
const size_t generator_offset = ntohl(*hash_index); | ||
crypto::GeneratorContext<curve::Grumpkin> ctx; // todo fix | ||
ctx.offset = generator_offset; | ||
auto r = crypto::pedersen_hash::hash(to_compress, ctx); | ||
barretenberg::fr::serialize_to_buffer(r, output); | ||
} | ||
|
||
WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, fr::out_buf output) | ||
WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, affine_element::out_buf output) | ||
{ | ||
std::vector<grumpkin::fq> to_compress; | ||
read(inputs_buffer, to_compress); | ||
grumpkin::g1::affine_element pedersen_hash = crypto::pedersen_commitment::commit_native(to_compress); | ||
std::vector<grumpkin::fq> to_commit; | ||
read(inputs_buffer, to_commit); | ||
grumpkin::g1::affine_element pedersen_commitment = crypto::pedersen_commitment::commit_native(to_commit); | ||
|
||
serialize::write(output, pedersen_hash); | ||
serialize::write(output, pedersen_commitment); | ||
} | ||
} |
14 changes: 3 additions & 11 deletions
14
barretenberg/cpp/src/barretenberg/crypto/pedersen_commitment/c_bind_new.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,12 @@ | ||
#pragma once | ||
#include "barretenberg/common/wasm_export.hpp" | ||
#include "barretenberg/ecc/curves/bn254/fr.hpp" | ||
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" | ||
|
||
extern "C" { | ||
|
||
using namespace barretenberg; | ||
using affine_element = grumpkin::g1::affine_element; | ||
|
||
WASM_EXPORT void pedersen___init(); | ||
|
||
WASM_EXPORT void pedersen___compress_fields(fr::in_buf left, fr::in_buf right, fr::out_buf result); | ||
|
||
WASM_EXPORT void pedersen___compress(fr::vec_in_buf inputs_buffer, fr::out_buf output); | ||
|
||
WASM_EXPORT void pedersen___compress_with_hash_index(fr::vec_in_buf inputs_buffer, | ||
uint32_t const* hash_index, | ||
fr::out_buf output); | ||
|
||
WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, fr::out_buf output); | ||
WASM_EXPORT void pedersen___commit(fr::vec_in_buf inputs_buffer, affine_element::out_buf output); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.