Skip to content

Optimize Msg Structures #58

Open
Open

Description

@GalRogozinski

Activity

  1. diegomrsantos commented on Mar 4, 2026

    @diegomrsantos
    Collaborator

    Suggestion: use fixed-size encoding for RSA signatures

    SignedSSVMessage.Signatures is currently defined as:

    Signatures  [][]byte  `ssz-max:"13,256"`

    Since RSA-2048 signatures are always exactly 256 bytes (output is always the size of the modulus), the inner dimension could use fixed-size encoding instead of variable-length. The current ssz-max:"13,256" allows signatures shorter than 256 bytes at the wire level, which are never valid for RSA-2048.

    Using fixed-size inner encoding would:

    • Enforce the invariant at the SSZ layer
    • Produce slightly more compact encoding (no offset pointers per signature)
    • Eliminate the need for runtime signature size validation

    This came up during review of structural validation in Anchor — the VariableList<u8, U256> type (matching the Go spec) only guarantees <= 256, not == 256, so exact-size checks must be done at validation time rather than being enforced by the type system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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