ssvlabs/ssv-spec

SignedSSVMessage isn't very readable and we invoke Decode too much.

GalRogozinski opened this issue · 2 comments

Currently SignedSSVMessage wraps SSVMessage that can orchestrate as either a QBFT message or a Partial Sig Message.

type SSVMessage struct {
    MsgType MsgType
    MsgID   MessageID `ssz-size:"56"`
    // Data max size is qbft SignedMessage max ~= 5243144 + 2^20 + 96 + 13 ~= 6291829
    Data []byte `ssz-max:"6291829"`
}

This isn't readable and currently causes too many invocations to Decode...

Two options:

  1. Create two types SignedQBFTMessage and SignedPartialSigMessage.
    This would get ugly though when trying to decode the proper message with ssz lib.

  2. Pass both the Signed wrapper and the inner message. All logic would be done on the inner message, but the final broadcast will be done on the wrapper.

Currently we solved with option 2 in #440