Skip to content

Commit

Permalink
Merge branch 'master' into tf/remove-aztec-u128
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Jan 15, 2024
2 parents 4f22413 + 2321963 commit a0abbde
Show file tree
Hide file tree
Showing 27 changed files with 210 additions and 423 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/mirror_noir_subrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
pr_title: 'feat: aztec-packages'
pr_body: 'Development from Aztec.'
pr_title: 'feat: Sync commits from `aztec-packages`'
pr_body: 'Development from [aztec-packages](https://github.com/AztecProtocol/aztec-packages).'
destination_branch: 'master'
source_branch: 'aztec-packages'
139 changes: 1 addition & 138 deletions barretenberg/cpp/src/barretenberg/dsl/acir_format/serde/acir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,28 +813,8 @@ struct Brillig {
static Brillig bincodeDeserialize(std::vector<uint8_t>);
};

struct QuotientDirective {
Circuit::Expression a;
Circuit::Expression b;
Circuit::Witness q;
Circuit::Witness r;
std::optional<Circuit::Expression> predicate;

friend bool operator==(const QuotientDirective&, const QuotientDirective&);
std::vector<uint8_t> bincodeSerialize() const;
static QuotientDirective bincodeDeserialize(std::vector<uint8_t>);
};

struct Directive {

struct Quotient {
Circuit::QuotientDirective value;

friend bool operator==(const Quotient&, const Quotient&);
std::vector<uint8_t> bincodeSerialize() const;
static Quotient bincodeDeserialize(std::vector<uint8_t>);
};

struct ToLeRadix {
Circuit::Expression a;
std::vector<Circuit::Witness> b;
Expand All @@ -856,7 +836,7 @@ struct Directive {
static PermutationSort bincodeDeserialize(std::vector<uint8_t>);
};

std::variant<Quotient, ToLeRadix, PermutationSort> value;
std::variant<ToLeRadix, PermutationSort> value;

friend bool operator==(const Directive&, const Directive&);
std::vector<uint8_t> bincodeSerialize() const;
Expand Down Expand Up @@ -5038,53 +5018,6 @@ Circuit::Directive serde::Deserializable<Circuit::Directive>::deserialize(Deseri

namespace Circuit {

inline bool operator==(const Directive::Quotient& lhs, const Directive::Quotient& rhs)
{
if (!(lhs.value == rhs.value)) {
return false;
}
return true;
}

inline std::vector<uint8_t> Directive::Quotient::bincodeSerialize() const
{
auto serializer = serde::BincodeSerializer();
serde::Serializable<Directive::Quotient>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline Directive::Quotient Directive::Quotient::bincodeDeserialize(std::vector<uint8_t> input)
{
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<Directive::Quotient>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw_or_abort("Some input bytes were not read");
}
return value;
}

} // end of namespace Circuit

template <>
template <typename Serializer>
void serde::Serializable<Circuit::Directive::Quotient>::serialize(const Circuit::Directive::Quotient& obj,
Serializer& serializer)
{
serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
}

template <>
template <typename Deserializer>
Circuit::Directive::Quotient serde::Deserializable<Circuit::Directive::Quotient>::deserialize(
Deserializer& deserializer)
{
Circuit::Directive::Quotient obj;
obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
return obj;
}

namespace Circuit {

inline bool operator==(const Directive::ToLeRadix& lhs, const Directive::ToLeRadix& rhs)
{
if (!(lhs.a == rhs.a)) {
Expand Down Expand Up @@ -6022,76 +5955,6 @@ Circuit::PublicInputs serde::Deserializable<Circuit::PublicInputs>::deserialize(

namespace Circuit {

inline bool operator==(const QuotientDirective& lhs, const QuotientDirective& rhs)
{
if (!(lhs.a == rhs.a)) {
return false;
}
if (!(lhs.b == rhs.b)) {
return false;
}
if (!(lhs.q == rhs.q)) {
return false;
}
if (!(lhs.r == rhs.r)) {
return false;
}
if (!(lhs.predicate == rhs.predicate)) {
return false;
}
return true;
}

inline std::vector<uint8_t> QuotientDirective::bincodeSerialize() const
{
auto serializer = serde::BincodeSerializer();
serde::Serializable<QuotientDirective>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline QuotientDirective QuotientDirective::bincodeDeserialize(std::vector<uint8_t> input)
{
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<QuotientDirective>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw_or_abort("Some input bytes were not read");
}
return value;
}

} // end of namespace Circuit

template <>
template <typename Serializer>
void serde::Serializable<Circuit::QuotientDirective>::serialize(const Circuit::QuotientDirective& obj,
Serializer& serializer)
{
serializer.increase_container_depth();
serde::Serializable<decltype(obj.a)>::serialize(obj.a, serializer);
serde::Serializable<decltype(obj.b)>::serialize(obj.b, serializer);
serde::Serializable<decltype(obj.q)>::serialize(obj.q, serializer);
serde::Serializable<decltype(obj.r)>::serialize(obj.r, serializer);
serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
serializer.decrease_container_depth();
}

template <>
template <typename Deserializer>
Circuit::QuotientDirective serde::Deserializable<Circuit::QuotientDirective>::deserialize(Deserializer& deserializer)
{
deserializer.increase_container_depth();
Circuit::QuotientDirective obj;
obj.a = serde::Deserializable<decltype(obj.a)>::deserialize(deserializer);
obj.b = serde::Deserializable<decltype(obj.b)>::deserialize(deserializer);
obj.q = serde::Deserializable<decltype(obj.q)>::deserialize(deserializer);
obj.r = serde::Deserializable<decltype(obj.r)>::deserialize(deserializer);
obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
deserializer.decrease_container_depth();
return obj;
}

namespace Circuit {

inline bool operator==(const RegisterIndex& lhs, const RegisterIndex& rhs)
{
if (!(lhs.value == rhs.value)) {
Expand Down
4 changes: 2 additions & 2 deletions noir/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/noir-lang/noir
branch = aztec-packages
commit = 7f22446f3940f8ef7ccae785a4b29835f2e869fe
parent = fd1f619f443916c172b6311aa71a84153145ef4d
commit = 2d921081ad535bc2005ce8aa78b60772431c299d
parent = 34f6508bf5e7d9635ada4954c4ed2f93f9ac0d77
method = merge
cmdver = 0.4.6
1 change: 0 additions & 1 deletion noir/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 1 addition & 113 deletions noir/acvm-repo/acir/codegen/acir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,28 +765,8 @@ namespace Circuit {
static Brillig bincodeDeserialize(std::vector<uint8_t>);
};

struct QuotientDirective {
Circuit::Expression a;
Circuit::Expression b;
Circuit::Witness q;
Circuit::Witness r;
std::optional<Circuit::Expression> predicate;

friend bool operator==(const QuotientDirective&, const QuotientDirective&);
std::vector<uint8_t> bincodeSerialize() const;
static QuotientDirective bincodeDeserialize(std::vector<uint8_t>);
};

struct Directive {

struct Quotient {
Circuit::QuotientDirective value;

friend bool operator==(const Quotient&, const Quotient&);
std::vector<uint8_t> bincodeSerialize() const;
static Quotient bincodeDeserialize(std::vector<uint8_t>);
};

struct ToLeRadix {
Circuit::Expression a;
std::vector<Circuit::Witness> b;
Expand All @@ -808,7 +788,7 @@ namespace Circuit {
static PermutationSort bincodeDeserialize(std::vector<uint8_t>);
};

std::variant<Quotient, ToLeRadix, PermutationSort> value;
std::variant<ToLeRadix, PermutationSort> value;

friend bool operator==(const Directive&, const Directive&);
std::vector<uint8_t> bincodeSerialize() const;
Expand Down Expand Up @@ -4188,44 +4168,6 @@ Circuit::Directive serde::Deserializable<Circuit::Directive>::deserialize(Deseri
return obj;
}

namespace Circuit {

inline bool operator==(const Directive::Quotient &lhs, const Directive::Quotient &rhs) {
if (!(lhs.value == rhs.value)) { return false; }
return true;
}

inline std::vector<uint8_t> Directive::Quotient::bincodeSerialize() const {
auto serializer = serde::BincodeSerializer();
serde::Serializable<Directive::Quotient>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline Directive::Quotient Directive::Quotient::bincodeDeserialize(std::vector<uint8_t> input) {
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<Directive::Quotient>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw serde::deserialization_error("Some input bytes were not read");
}
return value;
}

} // end of namespace Circuit

template <>
template <typename Serializer>
void serde::Serializable<Circuit::Directive::Quotient>::serialize(const Circuit::Directive::Quotient &obj, Serializer &serializer) {
serde::Serializable<decltype(obj.value)>::serialize(obj.value, serializer);
}

template <>
template <typename Deserializer>
Circuit::Directive::Quotient serde::Deserializable<Circuit::Directive::Quotient>::deserialize(Deserializer &deserializer) {
Circuit::Directive::Quotient obj;
obj.value = serde::Deserializable<decltype(obj.value)>::deserialize(deserializer);
return obj;
}

namespace Circuit {

inline bool operator==(const Directive::ToLeRadix &lhs, const Directive::ToLeRadix &rhs) {
Expand Down Expand Up @@ -4990,60 +4932,6 @@ Circuit::PublicInputs serde::Deserializable<Circuit::PublicInputs>::deserialize(
return obj;
}

namespace Circuit {

inline bool operator==(const QuotientDirective &lhs, const QuotientDirective &rhs) {
if (!(lhs.a == rhs.a)) { return false; }
if (!(lhs.b == rhs.b)) { return false; }
if (!(lhs.q == rhs.q)) { return false; }
if (!(lhs.r == rhs.r)) { return false; }
if (!(lhs.predicate == rhs.predicate)) { return false; }
return true;
}

inline std::vector<uint8_t> QuotientDirective::bincodeSerialize() const {
auto serializer = serde::BincodeSerializer();
serde::Serializable<QuotientDirective>::serialize(*this, serializer);
return std::move(serializer).bytes();
}

inline QuotientDirective QuotientDirective::bincodeDeserialize(std::vector<uint8_t> input) {
auto deserializer = serde::BincodeDeserializer(input);
auto value = serde::Deserializable<QuotientDirective>::deserialize(deserializer);
if (deserializer.get_buffer_offset() < input.size()) {
throw serde::deserialization_error("Some input bytes were not read");
}
return value;
}

} // end of namespace Circuit

template <>
template <typename Serializer>
void serde::Serializable<Circuit::QuotientDirective>::serialize(const Circuit::QuotientDirective &obj, Serializer &serializer) {
serializer.increase_container_depth();
serde::Serializable<decltype(obj.a)>::serialize(obj.a, serializer);
serde::Serializable<decltype(obj.b)>::serialize(obj.b, serializer);
serde::Serializable<decltype(obj.q)>::serialize(obj.q, serializer);
serde::Serializable<decltype(obj.r)>::serialize(obj.r, serializer);
serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
serializer.decrease_container_depth();
}

template <>
template <typename Deserializer>
Circuit::QuotientDirective serde::Deserializable<Circuit::QuotientDirective>::deserialize(Deserializer &deserializer) {
deserializer.increase_container_depth();
Circuit::QuotientDirective obj;
obj.a = serde::Deserializable<decltype(obj.a)>::deserialize(deserializer);
obj.b = serde::Deserializable<decltype(obj.b)>::deserialize(deserializer);
obj.q = serde::Deserializable<decltype(obj.q)>::deserialize(deserializer);
obj.r = serde::Deserializable<decltype(obj.r)>::deserialize(deserializer);
obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
deserializer.decrease_container_depth();
return obj;
}

namespace Circuit {

inline bool operator==(const RegisterIndex &lhs, const RegisterIndex &rhs) {
Expand Down
12 changes: 0 additions & 12 deletions noir/acvm-repo/acir/src/circuit/directives.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
use crate::native_types::{Expression, Witness};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct QuotientDirective {
pub a: Expression,
pub b: Expression,
pub q: Witness,
pub r: Witness,
pub predicate: Option<Expression>,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
/// Directives do not apply any constraints.
/// You can think of them as opcodes that allow one to use non-determinism
/// In the future, this can be replaced with asm non-determinism blocks
pub enum Directive {
//Performs euclidean division of a / b (as integers) and stores the quotient in q and the rest in r
Quotient(QuotientDirective),

//decomposition of a: a=\sum b[i]*radix^i where b is an array of witnesses < radix in little endian form
ToLeRadix {
a: Expression,
Expand Down
19 changes: 1 addition & 18 deletions noir/acvm-repo/acir/src/circuit/opcodes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use super::{
brillig::Brillig,
directives::{Directive, QuotientDirective},
};
use super::{brillig::Brillig, directives::Directive};
use crate::native_types::{Expression, Witness};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -48,21 +45,7 @@ impl std::fmt::Display for Opcode {

write!(f, " ]")
}
Opcode::Directive(Directive::Quotient(QuotientDirective { a, b, q, r, predicate })) => {
write!(f, "DIR::QUOTIENT ")?;
if let Some(pred) = predicate {
writeln!(f, "PREDICATE = {pred}")?;
}

write!(
f,
"(out : _{}, (_{}, {}), _{})",
a,
q.witness_index(),
b,
r.witness_index()
)
}
Opcode::BlackBoxFuncCall(g) => write!(f, "{g}"),
Opcode::Directive(Directive::ToLeRadix { a, b, radix: _ }) => {
write!(f, "DIR::TORADIX ")?;
Expand Down
Loading

0 comments on commit a0abbde

Please sign in to comment.