Skip to content

Commit

Permalink
Fix serialization native agg state (#283) (#284)
Browse files Browse the repository at this point in the history
* Fix native agg state serialization and proof output

Fixes serialization tests on aztec circuits.

* Fix duplicated operator error

* Remove unused import

* Add missing includes

Co-authored-by: Santiago Palladino <[email protected]>
  • Loading branch information
Maddiaa0 and spalladino authored Mar 28, 2023
1 parent 31a133c commit d09037f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions cpp/src/barretenberg/plonk/proof_system/types/proof.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#include <cstdint>
#include <vector>
#include <ostream>
#include <iomanip>
#include "barretenberg/common/serialize.hpp"

namespace plonk {
Expand All @@ -23,11 +25,17 @@ template <typename B> inline void write(B& buf, proof const& data)

inline std::ostream& operator<<(std::ostream& os, proof const& data)
{
os << "[\n ";
for (size_t i = 0; i < data.proof_data.size(); ++i) {
os << data.proof_data[i] << " ";
// REFACTOR: This is copied from barretenberg/common/streams.hpp,
// which means we could just cout proof_data directly, but that breaks the build in the CI with
// a redefined operator<< error in barretenberg/stdlib/hash/keccak/keccak.test.cpp,
// which is something we really don't want to deal with right now.
std::ios_base::fmtflags f(os.flags());
os << "[" << std::hex << std::setfill('0');
for (auto byte : data.proof_data) {
os << ' ' << std::setw(2) << +(unsigned char)byte;
}
os << "]\n";
os << " ]";
os.flags(f);
return os;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inline void read(uint8_t const*& it, native_aggregation_state& state)

read(it, state.P0);
read(it, state.P1);
info(it, state.public_inputs);
read(it, state.public_inputs);
read(it, state.proof_witness_indices);
read(it, state.has_data);
};
Expand Down

0 comments on commit d09037f

Please sign in to comment.