File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
barretenberg/cpp/src/barretenberg Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,11 @@ inline constexpr std::string camel_case(std::string_view name)
150150} // namespace msgpack_detail
151151
152152// Same as MSGPACK_FIELDS but expecting the serialized names to be in camelCase.
153+ // NOTE: We create an intermediate variable because `pack_fn` requires lvalues, and since `camel_case` returns a
154+ // std::string things get weird.
153155#define MSGPACK_CAMEL_CASE_FIELDS (...) \
154156 void msgpack (auto pack_fn) \
155157 { \
156- pack_fn (NVPFG (::msgpack_detail::camel_case, , __VA_ARGS__)); \
158+ auto args = std::make_tuple (NVPFG (::msgpack_detail::camel_case, , __VA_ARGS__)); \
159+ std::apply (pack_fn, args); \
157160 }
Original file line number Diff line number Diff line change 77
88namespace msgpack ::adaptor {
99
10+ // Pack function for uint128_t
11+ template <> struct pack <uint128_t > {
12+ template <typename Stream> msgpack::packer<Stream>& operator ()(msgpack::packer<Stream>& o, uint128_t const & v) const
13+ {
14+ // Use the bin format for 16 bytes of data
15+ o.pack_bin (16 );
16+ o.pack_bin_body (reinterpret_cast <const char *>(&v), 16 );
17+ return o;
18+ }
19+ };
20+
1021template <> struct convert <uint128_t > {
1122 msgpack::object const & operator ()(msgpack::object const & o, uint128_t & v) const
1223 {
Original file line number Diff line number Diff line change 66
77#include " barretenberg/common/streams.hpp" // Derives operator<< from MSGPACK_FIELDS.
88#include " barretenberg/serialize/msgpack.hpp"
9+ #include " barretenberg/serialize/msgpack_impl/uint_128_t_adaptor.hpp"
910#include " barretenberg/vm2/common/aztec_constants.hpp"
1011#include " barretenberg/vm2/common/field.hpp"
1112#include " msgpack/adaptor/define_decl.hpp"
You can’t perform that action at this time.
0 commit comments