nwaku/waku/waku_core/message/message.nim
Ivan FB ed09074cc3
chore: message.nim - set max message size to 150KiB according to spec (#2298)
* message.nim: set max message size to 150KiB according to spec

Using KiB instead of KB because that seems more aligned with
the actual default defined in nim-libp2p (1024 * 1024)

Spec details: https://rfc.vac.dev/spec/64/#message-size

* test_protocol.nim: align test to current WakuMessage limit
* test_waku_client.nim: adapt test to MaxWakuMessageSize change
* make maxMessageSize configurable for wakunode2
* wakunode2 app now accepts max-num-bytes-msg-size with KiB, KB, or B units
* testlib/wakunode.nim: set maxMessageSize: "1024 KiB"
* test_waku_client.nim: remove duplicate check in "Valid Payload Sizes"
* set DefaultMaxWakuMessageSizeStr as the only source of truth
* external_config.nim: rename max-num-bytes-msg-size -> max-msg-size
2024-01-03 13:11:50 +01:00

39 lines
1.1 KiB
Nim

## Waku Message module.
##
## See https://github.com/vacp2p/specs/blob/master/specs/waku/v2/waku-message.md
## for spec.
when (NimMajor, NimMinor) < (1, 4):
{.push raises: [Defect].}
else:
{.push raises: [].}
import
../topics,
../time,
./default_values
const
MaxMetaAttrLength* = 64 # 64 bytes
type WakuMessage* = object
# Data payload transmitted.
payload*: seq[byte]
# String identifier that can be used for content-based filtering.
contentTopic*: ContentTopic
# Application specific metadata.
meta*: seq[byte]
# Number to discriminate different types of payload encryption.
# Compatibility with Whisper/WakuV1.
version*: uint32
# Sender generated timestamp.
timestamp*: Timestamp
# The ephemeral attribute indicates signifies the transient nature of the
# message (if the message should be stored).
ephemeral*: bool
# Part of RFC 17: https://rfc.vac.dev/spec/17/
# The proof attribute indicates that the message is not spam. This
# attribute will be used in the rln-relay protocol.
proof*: seq[byte]