Skip to content

Conversation

@test-sum
Copy link

Summary

This PR adds minimal, backward-compatible serialization helpers for CIRCL’s Prio3 types to support cross-process and distributed deployments of Verifiable Distributed Aggregation Functions (VDAFs).

Background

The current CIRCL VDAF implementation assumes that all aggregators and the collector operate within a single process.
Serialization helpers (e.g., for InputShare, PrepShare, OutShare) are defined under vdaf/prio3/internal/prio3, which cannot be accessed externally due to Go’s internal/ package visibility rules.

This makes distributed deployments — where aggregators and the collector run on distinct hosts — infeasible without modifying CIRCL.
Our patch exposes a minimal public serialization interface to enable share transmission between processes while preserving CIRCL’s internal cryptographic semantics.

Changes Introduced

  • Added public methods for raw export/import of Prio3 share types:
    func (s *OutShare[V,E]) ExportRaw() ([]byte, error)
    func (s *OutShare[V,E]) ImportRaw([]byte) error

@armfazh
Copy link
Contributor

armfazh commented Oct 23, 2025

it looks like this PR needs to be rebase on top of the current main branch

@test-sum test-sum force-pushed the feature/exportraw-serialization branch from 0b6611d to 70ac16c Compare October 23, 2025 16:34
@test-sum
Copy link
Author

Thank you, @armfazh ....you’re right. I’ve rebased on the latest main and pushed again.
The diff now only includes the two intended files. Apologies for the earlier noise 🙂

Copy link
Contributor

@armfazh armfazh left a comment

Choose a reason for hiding this comment

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

Could you please verify whether MarshalBinary already produces the same encoding?

}

// ExportRaw serializes the vector as a sequence of raw field elements
func (v Vec) ExportRaw() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like the same encoding as the one provided by the Marshal function?

https://github.com/cloudflare/circl/blob/main/vdaf/prio3/arith/fp64/fp.go#L41

}

// ExportBytes returns the portable binary encoding of the OutShare.
func (s *OutShare[V, E]) ExportBytes() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is equivalent to calling s.MarshalBinary directly. So no need to have the ExportBytes and ImportBytes methods.

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.

2 participants