Skip to content

feat: C++ codegen to support the msgpack-compact serialisation format#10878

Merged
aakoshh merged 6 commits intoaf/msgpack-defaultfrom
af/msgpack-compact-cpp
Dec 18, 2025
Merged

feat: C++ codegen to support the msgpack-compact serialisation format#10878
aakoshh merged 6 commits intoaf/msgpack-defaultfrom
af/msgpack-compact-cpp

Conversation

@aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Dec 10, 2025

Description

Problem

As the graphs in #7690 demonstrate, the msgpack-compact format can provide some reduction in the size of the serialised circuits, at the cost of some backwards compatibility. The Crypto Engineering team was interested in trying to pursue this, but in AztecProtocol/aztec-packages#12841 we didn't generate C++ code to handle it.

Summary

Changes the C++ codegen to generate code that handles both the 'map' and the 'tuple' formats that the rmp_serde library is capable of producing.

We don't utilise the serialisation in C++, but that stays being 'map' based only.

Introduced special handling for struct fields with () type: they are skipped during deserialisation in the generated C++ code. This is used in the special purpose ProgramWithoutBrillig type to ignore the unconstrained_functions field. By setting it to unconstrained_functions: (), we can add more fields after it, and still correctly get them from the msgpack::type::ARRAY that the 'tuple' format produces.

Additional Context

With this format, the only difference is that structs are serialised as an ARRAY of fields rather than a MAP of (field-name, value) pairs. The number of fields in the array has to match the number of fields in the structure. The format still uses strings for tagging enum variants.

See these tests for the difference in the backwards compatibility of msgpack vs msgpack-compact.

The format can be activated with the env var:

export NOIR_SERIALIZATION_FORMAT=msgpack-compact 

User Documentation

Check one:

  • No user documentation needed.
  • Changes in docs/ included in this PR.
  • [For Experimental Features] Changes in docs/ to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@aakoshh aakoshh changed the title feat: feat: C++ codegen to support the msgpack-compact serialisation format Dec 10, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 87d863a Previous: 1eeaba1 Ratio
rollup-block-root-single-tx 0.003 s 0.002 s 1.50
rollup-checkpoint-merge 0.004 s 0.003 s 1.33
rollup-tx-merge 0.003 s 0.002 s 1.50

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: 87d863a Previous: 1eeaba1 Ratio
test_report_zkpassport_noir-ecdsa_ 2 s 1 s 2

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Dec 10, 2025
#18937)

Brings the changes in the generated C++ for deserialising programs from
noir-lang/noir#10878
adding support for the `msgpack-compact` format.

Removes the exception if `msgpack` or `msgpack-compact` format is
encountered in the format marker.

Tested the same way as
#12841 but with
`export NOIR_SERIALIZATION_FORMAT=msgpack-compact`.
ludamad added a commit to AztecProtocol/aztec-packages that referenced this pull request Dec 15, 2025
Updates the noir submodule to noir-lang/noir#10878 which adds C++ codegen
support for msgpack-compact serialization format.

Also exports NOIR_SERIALIZATION_FORMAT=msgpack-compact in source_bootstrap.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ludamad added a commit to AztecProtocol/aztec-packages that referenced this pull request Dec 15, 2025
Updates the noir submodule to noir-lang/noir#10878 which adds C++ codegen
support for msgpack-compact serialization format.

Also exports NOIR_SERIALIZATION_FORMAT=msgpack-compact in source_bootstrap.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ludamad added a commit to AztecProtocol/aztec-packages that referenced this pull request Dec 15, 2025
Updates the noir submodule to noir-lang/noir#10878 which adds C++ codegen
support for msgpack-compact serialization format.

Also exports NOIR_SERIALIZATION_FORMAT=msgpack-compact in source_bootstrap.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@aakoshh aakoshh merged commit 3562959 into af/msgpack-default Dec 18, 2025
128 checks passed
@aakoshh aakoshh deleted the af/msgpack-compact-cpp branch December 18, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant