Skip to content

Commit 72d1a86

Browse files
committed
feat(barretenberg): more debugging tweaks
1 parent 24733e6 commit 72d1a86

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

include/msgpack/v1/adaptor/detail/cpp11_define_map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct define_map_imp {
3939
convert_helper(*it->second, std::get<N-1>(t));
4040
} else {
4141
// <barretenberg>
42-
throw msgpack::unpack_error(std::string("Missing field " + std::get<N-2>(t)));
42+
throw msgpack::unpack_error(std::string("Missing field ") + std::get<N-2>(t));
4343
// </barretenberg>
4444
}
4545
}

include/msgpack/v1/object.hpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,14 @@ struct object_stringize_visitor {
466466
m_os << '"';
467467
return true;
468468
}
469-
bool visit_bin(const char* /*v*/, uint32_t size) {
470-
m_os << "\"BIN(size:" << size << ")\"";
469+
bool visit_bin(const char* v, uint32_t size) {
470+
// <barretenberg> print binary strings in hex
471+
m_os << "\"BIN(size:" << size << "): 0x";
472+
for (uint32_t i = 0; i < size; ++i) {
473+
m_os << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(static_cast<unsigned char>(v[i]));
474+
}
475+
m_os << "\"";
476+
// </barrenteberg>
471477
return true;
472478
}
473479
bool visit_ext(const char* v, uint32_t size) {
@@ -633,6 +639,8 @@ namespace detail {
633639
template <typename Stream, typename T>
634640
struct packer_serializer {
635641
static msgpack::packer<Stream>& pack(msgpack::packer<Stream>& o, const T& v) {
642+
// <barretenberg>Note, if this is failing, the associated type probably wants
643+
// an auto msgpack(){ar(NVP(...fields...));} method</barretenberg>
636644
v.msgpack_pack(o);
637645
return o;
638646
}

0 commit comments

Comments
 (0)