ssvlabs / ssv-spec

GNU General Public License v3.0
25 stars 21 forks source link

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

Closed GalRogozinski closed 1 week ago

GalRogozinski commented 1 month ago

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

GalRogozinski commented 1 month ago

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.

GalRogozinski commented 1 week ago

Currently we solved with option 2 in #440