Skip to content

feat: Multi app per kernel#22640

Merged
federicobarbacovi merged 11 commits into
merge-train/barretenbergfrom
fb/multi_app_kernels
May 6, 2026
Merged

feat: Multi app per kernel#22640
federicobarbacovi merged 11 commits into
merge-train/barretenbergfrom
fb/multi_app_kernels

Conversation

@federicobarbacovi

@federicobarbacovi federicobarbacovi commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Implementation of the required infrastructure to support multiple apps per kernel.

This PR generalises databus-related infrastructure to support multiple apps per kernel. It also generalised mocking IVC state, mock circuits producers, and public inputs structure so that we can easily transition to kernels processing multiple apps.


switch (field) {
case KernelIOField::PAIRING_INPUTS:
// Use P0 + random offset to break public-input binding without trivially breaking the pairing.

@federicobarbacovi federicobarbacovi Apr 20, 2026

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.

To avoid breaking the pairing shouldn't we add the point at infinity? @ledwards2225 or we could take the same approach as for the Apps (swap the two entries)

* @tparam Builder
*/
template <class Builder> class DataBusDepot {
template <class Builder, size_t N> class DataBusDepot {

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.

I opted for templating, I'm wondering whether this constant should be hard-coded to be NUM_APP_PER_KERNEL

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.

mm yes perhaps. Let's see how things shake out. It seems to me right now that the Depot will have fixed MAX_APPS_PER_KERNEL size for all kernels but maybe for some reason we'll find we need/want to have different sized depots for the different sized kernels within a single flow

#include <cstdint>
namespace bb {

// We assume all kernels have space for two return data commitments on their public inputs

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.

Unused

// Merge the ecc ops from the newly constructed circuit
auto goblin_proof = goblin.prove();
// Subtable values and commitments - needed for (Recursive)MergeVerifier

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.

We need to extract the polys in this way because the new methods don't allow extracting the current (i.e. the one being constructed) table and after merging the table that was merged is not retrievable by itself anymore

@ledwards2225 ledwards2225 self-requested a review April 21, 2026 18:11
@ledwards2225 ledwards2225 marked this pull request as ready for review May 5, 2026 22:15
@ledwards2225 ledwards2225 added the ci-full Run all master checks. label May 5, 2026

@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.

Reviewed via active collaboration. As discussed on slack, we could add more multi-app test now or do in a follow on.

@federicobarbacovi federicobarbacovi self-assigned this May 6, 2026
@federicobarbacovi federicobarbacovi enabled auto-merge (squash) May 6, 2026 11:17
@federicobarbacovi federicobarbacovi merged commit 36d6ec8 into merge-train/barretenberg May 6, 2026
17 checks passed
@federicobarbacovi federicobarbacovi deleted the fb/multi_app_kernels branch May 6, 2026 12:02
federicobarbacovi added a commit that referenced this pull request May 7, 2026
commit fe8ed94
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Thu May 7 14:09:02 2026 +0000

    Fix name

commit c704130
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Thu May 7 13:34:34 2026 +0000

    Extend calldata types, minor changes to README

commit de94416
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Thu May 7 00:43:23 2026 +0000

    prover tomls

commit c554fd0
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 21:59:54 2026 +0000

    vks

commit 0ae600b
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 21:08:25 2026 +0000

    constants

commit 6686c89
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 20:16:44 2026 +0000

    extend databus with 2 more cols

commit f8ac6da
Merge: 42e2e67 b3031a2
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 17:47:36 2026 +0000

    Merge branch 'next' into merge-train/barretenberg

commit b3031a2
Merge: 420fd55 d06c141
Author: Tom French <15848336+TomAFrench@users.noreply.github.com>
Date:   Wed May 6 16:32:12 2026 +0000

    chore: Update Noir to nightly-2026-05-05 (#22911)

    Automated update of Noir submodule to latest nightly.

    **Current**: unknown
    **New**: nightly-2026-05-05

    [View changes in
    noir-lang/noir](noir-lang/noir@20391fd...nightly-2026-05-05)

commit d06c141
Author: AztecBot <49558828+AztecBot@users.noreply.github.com>
Date:   Wed May 6 16:31:28 2026 +0000

    chore: Update Noir to nightly-2026-05-05

    Automated update of Noir submodule to latest nightly.

    **Current**: unknown
    **New**: nightly-2026-05-05

    [View changes in noir-lang/noir](noir-lang/noir@20391fd...nightly-2026-05-05)

commit 420fd55
Merge: 72c125c 22231d5
Author: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Date:   Wed May 6 16:30:52 2026 +0000

    feat: merge-train/barretenberg (#22969)

    BEGIN_COMMIT_OVERRIDE
    chore: skip zero-init and reserve copy_cycle vectors (#22963)
    feat: Multi app per kernel (#22640)
    END_COMMIT_OVERRIDE

commit 72c125c
Merge: a864dec 38115ab
Author: Aztec Bot <49558828+AztecBot@users.noreply.github.com>
Date:   Wed May 6 16:30:50 2026 +0000

    feat: merge-train/avm (#22986)

    BEGIN_COMMIT_OVERRIDE
    refactor(avm)!: consolidate revertible/non-revertible append selectors
    (#22982)
    END_COMMIT_OVERRIDE

commit 42e2e67
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Wed May 6 16:54:17 2026 +0100

    feat: Improve add_scaled_batch (#22981)

    Two improvements:
    1. `add_scaled_batch` was iterating over all polys to be batched and
    processing indices based on the range of the destination poly (the
    biggest of the polys to be batched). This PR adds a skipping condition
    that speeds up the function: we only iterate over the poly to be batched
    2. Write a bespoke `add_batch_scaled` for use in the AVM with dynamic
    allocation of threads: each thread picks up the new available poly and
    works with it. This makes optimal usage of the fact that many polys in
    the AVM are small.

    Link to AVM bulk test: http://ci.aztec-labs.com/1df80aa9b6ae0088. The
    PCS component is `446ms` down from ~`600ms`

commit 22231d5
Merge: 36d6ec8 a864dec
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 15:35:10 2026 +0000

    Merge branch 'next' into merge-train/barretenberg

commit 38115ab
Merge: 024b01b a864dec
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 15:35:07 2026 +0000

    Merge branch 'next' into merge-train/avm

commit a864dec
Merge: 1211a03 b23fb63
Author: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Date:   Wed May 6 14:55:36 2026 +0000

    chore(p2p): drop unused ENR xxhash versioning path (#22943)

    ## Summary
    Removes dead code from `p2p/src/versioning.ts`:

    - `USE_XX_HASH` was never `true` outside tests; production ENRs always
    used the compressed string from `compressComponentVersions`.
    - Peer discovery already validates with
    `checkCompressedComponentVersion` in `discV5_service.ts`;
    `checkAztecEnrVersion` was only used from tests.
    - Drops `xxhash-wasm` / `toBufferBE` from this module (gossip
    `encoding.ts` still uses xxhash for message IDs).

    Related to
    [A-766](https://linear.app/aztec-labs/issue/A-766/audit-97-enr-version-detection-uses-string-prefix-matching-fragile)

commit 024b01b
Author: Jean M <132435771+jeanmon@users.noreply.github.com>
Date:   Wed May 6 14:18:16 2026 +0200

    refactor(avm)!: consolidate revertible/non-revertible append selectors (#22982)

    The 6 boolean pairs (non_revertible_append_X, revertible_append_X) for X
    in {note_hash, nullifier, l2_l1_msg} in TX_PHASE_SPEC_MAP were perfectly
    correlated with is_revertible: in every phase where one of them is set,
    is_revertible already determines which side. Replace each pair with a
    single sel_append_X selector and let is_revertible carry the
    revertibility bit.

    This removes 3 precomputed columns and 3 committed columns in the tx
    trace, shrinks the #[READ_PHASE_SPEC] lookup tuple, and simplifies the
    sel_try_X_append / is_tree_insert_phase / SEL_CAN_EMIT_X expressions.

    In #[NOTE_HASH_APPEND], the sel_unique flag (previously fed by
    sel_revertible_append_note_hash) is now is_revertible directly: on the
    two rows where the lookup is gated on, the two values agree by
    construction, and is_revertible is the more direct semantic for the
    "make this note hash unique with a nonce" decision.

    Updates the hardcoded precomputed VK commitments in avm_fixed_vk.hpp and
    the corresponding vk_hash; new values obtained from
    AvmFixedVKTests.FixedVKCommitments.

commit b23fb63
Author: spypsy <spypsy@outlook.com>
Date:   Tue May 5 10:07:46 2026 +0000

    chore(p2p): drop unused ENR xxhash versioning path

    USE_XX_HASH was never true in production; discv5 already validates via
    checkCompressedComponentVersion. Removes xxhash/toBufferBE from versioning.ts
    and tests the string format only.
federicobarbacovi added a commit that referenced this pull request May 7, 2026
commit fe8ed94
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Thu May 7 14:09:02 2026 +0000

    Fix name

commit c704130
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Thu May 7 13:34:34 2026 +0000

    Extend calldata types, minor changes to README

commit de94416
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Thu May 7 00:43:23 2026 +0000

    prover tomls

commit c554fd0
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 21:59:54 2026 +0000

    vks

commit 0ae600b
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 21:08:25 2026 +0000

    constants

commit 6686c89
Author: ledwards2225 <l.edwards.d@gmail.com>
Date:   Wed May 6 20:16:44 2026 +0000

    extend databus with 2 more cols

commit f8ac6da
Merge: 42e2e67 b3031a2
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 17:47:36 2026 +0000

    Merge branch 'next' into merge-train/barretenberg

commit b3031a2
Merge: 420fd55 d06c141
Author: Tom French <15848336+TomAFrench@users.noreply.github.com>
Date:   Wed May 6 16:32:12 2026 +0000

    chore: Update Noir to nightly-2026-05-05 (#22911)

    Automated update of Noir submodule to latest nightly.

    **Current**: unknown
    **New**: nightly-2026-05-05

    [View changes in
    noir-lang/noir](noir-lang/noir@20391fd...nightly-2026-05-05)

commit d06c141
Author: AztecBot <49558828+AztecBot@users.noreply.github.com>
Date:   Wed May 6 16:31:28 2026 +0000

    chore: Update Noir to nightly-2026-05-05

    Automated update of Noir submodule to latest nightly.

    **Current**: unknown
    **New**: nightly-2026-05-05

    [View changes in noir-lang/noir](noir-lang/noir@20391fd...nightly-2026-05-05)

commit 420fd55
Merge: 72c125c 22231d5
Author: ledwards2225 <98505400+ledwards2225@users.noreply.github.com>
Date:   Wed May 6 16:30:52 2026 +0000

    feat: merge-train/barretenberg (#22969)

    BEGIN_COMMIT_OVERRIDE
    chore: skip zero-init and reserve copy_cycle vectors (#22963)
    feat: Multi app per kernel (#22640)
    END_COMMIT_OVERRIDE

commit 72c125c
Merge: a864dec 38115ab
Author: Aztec Bot <49558828+AztecBot@users.noreply.github.com>
Date:   Wed May 6 16:30:50 2026 +0000

    feat: merge-train/avm (#22986)

    BEGIN_COMMIT_OVERRIDE
    refactor(avm)!: consolidate revertible/non-revertible append selectors
    (#22982)
    END_COMMIT_OVERRIDE

commit 42e2e67
Author: federicobarbacovi <171914500+federicobarbacovi@users.noreply.github.com>
Date:   Wed May 6 16:54:17 2026 +0100

    feat: Improve add_scaled_batch (#22981)

    Two improvements:
    1. `add_scaled_batch` was iterating over all polys to be batched and
    processing indices based on the range of the destination poly (the
    biggest of the polys to be batched). This PR adds a skipping condition
    that speeds up the function: we only iterate over the poly to be batched
    2. Write a bespoke `add_batch_scaled` for use in the AVM with dynamic
    allocation of threads: each thread picks up the new available poly and
    works with it. This makes optimal usage of the fact that many polys in
    the AVM are small.

    Link to AVM bulk test: http://ci.aztec-labs.com/1df80aa9b6ae0088. The
    PCS component is `446ms` down from ~`600ms`

commit 22231d5
Merge: 36d6ec8 a864dec
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 15:35:10 2026 +0000

    Merge branch 'next' into merge-train/barretenberg

commit 38115ab
Merge: 024b01b a864dec
Author: AztecBot <tech@aztecprotocol.com>
Date:   Wed May 6 15:35:07 2026 +0000

    Merge branch 'next' into merge-train/avm

commit a864dec
Merge: 1211a03 b23fb63
Author: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Date:   Wed May 6 14:55:36 2026 +0000

    chore(p2p): drop unused ENR xxhash versioning path (#22943)

    ## Summary
    Removes dead code from `p2p/src/versioning.ts`:

    - `USE_XX_HASH` was never `true` outside tests; production ENRs always
    used the compressed string from `compressComponentVersions`.
    - Peer discovery already validates with
    `checkCompressedComponentVersion` in `discV5_service.ts`;
    `checkAztecEnrVersion` was only used from tests.
    - Drops `xxhash-wasm` / `toBufferBE` from this module (gossip
    `encoding.ts` still uses xxhash for message IDs).

    Related to
    [A-766](https://linear.app/aztec-labs/issue/A-766/audit-97-enr-version-detection-uses-string-prefix-matching-fragile)

commit 024b01b
Author: Jean M <132435771+jeanmon@users.noreply.github.com>
Date:   Wed May 6 14:18:16 2026 +0200

    refactor(avm)!: consolidate revertible/non-revertible append selectors (#22982)

    The 6 boolean pairs (non_revertible_append_X, revertible_append_X) for X
    in {note_hash, nullifier, l2_l1_msg} in TX_PHASE_SPEC_MAP were perfectly
    correlated with is_revertible: in every phase where one of them is set,
    is_revertible already determines which side. Replace each pair with a
    single sel_append_X selector and let is_revertible carry the
    revertibility bit.

    This removes 3 precomputed columns and 3 committed columns in the tx
    trace, shrinks the #[READ_PHASE_SPEC] lookup tuple, and simplifies the
    sel_try_X_append / is_tree_insert_phase / SEL_CAN_EMIT_X expressions.

    In #[NOTE_HASH_APPEND], the sel_unique flag (previously fed by
    sel_revertible_append_note_hash) is now is_revertible directly: on the
    two rows where the lookup is gated on, the two values agree by
    construction, and is_revertible is the more direct semantic for the
    "make this note hash unique with a nonce" decision.

    Updates the hardcoded precomputed VK commitments in avm_fixed_vk.hpp and
    the corresponding vk_hash; new values obtained from
    AvmFixedVKTests.FixedVKCommitments.

commit b23fb63
Author: spypsy <spypsy@outlook.com>
Date:   Tue May 5 10:07:46 2026 +0000

    chore(p2p): drop unused ENR xxhash versioning path

    USE_XX_HASH was never true in production; discv5 already validates via
    checkCompressedComponentVersion. Removes xxhash/toBufferBE from versioning.ts
    and tests the string format only.
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request May 16, 2026
BEGIN_COMMIT_OVERRIDE
chore: skip zero-init and reserve copy_cycle vectors (AztecProtocol#22963)
feat: Multi app per kernel (AztecProtocol#22640)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants