Skip to content

Network message SSZ schema #871

@jannikluhn

Description

@jannikluhn

(Continuing discussion from the PR)

Two nitpicks regarding the network message serialization format:

  1. If we use SSZ, we need a single base schema that embeds the payload message for network messages as otherwise receivers don't know how to decode it. However right now, the spec defines three message types:
Request: (
    id: uint64
    method_id: uint16
    body: Request
)

Reponse: (
    id: uint64
    response_code: uint16
    result: bytes
)

ErrorResponse: (
    id: uint64
    response_code: uint16
    result: bytes
)

Response and ErrorResponse are identical, but Request differs a little. It would also be nice to give them the same name and field names, because that's what implementations will use when they first decode a message (e.g. Message with message_id, request_id, and body). body would be a bytes that carries the SSZ serialized request/response/error. This adds an additional 4-byte prefix, but I think that's unavoidable.

  1. The spec says
The result member is OPTIONAL on errors, and MAY contain additional information about the error.

There aren't optional fields in SSZ right now, so it should just be a blank string if there's no information.

@mslipper

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions