Skip to content

chore: Introduce Native IO mechanism#15820

Merged
federicobarbacovi merged 23 commits into
merge-train/barretenbergfrom
fb/native_io_mechanism
Jul 21, 2025
Merged

chore: Introduce Native IO mechanism#15820
federicobarbacovi merged 23 commits into
merge-train/barretenbergfrom
fb/native_io_mechanism

Conversation

@federicobarbacovi

Copy link
Copy Markdown
Contributor

We introduce native counterparts for our IO mechanism so that the reconstruction of public inputs in from native field elements is similar to that in-circuit

AztecBot and others added 17 commits July 16, 2025 16:21
…lement`, `bb::fq`, and `bb::fr` (#15774)

We make public input reconstruction in native land more idiomatic by introducing `reconstruct_from_public` method for `fq`, `fr`, and `affine_element`.

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com>
Co-authored-by: Jonathan Hao <jonathan@aztec-labs.com>
Co-authored-by: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Co-authored-by: Raju Krishnamoorthy <krishnamoorthy@gmail.com>
Co-authored-by: notnotraju <raju@aztec-labs.com>
Co-authored-by: Lucas Xia <lucasxia01@gmail.com>
Co-authored-by: Khashayar Barooti <khashayar@aztecprotocol.com>
Co-authored-by: Jean M <132435771+jeanmon@users.noreply.github.com>
Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Co-authored-by: Santiago Palladino <spalladino@users.noreply.github.com>
Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
Co-authored-by: ludamad <domuradical@gmail.com>
Co-authored-by: maramihali <mara@aztecprotocol.com>
Co-authored-by: Sarkoxed <75146596+Sarkoxed@users.noreply.github.com>
*
*/
static OpeningClaim<Curve> reconstruct_from_public(const std::span<bb::fr, IPA_CLAIM_SIZE>& ipa_claim_limbs)
static OpeningClaim<Curve> reconstruct_from_public(const std::span<const bb::fr, IPA_CLAIM_SIZE>& ipa_claim_limbs)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

General comment about why these changes happened: to reconstruct_from_public we pass a const std::vector<FF>, when that is passed down to other reconstruct_from_public as a span, the span wants it to be std::span<const FF>, that is why I had to make this change

@federicobarbacovi federicobarbacovi marked this pull request as ready for review July 18, 2025 11:40
@federicobarbacovi federicobarbacovi self-assigned this Jul 18, 2025

@ledwards2225 ledwards2225 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great! My only request is that you move the native IO logic to its own file/classes outside of the stdlib. AFAICT the classes are not using anything from their stdlib counterparts and this would avoid the awkwardness of needing to include stdlib types into the native verifier.

// two field element coordinates (x, y). Thus, four base field elements
// Four limbs are used when simulating a non-native field using the bigfield class, so 16 total field elements.
static constexpr uint32_t PAIRING_POINTS_SIZE = 16;
// PairingPointAccumulatorIndices represents an array of 16 witness indices pointing to the nested aggregation object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed as it is unused

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ledwards2225 Tagging you to let you know of this change

public:
using FF = curve::BN254::ScalarField;

// TODO(https://github.com/AztecProtocol/barretenberg/issues/1478): Can we define this constant as part of

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added this todo as I noticed there is still some ad-hoc public input handling @ledwards2225

@federicobarbacovi federicobarbacovi merged commit f81e852 into merge-train/barretenberg Jul 21, 2025
4 checks passed
@federicobarbacovi federicobarbacovi deleted the fb/native_io_mechanism branch July 21, 2025 10:03
github-merge-queue Bot pushed a commit that referenced this pull request Jul 21, 2025
See
[merge-train-readme.md](https://github.com/AztecProtocol/aztec-packages/blob/next/.github/workflows/merge-train-readme.md).

BEGIN_COMMIT_OVERRIDE
chore!: Remove circuit_size from all VKs (#15747)
chore: Introduce data structures to hold inputs/outputs of the Merge
verification (#15735)
chore: replace asserts with runtime errors. (#15671)
chore: kernels start with eq and reset (#15734)
chore: Introduce Native IO mechanism (#15820)
fix: Update Cargo.lock in avm-transpiler (#15837)
END_COMMIT_OVERRIDE

---------

Co-authored-by: AztecBot <tech@aztecprotocol.com>
Co-authored-by: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Co-authored-by: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Co-authored-by: sergei iakovenko <105737703+iakovenkos@users.noreply.github.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Suyash Bagad <suyash@aztecprotocol.com>
Co-authored-by: Jonathan Hao <jonathan@aztec-labs.com>
Co-authored-by: Raju Krishnamoorthy <krishnamoorthy@gmail.com>
Co-authored-by: notnotraju <raju@aztec-labs.com>
Co-authored-by: Lucas Xia <lucasxia01@gmail.com>
Co-authored-by: Khashayar Barooti <khashayar@aztecprotocol.com>
Co-authored-by: Jean M <132435771+jeanmon@users.noreply.github.com>
Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Co-authored-by: Santiago Palladino <spalladino@users.noreply.github.com>
Co-authored-by: Santiago Palladino <santiago@aztec-labs.com>
Co-authored-by: ludamad <domuradical@gmail.com>
Co-authored-by: maramihali <mara@aztecprotocol.com>
Co-authored-by: Sarkoxed <75146596+Sarkoxed@users.noreply.github.com>
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