diff --git a/packages/proto/src/lib/filter.ts b/packages/proto/src/lib/filter.ts index 989fcbd8da..67a0f3d08b 100644 --- a/packages/proto/src/lib/filter.ts +++ b/packages/proto/src/lib/filter.ts @@ -4,8 +4,8 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' +import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc' import type { Uint8ArrayList } from 'uint8arraylist' export interface FilterRequest { @@ -48,12 +48,14 @@ export namespace FilterRequest { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.contentTopic = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -115,18 +117,22 @@ export namespace FilterRequest { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.subscribe = reader.bool() break - case 2: + } + case 2: { obj.topic = reader.string() break - case 3: + } + case 3: { obj.contentFilters.push(FilterRequest.ContentFilter.codec().decode(reader, reader.uint32())) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -181,12 +187,14 @@ export namespace MessagePush { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32())) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -251,18 +259,22 @@ export namespace FilterRpc { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.requestId = reader.string() break - case 2: + } + case 2: { obj.request = FilterRequest.codec().decode(reader, reader.uint32()) break - case 3: + } + case 3: { obj.push = MessagePush.codec().decode(reader, reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -342,13 +354,13 @@ export namespace RateLimitProof { } }, (reader, length) => { const obj: any = { - proof: new Uint8Array(0), - merkleRoot: new Uint8Array(0), - epoch: new Uint8Array(0), - shareX: new Uint8Array(0), - shareY: new Uint8Array(0), - nullifier: new Uint8Array(0), - rlnIdentifier: new Uint8Array(0) + proof: uint8ArrayAlloc(0), + merkleRoot: uint8ArrayAlloc(0), + epoch: uint8ArrayAlloc(0), + shareX: uint8ArrayAlloc(0), + shareY: uint8ArrayAlloc(0), + nullifier: uint8ArrayAlloc(0), + rlnIdentifier: uint8ArrayAlloc(0) } const end = length == null ? reader.len : reader.pos + length @@ -357,30 +369,38 @@ export namespace RateLimitProof { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.proof = reader.bytes() break - case 2: + } + case 2: { obj.merkleRoot = reader.bytes() break - case 3: + } + case 3: { obj.epoch = reader.bytes() break - case 4: + } + case 4: { obj.shareX = reader.bytes() break - case 5: + } + case 5: { obj.shareY = reader.bytes() break - case 6: + } + case 6: { obj.nullifier = reader.bytes() break - case 7: + } + case 7: { obj.rlnIdentifier = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -460,7 +480,7 @@ export namespace WakuMessage { } }, (reader, length) => { const obj: any = { - payload: new Uint8Array(0), + payload: uint8ArrayAlloc(0), contentTopic: '' } @@ -470,30 +490,38 @@ export namespace WakuMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.payload = reader.bytes() break - case 2: + } + case 2: { obj.contentTopic = reader.string() break - case 3: + } + case 3: { obj.version = reader.uint32() break - case 10: + } + case 10: { obj.timestamp = reader.sint64() break - case 11: + } + case 11: { obj.meta = reader.bytes() break - case 21: + } + case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32()) break - case 31: + } + case 31: { obj.ephemeral = reader.bool() break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/filter_v2.ts b/packages/proto/src/lib/filter_v2.ts index e35fed80e0..f3fc385422 100644 --- a/packages/proto/src/lib/filter_v2.ts +++ b/packages/proto/src/lib/filter_v2.ts @@ -4,8 +4,8 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, enumeration, message } from 'protons-runtime' +import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc' import type { Uint8ArrayList } from 'uint8arraylist' export interface FilterSubscribeRequest { @@ -83,21 +83,26 @@ export namespace FilterSubscribeRequest { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.requestId = reader.string() break - case 2: + } + case 2: { obj.filterSubscribeType = FilterSubscribeRequest.FilterSubscribeType.codec().decode(reader) break - case 10: + } + case 10: { obj.pubsubTopic = reader.string() break - case 11: + } + case 11: { obj.contentTopics.push(reader.string()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -163,18 +168,22 @@ export namespace FilterSubscribeResponse { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.requestId = reader.string() break - case 10: + } + case 10: { obj.statusCode = reader.uint32() break - case 11: + } + case 11: { obj.statusDesc = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -231,15 +240,18 @@ export namespace MessagePush { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.wakuMessage = WakuMessage.codec().decode(reader, reader.uint32()) break - case 2: + } + case 2: { obj.pubsubTopic = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -319,13 +331,13 @@ export namespace RateLimitProof { } }, (reader, length) => { const obj: any = { - proof: new Uint8Array(0), - merkleRoot: new Uint8Array(0), - epoch: new Uint8Array(0), - shareX: new Uint8Array(0), - shareY: new Uint8Array(0), - nullifier: new Uint8Array(0), - rlnIdentifier: new Uint8Array(0) + proof: uint8ArrayAlloc(0), + merkleRoot: uint8ArrayAlloc(0), + epoch: uint8ArrayAlloc(0), + shareX: uint8ArrayAlloc(0), + shareY: uint8ArrayAlloc(0), + nullifier: uint8ArrayAlloc(0), + rlnIdentifier: uint8ArrayAlloc(0) } const end = length == null ? reader.len : reader.pos + length @@ -334,30 +346,38 @@ export namespace RateLimitProof { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.proof = reader.bytes() break - case 2: + } + case 2: { obj.merkleRoot = reader.bytes() break - case 3: + } + case 3: { obj.epoch = reader.bytes() break - case 4: + } + case 4: { obj.shareX = reader.bytes() break - case 5: + } + case 5: { obj.shareY = reader.bytes() break - case 6: + } + case 6: { obj.nullifier = reader.bytes() break - case 7: + } + case 7: { obj.rlnIdentifier = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -437,7 +457,7 @@ export namespace WakuMessage { } }, (reader, length) => { const obj: any = { - payload: new Uint8Array(0), + payload: uint8ArrayAlloc(0), contentTopic: '' } @@ -447,30 +467,38 @@ export namespace WakuMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.payload = reader.bytes() break - case 2: + } + case 2: { obj.contentTopic = reader.string() break - case 3: + } + case 3: { obj.version = reader.uint32() break - case 10: + } + case 10: { obj.timestamp = reader.sint64() break - case 11: + } + case 11: { obj.meta = reader.bytes() break - case 21: + } + case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32()) break - case 31: + } + case 31: { obj.ephemeral = reader.bool() break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/light_push.ts b/packages/proto/src/lib/light_push.ts index eea0519231..bae90bd199 100644 --- a/packages/proto/src/lib/light_push.ts +++ b/packages/proto/src/lib/light_push.ts @@ -4,8 +4,8 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' +import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc' import type { Uint8ArrayList } from 'uint8arraylist' export interface PushRequest { @@ -47,15 +47,18 @@ export namespace PushRequest { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.pubsubTopic = reader.string() break - case 2: + } + case 2: { obj.message = WakuMessage.codec().decode(reader, reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -114,15 +117,18 @@ export namespace PushResponse { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.isSuccess = reader.bool() break - case 2: + } + case 2: { obj.info = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -187,18 +193,22 @@ export namespace PushRpc { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.requestId = reader.string() break - case 2: + } + case 2: { obj.request = PushRequest.codec().decode(reader, reader.uint32()) break - case 3: + } + case 3: { obj.response = PushResponse.codec().decode(reader, reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -278,13 +288,13 @@ export namespace RateLimitProof { } }, (reader, length) => { const obj: any = { - proof: new Uint8Array(0), - merkleRoot: new Uint8Array(0), - epoch: new Uint8Array(0), - shareX: new Uint8Array(0), - shareY: new Uint8Array(0), - nullifier: new Uint8Array(0), - rlnIdentifier: new Uint8Array(0) + proof: uint8ArrayAlloc(0), + merkleRoot: uint8ArrayAlloc(0), + epoch: uint8ArrayAlloc(0), + shareX: uint8ArrayAlloc(0), + shareY: uint8ArrayAlloc(0), + nullifier: uint8ArrayAlloc(0), + rlnIdentifier: uint8ArrayAlloc(0) } const end = length == null ? reader.len : reader.pos + length @@ -293,30 +303,38 @@ export namespace RateLimitProof { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.proof = reader.bytes() break - case 2: + } + case 2: { obj.merkleRoot = reader.bytes() break - case 3: + } + case 3: { obj.epoch = reader.bytes() break - case 4: + } + case 4: { obj.shareX = reader.bytes() break - case 5: + } + case 5: { obj.shareY = reader.bytes() break - case 6: + } + case 6: { obj.nullifier = reader.bytes() break - case 7: + } + case 7: { obj.rlnIdentifier = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -396,7 +414,7 @@ export namespace WakuMessage { } }, (reader, length) => { const obj: any = { - payload: new Uint8Array(0), + payload: uint8ArrayAlloc(0), contentTopic: '' } @@ -406,30 +424,38 @@ export namespace WakuMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.payload = reader.bytes() break - case 2: + } + case 2: { obj.contentTopic = reader.string() break - case 3: + } + case 3: { obj.version = reader.uint32() break - case 10: + } + case 10: { obj.timestamp = reader.sint64() break - case 11: + } + case 11: { obj.meta = reader.bytes() break - case 21: + } + case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32()) break - case 31: + } + case 31: { obj.ephemeral = reader.bool() break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/message.ts b/packages/proto/src/lib/message.ts index 79dbf66c2b..9bf8ec4117 100644 --- a/packages/proto/src/lib/message.ts +++ b/packages/proto/src/lib/message.ts @@ -4,8 +4,8 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' +import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc' import type { Uint8ArrayList } from 'uint8arraylist' export interface RateLimitProof { @@ -68,13 +68,13 @@ export namespace RateLimitProof { } }, (reader, length) => { const obj: any = { - proof: new Uint8Array(0), - merkleRoot: new Uint8Array(0), - epoch: new Uint8Array(0), - shareX: new Uint8Array(0), - shareY: new Uint8Array(0), - nullifier: new Uint8Array(0), - rlnIdentifier: new Uint8Array(0) + proof: uint8ArrayAlloc(0), + merkleRoot: uint8ArrayAlloc(0), + epoch: uint8ArrayAlloc(0), + shareX: uint8ArrayAlloc(0), + shareY: uint8ArrayAlloc(0), + nullifier: uint8ArrayAlloc(0), + rlnIdentifier: uint8ArrayAlloc(0) } const end = length == null ? reader.len : reader.pos + length @@ -83,30 +83,38 @@ export namespace RateLimitProof { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.proof = reader.bytes() break - case 2: + } + case 2: { obj.merkleRoot = reader.bytes() break - case 3: + } + case 3: { obj.epoch = reader.bytes() break - case 4: + } + case 4: { obj.shareX = reader.bytes() break - case 5: + } + case 5: { obj.shareY = reader.bytes() break - case 6: + } + case 6: { obj.nullifier = reader.bytes() break - case 7: + } + case 7: { obj.rlnIdentifier = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -186,7 +194,7 @@ export namespace WakuMessage { } }, (reader, length) => { const obj: any = { - payload: new Uint8Array(0), + payload: uint8ArrayAlloc(0), contentTopic: '' } @@ -196,30 +204,38 @@ export namespace WakuMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.payload = reader.bytes() break - case 2: + } + case 2: { obj.contentTopic = reader.string() break - case 3: + } + case 3: { obj.version = reader.uint32() break - case 10: + } + case 10: { obj.timestamp = reader.sint64() break - case 11: + } + case 11: { obj.meta = reader.bytes() break - case 21: + } + case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32()) break - case 31: + } + case 31: { obj.ephemeral = reader.bool() break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/metadata.ts b/packages/proto/src/lib/metadata.ts index edb8994baa..6bf54e54d4 100644 --- a/packages/proto/src/lib/metadata.ts +++ b/packages/proto/src/lib/metadata.ts @@ -4,8 +4,7 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' import type { Uint8ArrayList } from 'uint8arraylist' export interface WakuMetadataRequest { @@ -49,15 +48,18 @@ export namespace WakuMetadataRequest { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.clusterId = reader.uint32() break - case 2: + } + case 2: { obj.shards.push(reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -118,15 +120,18 @@ export namespace WakuMetadataResponse { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.clusterId = reader.uint32() break - case 2: + } + case 2: { obj.shards.push(reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/peer_exchange.ts b/packages/proto/src/lib/peer_exchange.ts index f3c90afdba..eb32079967 100644 --- a/packages/proto/src/lib/peer_exchange.ts +++ b/packages/proto/src/lib/peer_exchange.ts @@ -4,8 +4,7 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' import type { Uint8ArrayList } from 'uint8arraylist' export interface PeerInfo { @@ -39,12 +38,14 @@ export namespace PeerInfo { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.enr = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -95,12 +96,14 @@ export namespace PeerExchangeQuery { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.numPeers = reader.uint64() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -155,12 +158,14 @@ export namespace PeerExchangeResponse { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.peerInfos.push(PeerInfo.codec().decode(reader, reader.uint32())) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -217,15 +222,18 @@ export namespace PeerExchangeRPC { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.query = PeerExchangeQuery.codec().decode(reader, reader.uint32()) break - case 2: + } + case 2: { obj.response = PeerExchangeResponse.codec().decode(reader, reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/store.ts b/packages/proto/src/lib/store.ts index 30ca5b589a..1b3bb0abdd 100644 --- a/packages/proto/src/lib/store.ts +++ b/packages/proto/src/lib/store.ts @@ -4,8 +4,8 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message, enumeration } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, enumeration, message } from 'protons-runtime' +import { alloc as uint8ArrayAlloc } from 'uint8arrays/alloc' import type { Uint8ArrayList } from 'uint8arraylist' export interface Index { @@ -50,7 +50,7 @@ export namespace Index { } }, (reader, length) => { const obj: any = { - digest: new Uint8Array(0), + digest: uint8ArrayAlloc(0), receiverTime: 0n, senderTime: 0n, pubsubTopic: '' @@ -62,21 +62,26 @@ export namespace Index { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.digest = reader.bytes() break - case 2: + } + case 2: { obj.receiverTime = reader.sint64() break - case 3: + } + case 3: { obj.senderTime = reader.sint64() break - case 4: + } + case 4: { obj.pubsubTopic = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -155,18 +160,22 @@ export namespace PagingInfo { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.pageSize = reader.uint64() break - case 2: + } + case 2: { obj.cursor = Index.codec().decode(reader, reader.uint32()) break - case 3: + } + case 3: { obj.direction = PagingInfo.Direction.codec().decode(reader) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -219,12 +228,14 @@ export namespace ContentFilter { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.contentTopic = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -303,24 +314,30 @@ export namespace HistoryQuery { const tag = reader.uint32() switch (tag >>> 3) { - case 2: + case 2: { obj.pubsubTopic = reader.string() break - case 3: + } + case 3: { obj.contentFilters.push(ContentFilter.codec().decode(reader, reader.uint32())) break - case 4: + } + case 4: { obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32()) break - case 5: + } + case 5: { obj.startTime = reader.sint64() break - case 6: + } + case 6: { obj.endTime = reader.sint64() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -404,18 +421,22 @@ export namespace HistoryResponse { const tag = reader.uint32() switch (tag >>> 3) { - case 2: + case 2: { obj.messages.push(WakuMessage.codec().decode(reader, reader.uint32())) break - case 3: + } + case 3: { obj.pagingInfo = PagingInfo.codec().decode(reader, reader.uint32()) break - case 4: + } + case 4: { obj.error = HistoryResponse.HistoryError.codec().decode(reader) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -480,18 +501,22 @@ export namespace HistoryRpc { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.requestId = reader.string() break - case 2: + } + case 2: { obj.query = HistoryQuery.codec().decode(reader, reader.uint32()) break - case 3: + } + case 3: { obj.response = HistoryResponse.codec().decode(reader, reader.uint32()) break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -571,13 +596,13 @@ export namespace RateLimitProof { } }, (reader, length) => { const obj: any = { - proof: new Uint8Array(0), - merkleRoot: new Uint8Array(0), - epoch: new Uint8Array(0), - shareX: new Uint8Array(0), - shareY: new Uint8Array(0), - nullifier: new Uint8Array(0), - rlnIdentifier: new Uint8Array(0) + proof: uint8ArrayAlloc(0), + merkleRoot: uint8ArrayAlloc(0), + epoch: uint8ArrayAlloc(0), + shareX: uint8ArrayAlloc(0), + shareY: uint8ArrayAlloc(0), + nullifier: uint8ArrayAlloc(0), + rlnIdentifier: uint8ArrayAlloc(0) } const end = length == null ? reader.len : reader.pos + length @@ -586,30 +611,38 @@ export namespace RateLimitProof { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.proof = reader.bytes() break - case 2: + } + case 2: { obj.merkleRoot = reader.bytes() break - case 3: + } + case 3: { obj.epoch = reader.bytes() break - case 4: + } + case 4: { obj.shareX = reader.bytes() break - case 5: + } + case 5: { obj.shareY = reader.bytes() break - case 6: + } + case 6: { obj.nullifier = reader.bytes() break - case 7: + } + case 7: { obj.rlnIdentifier = reader.bytes() break - default: + } + default: { reader.skipType(tag & 7) break + } } } @@ -689,7 +722,7 @@ export namespace WakuMessage { } }, (reader, length) => { const obj: any = { - payload: new Uint8Array(0), + payload: uint8ArrayAlloc(0), contentTopic: '' } @@ -699,30 +732,38 @@ export namespace WakuMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 1: + case 1: { obj.payload = reader.bytes() break - case 2: + } + case 2: { obj.contentTopic = reader.string() break - case 3: + } + case 3: { obj.version = reader.uint32() break - case 10: + } + case 10: { obj.timestamp = reader.sint64() break - case 11: + } + case 11: { obj.meta = reader.bytes() break - case 21: + } + case 21: { obj.rateLimitProof = RateLimitProof.codec().decode(reader, reader.uint32()) break - case 31: + } + case 31: { obj.ephemeral = reader.bool() break - default: + } + default: { reader.skipType(tag & 7) break + } } } diff --git a/packages/proto/src/lib/topic_only_message.ts b/packages/proto/src/lib/topic_only_message.ts index 90641ccd4f..42a67615e1 100644 --- a/packages/proto/src/lib/topic_only_message.ts +++ b/packages/proto/src/lib/topic_only_message.ts @@ -4,8 +4,7 @@ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ /* eslint-disable @typescript-eslint/no-empty-interface */ -import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Codec } from 'protons-runtime' +import { type Codec, decodeMessage, encodeMessage, message } from 'protons-runtime' import type { Uint8ArrayList } from 'uint8arraylist' export interface TopicOnlyMessage { @@ -41,12 +40,14 @@ export namespace TopicOnlyMessage { const tag = reader.uint32() switch (tag >>> 3) { - case 2: + case 2: { obj.contentTopic = reader.string() break - default: + } + default: { reader.skipType(tag & 7) break + } } }