Skip to content

Discuss format of capabilities #6503

Closed
@konradkonrad

Description

@konradkonrad

Abstract

Handshake protocol capabilities are introduced with #6482 / #3283

With matrix, the feature (ab)uses the user's avatar_url for broadcasting it. The current serialization format was implemented first by raiden-network/light-client#1210 and informally specified in #3283 (comment)

We should discuss the format, before we release a new client version to the mainnet.

Areas to discuss

  • Negating/Opt-out flags
  • Hand-rolled (de-)serialization

Negating/Opt-out flags

The current incarnation of capabilities knows three negating flags:

  • NoReceive
  • NoMediate
  • NoDelivery
    and one positive flag:
  • WebRTC

The serialization on the other hand defines that the absence of a flag translates to a boolean False. So a capability handshake message for NoDelivery+WebRTC will be serialized as

capabilities_serialized = "NoDelivery,WebRTC"

and de-serialized as

capabilities_deserialized = {"NoDelivery": True, "NoMediate": False, "NoDelivery": False, "WebRTC": True}

We should discuss, whether or not we could swap the defaults around to simplify the semantics.

Hand-rolled (de-)serialization

Capabilities are typed as

Dict[str, Union[str, bool]]

During serialization, the keys are ',' joined for all True boolean values, keys for False boolean values are dropped; all non-boolean values are serialized as key="value" and also ',' joined.

However, the existing proposal suggests a type of Dict[str, Any]. During deserialization that will need casting to expected types.

Judging from history, hand-rolled (de-)serializations are not necessarily a good idea.

We should discuss alternative encoding options, e.g. base64 + yaml.

Ping: @ulope @andrevmatos @karlb

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions