Skip to content

multiPCS: make Oink-phase BATCH_SIZE-agnostic #1658

@iakovenkos

Description

@iakovenkos

Context

The OinkProver handles interleaved (BS > 1) and non-interleaved (BS = 1) commitment paths via if constexpr (BATCH_SIZE > 1) branches in every commit_to_* method.

The BS > 1 path currently hardcodes entity-to-group mappings by name.

This approach does not scale — adding BS = 2 or changing the group structure requires editing every method.


Proposed solution

Have the Flavor define round-to-group mappings and let OinkProver iterate generically:

// Flavor defines which groups are committed in each round:
static constexpr std::array WIRE_GROUP_INDICES = {8, 9, 10, 11, 12, 13};
static constexpr std::array W4_GROUP_INDICES = {16, 14};

// OinkProver iterates:
if constexpr (BATCH_SIZE > 1) {
    for (auto g : Flavor::WIRE_GROUP_INDICES) {
        commit_group_by_index(g);
    }
}

Benefits

  • Eliminates per-entity naming in the BS > 1 path
  • Makes adding new batch sizes (e.g. BS = 2) trivial — just define GroupAccessors
  • Removes commit_group’s O(n) linear scan for group buffer lookup (use index directly)
  • Consolidates ZK tail logic, which currently also performs a linear scan to find the group index

Current state

The explicit approach works correctly for BS = 1 and BS = 4.


Related

  • allocate_interleaved_groups in prover_polynomials.hpp is already generic over BS
  • GroupAccessors_<BS> already defines group structure per batch size
  • Gemini / Shplemini PCS infrastructure already supports arbitrary shift_exponent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions