Skip to content

Align aggchain gRPC public_values compat codec with SP1/prover encoding #213

@Freyskeyd

Description

@Freyskeyd

Summary

agglayer-interop-grpc-types currently serializes and deserializes aggchain public_values in gRPC v1 compat using plain workspace bincode.

Agglayer and the provers repo indicate that aggchain public_values should use the SP1/prover codec semantics instead, specifically the sp1v4() bincode configuration.

This mismatch blocks Agglayer from safely relying on interop's TryFrom<v1::AggchainProof> / TryFrom<v1::AggchainData> conversions without reimplementing local parsing.

Evidence

  • In provers, aggchain proof public values are encoded/decoded with bincode::sp1v4():
    • crates/aggkit-prover/src/rpc.rs
    • crates/aggchain-proof-builder/src/lib.rs
  • In agglayer-interop-grpc-types, compat currently uses plain bincode in:
    • crates/agglayer-interop-grpc-types/src/compat/v1/aggchain_data/v1_to_types.rs
    • crates/agglayer-interop-grpc-types/src/compat/v1/aggchain_data/types_to_v1.rs
  • The byte-level mismatch shows up in origin_network endianness inside AggchainProofPublicValues.

Proposed Change

  • Update gRPC compat public_values parsing and encoding in agglayer-interop-grpc-types to use the SP1/prover codec configuration rather than plain default bincode.
  • Add regression tests that pin the expected wire bytes for both:
    • generic aggchain proof public_values
    • bare aggchain proof public_values

Why It Matters

Once interop gRPC compat uses the same codec as the prover/public proof producer, Agglayer can rely on interop structural conversions for aggchain data instead of maintaining duplicated parsing logic locally.

Acceptance Criteria

  • public_values gRPC compat encode/decode uses the SP1/prover-compatible codec.
  • Existing or new tests verify the expected byte order for origin_network and other fields.
  • Agglayer can consume interop conversions without public_values wire-format regressions.

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