Skip to content

Commit

Permalink
chore!: update codegened ACIR deserializers
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Oct 3, 2023
1 parent e5c360d commit 56af2dc
Showing 1 changed file with 33 additions and 37 deletions.
70 changes: 33 additions & 37 deletions acvm-repo/acir/codegen/acir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,43 +674,9 @@ namespace Circuit {
static BrilligOutputs bincodeDeserialize(std::vector<uint8_t>);
};

struct ForeignCallParam {

struct Single {
Circuit::Value value;

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

struct Array {
std::vector<Circuit::Value> value;

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

std::variant<Single, Array> value;

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

struct ForeignCallResult {
std::vector<Circuit::ForeignCallParam> values;

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

struct Brillig {
std::vector<Circuit::BrilligInputs> inputs;
std::vector<Circuit::BrilligOutputs> outputs;
std::vector<Circuit::ForeignCallResult> foreign_call_results;
std::vector<Circuit::BrilligOpcode> bytecode;
std::optional<Circuit::Expression> predicate;

Expand Down Expand Up @@ -886,6 +852,39 @@ namespace Circuit {
static Circuit bincodeDeserialize(std::vector<uint8_t>);
};

struct ForeignCallParam {

struct Single {
Circuit::Value value;

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

struct Array {
std::vector<Circuit::Value> value;

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

std::variant<Single, Array> value;

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

struct ForeignCallResult {
std::vector<Circuit::ForeignCallParam> values;

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

} // end of namespace Circuit


Expand Down Expand Up @@ -2761,7 +2760,6 @@ namespace Circuit {
inline bool operator==(const Brillig &lhs, const Brillig &rhs) {
if (!(lhs.inputs == rhs.inputs)) { return false; }
if (!(lhs.outputs == rhs.outputs)) { return false; }
if (!(lhs.foreign_call_results == rhs.foreign_call_results)) { return false; }
if (!(lhs.bytecode == rhs.bytecode)) { return false; }
if (!(lhs.predicate == rhs.predicate)) { return false; }
return true;
Expand Down Expand Up @@ -2790,7 +2788,6 @@ void serde::Serializable<Circuit::Brillig>::serialize(const Circuit::Brillig &ob
serializer.increase_container_depth();
serde::Serializable<decltype(obj.inputs)>::serialize(obj.inputs, serializer);
serde::Serializable<decltype(obj.outputs)>::serialize(obj.outputs, serializer);
serde::Serializable<decltype(obj.foreign_call_results)>::serialize(obj.foreign_call_results, serializer);
serde::Serializable<decltype(obj.bytecode)>::serialize(obj.bytecode, serializer);
serde::Serializable<decltype(obj.predicate)>::serialize(obj.predicate, serializer);
serializer.decrease_container_depth();
Expand All @@ -2803,7 +2800,6 @@ Circuit::Brillig serde::Deserializable<Circuit::Brillig>::deserialize(Deserializ
Circuit::Brillig obj;
obj.inputs = serde::Deserializable<decltype(obj.inputs)>::deserialize(deserializer);
obj.outputs = serde::Deserializable<decltype(obj.outputs)>::deserialize(deserializer);
obj.foreign_call_results = serde::Deserializable<decltype(obj.foreign_call_results)>::deserialize(deserializer);
obj.bytecode = serde::Deserializable<decltype(obj.bytecode)>::deserialize(deserializer);
obj.predicate = serde::Deserializable<decltype(obj.predicate)>::deserialize(deserializer);
deserializer.decrease_container_depth();
Expand Down

0 comments on commit 56af2dc

Please sign in to comment.