forked from visoftsolutions/noir_rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ACIR opcodes for ECADD and ECDOUBLE (AztecProtocol#3878)
Please provide a paragraph or two giving a summary of the change, including relevant motivation and context. Related to noir-lang/noir#3958 This PR does not implements the opcodes, but modifies BB interface so that it accept the new opcodes. It also does not implement the solver for the opcodes. # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [X] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [X] Every change is related to the PR description. - [X] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist). --------- Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
7353a35
commit 537630f
Showing
26 changed files
with
872 additions
and
7 deletions.
There are no files selected for viewing
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
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
31 changes: 31 additions & 0 deletions
31
barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "ec_operations.hpp" | ||
#include "barretenberg/dsl/types.hpp" | ||
#include "barretenberg/ecc/curves/bn254/fr.hpp" | ||
#include "barretenberg/ecc/curves/grumpkin/grumpkin.hpp" | ||
#include "barretenberg/proof_system/arithmetization/gate_data.hpp" | ||
|
||
namespace acir_format { | ||
|
||
template <typename Builder> void create_ec_add_constraint(Builder& builder, const EcAdd& input) | ||
{ | ||
// TODO | ||
builder.assert_equal(input.input1_x, input.input1_x); | ||
ASSERT(false); | ||
} | ||
|
||
template void create_ec_add_constraint<UltraCircuitBuilder>(UltraCircuitBuilder& builder, const EcAdd& input); | ||
template void create_ec_add_constraint<GoblinUltraCircuitBuilder>(GoblinUltraCircuitBuilder& builder, | ||
const EcAdd& input); | ||
|
||
template <typename Builder> void create_ec_double_constraint(Builder& builder, const EcDouble& input) | ||
{ | ||
// TODO | ||
builder.assert_equal(input.input_x, input.input_x); | ||
ASSERT(false); | ||
} | ||
|
||
template void create_ec_double_constraint<UltraCircuitBuilder>(UltraCircuitBuilder& builder, const EcDouble& input); | ||
template void create_ec_double_constraint<GoblinUltraCircuitBuilder>(GoblinUltraCircuitBuilder& builder, | ||
const EcDouble& input); | ||
|
||
} // namespace acir_format |
35 changes: 35 additions & 0 deletions
35
barretenberg/cpp/src/barretenberg/dsl/acir_format/ec_operations.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
#include "barretenberg/dsl/types.hpp" | ||
#include "barretenberg/serialize/msgpack.hpp" | ||
#include <cstdint> | ||
|
||
namespace acir_format { | ||
|
||
struct EcAdd { | ||
uint32_t input1_x; | ||
uint32_t input1_y; | ||
uint32_t input2_x; | ||
uint32_t input2_y; | ||
uint32_t result_x; | ||
uint32_t result_y; | ||
|
||
// for serialization, update with any new fields | ||
MSGPACK_FIELDS(input1_x, input1_y, input2_x, input2_y, result_x, result_y); | ||
friend bool operator==(EcAdd const& lhs, EcAdd const& rhs) = default; | ||
}; | ||
|
||
template <typename Builder> void create_ec_add_constraint(Builder& builder, const EcAdd& input); | ||
|
||
struct EcDouble { | ||
uint32_t input_x; | ||
uint32_t input_y; | ||
uint32_t result_x; | ||
uint32_t result_y; | ||
|
||
// for serialization, update with any new fields | ||
MSGPACK_FIELDS(input_x, input_y, result_x, result_y); | ||
friend bool operator==(EcDouble const& lhs, EcDouble const& rhs) = default; | ||
}; | ||
|
||
template <typename Builder> void create_ec_double_constraint(Builder& builder, const EcDouble& input); | ||
} // namespace acir_format |
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
Oops, something went wrong.