Skip to content

Commit 04e7624

Browse files
committed
Handle formats 2 and 3
1 parent 7a45ca4 commit 04e7624

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

barretenberg/cpp/src/barretenberg/dsl/acir_format/acir_to_constraint_buf.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ T deserialize_any_format(std::vector<uint8_t>&& buf,
285285
// Once we remove support for legacy bincode format, we should expect to always
286286
// have a format marker corresponding to acir::serialization::Format::Msgpack,
287287
// but until then a match could be pure coincidence.
288-
if (buf[0] == 2) {
288+
const uint8_t FORMAT_MSGPACK = 2;
289+
const uint8_t FORMAT_MSGPACK_COMPACT = 3;
290+
uint8_t format = buf[0];
291+
if (format == FORMAT_MSGPACK || format == FORMAT_MSGPACK_COMPACT) {
289292
// Skip the format marker to get the data.
290293
const char* buffer = &reinterpret_cast<const char*>(buf.data())[1];
291294
size_t size = buf.size() - 1;
@@ -295,10 +298,9 @@ T deserialize_any_format(std::vector<uint8_t>&& buf,
295298
// This has to be on a separate line, see
296299
// https://github.com/msgpack/msgpack-c/issues/695#issuecomment-393035172
297300
auto o = oh.get();
298-
// In experiments bincode data was parsed as 0.
299-
// All the top level formats we look for are MAP types.
300-
if (o.type == msgpack::type::MAP) {
301-
BB_ASSERT(false, "acir_format::deserialize_any_format: Msgpack is not currently supported.");
301+
// In experiments bincode data was parsed as 0, so a successful parse is not a guarnatee that it's
302+
// msgpack. All the top level formats we look for are MAP or ARRAY types (depending on the format).
303+
if (o.type == msgpack::type::MAP || o.type == msgpack::type::ARRAY) {
302304
return decode_msgpack(o);
303305
}
304306
}

0 commit comments

Comments
 (0)