Merge pull request #971 from waku-org/feat/ratelimitproof

This commit is contained in:
fryorcraken.eth 2022-09-26 10:10:23 +10:00 committed by GitHub
commit 5bab85f93f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 942 additions and 0 deletions

View File

@ -52,6 +52,7 @@
"libp", "libp",
"lightpush", "lightpush",
"livechat", "livechat",
"Merkle",
"mkdir", "mkdir",
"multiaddr", "multiaddr",
"multiaddresses", "multiaddresses",

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- `RateLimitProof` field in Waku Message protobuf for RLN.
## [0.29.0] - 2022-09-21 ## [0.29.0] - 2022-09-21
### Changed ### Changed

View File

@ -51,17 +51,28 @@ export interface WakuFull extends Waku {
lightPush: WakuLightPush; lightPush: WakuLightPush;
} }
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export interface ProtoMessage { export interface ProtoMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export interface Message { export interface Message {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
timestamp?: Date; timestamp?: Date;
rateLimitProof?: RateLimitProof;
} }
export interface Encoder { export interface Encoder {

View File

@ -303,12 +303,184 @@ export namespace FilterRPC {
}; };
} }
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>;
export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) {
_codec = message<RateLimitProof>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.proof != null) {
writer.uint32(10);
writer.bytes(obj.proof);
} else {
throw new Error(
'Protocol error: required field "proof" was not found in object'
);
}
if (obj.merkleRoot != null) {
writer.uint32(18);
writer.bytes(obj.merkleRoot);
} else {
throw new Error(
'Protocol error: required field "merkleRoot" was not found in object'
);
}
if (obj.epoch != null) {
writer.uint32(26);
writer.bytes(obj.epoch);
} else {
throw new Error(
'Protocol error: required field "epoch" was not found in object'
);
}
if (obj.shareX != null) {
writer.uint32(34);
writer.bytes(obj.shareX);
} else {
throw new Error(
'Protocol error: required field "shareX" was not found in object'
);
}
if (obj.shareY != null) {
writer.uint32(42);
writer.bytes(obj.shareY);
} else {
throw new Error(
'Protocol error: required field "shareY" was not found in object'
);
}
if (obj.nullifier != null) {
writer.uint32(50);
writer.bytes(obj.nullifier);
} else {
throw new Error(
'Protocol error: required field "nullifier" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(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),
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (obj.proof == null) {
throw new Error(
'Protocol error: value for required field "proof" was not found in protobuf'
);
}
if (obj.merkleRoot == null) {
throw new Error(
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
);
}
if (obj.epoch == null) {
throw new Error(
'Protocol error: value for required field "epoch" was not found in protobuf'
);
}
if (obj.shareX == null) {
throw new Error(
'Protocol error: value for required field "shareX" was not found in protobuf'
);
}
if (obj.shareY == null) {
throw new Error(
'Protocol error: value for required field "shareY" was not found in protobuf'
);
}
if (obj.nullifier == null) {
throw new Error(
'Protocol error: value for required field "nullifier" was not found in protobuf'
);
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: RateLimitProof): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec());
};
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec());
};
}
export interface WakuMessage { export interface WakuMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestampDeprecated?: number; timestampDeprecated?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export namespace WakuMessage { export namespace WakuMessage {
@ -347,6 +519,11 @@ export namespace WakuMessage {
writer.sint64(obj.timestamp); writer.sint64(obj.timestamp);
} }
if (obj.rateLimitProof != null) {
writer.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
}
if (opts.lengthDelimited !== false) { if (opts.lengthDelimited !== false) {
writer.ldelim(); writer.ldelim();
} }
@ -375,6 +552,12 @@ export namespace WakuMessage {
case 10: case 10:
obj.timestamp = reader.sint64(); obj.timestamp = reader.sint64();
break; break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;

View File

@ -227,12 +227,184 @@ export namespace PushRPC {
}; };
} }
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>;
export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) {
_codec = message<RateLimitProof>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.proof != null) {
writer.uint32(10);
writer.bytes(obj.proof);
} else {
throw new Error(
'Protocol error: required field "proof" was not found in object'
);
}
if (obj.merkleRoot != null) {
writer.uint32(18);
writer.bytes(obj.merkleRoot);
} else {
throw new Error(
'Protocol error: required field "merkleRoot" was not found in object'
);
}
if (obj.epoch != null) {
writer.uint32(26);
writer.bytes(obj.epoch);
} else {
throw new Error(
'Protocol error: required field "epoch" was not found in object'
);
}
if (obj.shareX != null) {
writer.uint32(34);
writer.bytes(obj.shareX);
} else {
throw new Error(
'Protocol error: required field "shareX" was not found in object'
);
}
if (obj.shareY != null) {
writer.uint32(42);
writer.bytes(obj.shareY);
} else {
throw new Error(
'Protocol error: required field "shareY" was not found in object'
);
}
if (obj.nullifier != null) {
writer.uint32(50);
writer.bytes(obj.nullifier);
} else {
throw new Error(
'Protocol error: required field "nullifier" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(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),
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (obj.proof == null) {
throw new Error(
'Protocol error: value for required field "proof" was not found in protobuf'
);
}
if (obj.merkleRoot == null) {
throw new Error(
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
);
}
if (obj.epoch == null) {
throw new Error(
'Protocol error: value for required field "epoch" was not found in protobuf'
);
}
if (obj.shareX == null) {
throw new Error(
'Protocol error: value for required field "shareX" was not found in protobuf'
);
}
if (obj.shareY == null) {
throw new Error(
'Protocol error: value for required field "shareY" was not found in protobuf'
);
}
if (obj.nullifier == null) {
throw new Error(
'Protocol error: value for required field "nullifier" was not found in protobuf'
);
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: RateLimitProof): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec());
};
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec());
};
}
export interface WakuMessage { export interface WakuMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestampDeprecated?: number; timestampDeprecated?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export namespace WakuMessage { export namespace WakuMessage {
@ -271,6 +443,11 @@ export namespace WakuMessage {
writer.sint64(obj.timestamp); writer.sint64(obj.timestamp);
} }
if (obj.rateLimitProof != null) {
writer.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
}
if (opts.lengthDelimited !== false) { if (opts.lengthDelimited !== false) {
writer.ldelim(); writer.ldelim();
} }
@ -299,6 +476,12 @@ export namespace WakuMessage {
case 10: case 10:
obj.timestamp = reader.sint64(); obj.timestamp = reader.sint64();
break; break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;

View File

@ -1,9 +1,20 @@
syntax = "proto3"; syntax = "proto3";
message RateLimitProof {
bytes proof = 1;
bytes merkle_root = 2;
bytes epoch = 3;
bytes share_x = 4;
bytes share_y = 5;
bytes nullifier = 6;
}
message WakuMessage { message WakuMessage {
optional bytes payload = 1; optional bytes payload = 1;
optional string content_topic = 2; optional string content_topic = 2;
optional uint32 version = 3; optional uint32 version = 3;
optional double timestamp_deprecated = 4; optional double timestamp_deprecated = 4;
optional sint64 timestamp = 10; optional sint64 timestamp = 10;
optional RateLimitProof rate_limit_proof = 21;
} }

View File

@ -5,12 +5,184 @@ import { encodeMessage, decodeMessage, message } from "protons-runtime";
import type { Uint8ArrayList } from "uint8arraylist"; import type { Uint8ArrayList } from "uint8arraylist";
import type { Codec } from "protons-runtime"; import type { Codec } from "protons-runtime";
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>;
export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) {
_codec = message<RateLimitProof>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.proof != null) {
writer.uint32(10);
writer.bytes(obj.proof);
} else {
throw new Error(
'Protocol error: required field "proof" was not found in object'
);
}
if (obj.merkleRoot != null) {
writer.uint32(18);
writer.bytes(obj.merkleRoot);
} else {
throw new Error(
'Protocol error: required field "merkleRoot" was not found in object'
);
}
if (obj.epoch != null) {
writer.uint32(26);
writer.bytes(obj.epoch);
} else {
throw new Error(
'Protocol error: required field "epoch" was not found in object'
);
}
if (obj.shareX != null) {
writer.uint32(34);
writer.bytes(obj.shareX);
} else {
throw new Error(
'Protocol error: required field "shareX" was not found in object'
);
}
if (obj.shareY != null) {
writer.uint32(42);
writer.bytes(obj.shareY);
} else {
throw new Error(
'Protocol error: required field "shareY" was not found in object'
);
}
if (obj.nullifier != null) {
writer.uint32(50);
writer.bytes(obj.nullifier);
} else {
throw new Error(
'Protocol error: required field "nullifier" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(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),
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (obj.proof == null) {
throw new Error(
'Protocol error: value for required field "proof" was not found in protobuf'
);
}
if (obj.merkleRoot == null) {
throw new Error(
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
);
}
if (obj.epoch == null) {
throw new Error(
'Protocol error: value for required field "epoch" was not found in protobuf'
);
}
if (obj.shareX == null) {
throw new Error(
'Protocol error: value for required field "shareX" was not found in protobuf'
);
}
if (obj.shareY == null) {
throw new Error(
'Protocol error: value for required field "shareY" was not found in protobuf'
);
}
if (obj.nullifier == null) {
throw new Error(
'Protocol error: value for required field "nullifier" was not found in protobuf'
);
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: RateLimitProof): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec());
};
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec());
};
}
export interface WakuMessage { export interface WakuMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestampDeprecated?: number; timestampDeprecated?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export namespace WakuMessage { export namespace WakuMessage {
@ -49,6 +221,11 @@ export namespace WakuMessage {
writer.sint64(obj.timestamp); writer.sint64(obj.timestamp);
} }
if (obj.rateLimitProof != null) {
writer.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
}
if (opts.lengthDelimited !== false) { if (opts.lengthDelimited !== false) {
writer.ldelim(); writer.ldelim();
} }
@ -77,6 +254,12 @@ export namespace WakuMessage {
case 10: case 10:
obj.timestamp = reader.sint64(); obj.timestamp = reader.sint64();
break; break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;

View File

@ -536,12 +536,184 @@ export namespace HistoryRPC {
}; };
} }
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>;
export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) {
_codec = message<RateLimitProof>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.proof != null) {
writer.uint32(10);
writer.bytes(obj.proof);
} else {
throw new Error(
'Protocol error: required field "proof" was not found in object'
);
}
if (obj.merkleRoot != null) {
writer.uint32(18);
writer.bytes(obj.merkleRoot);
} else {
throw new Error(
'Protocol error: required field "merkleRoot" was not found in object'
);
}
if (obj.epoch != null) {
writer.uint32(26);
writer.bytes(obj.epoch);
} else {
throw new Error(
'Protocol error: required field "epoch" was not found in object'
);
}
if (obj.shareX != null) {
writer.uint32(34);
writer.bytes(obj.shareX);
} else {
throw new Error(
'Protocol error: required field "shareX" was not found in object'
);
}
if (obj.shareY != null) {
writer.uint32(42);
writer.bytes(obj.shareY);
} else {
throw new Error(
'Protocol error: required field "shareY" was not found in object'
);
}
if (obj.nullifier != null) {
writer.uint32(50);
writer.bytes(obj.nullifier);
} else {
throw new Error(
'Protocol error: required field "nullifier" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(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),
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (obj.proof == null) {
throw new Error(
'Protocol error: value for required field "proof" was not found in protobuf'
);
}
if (obj.merkleRoot == null) {
throw new Error(
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
);
}
if (obj.epoch == null) {
throw new Error(
'Protocol error: value for required field "epoch" was not found in protobuf'
);
}
if (obj.shareX == null) {
throw new Error(
'Protocol error: value for required field "shareX" was not found in protobuf'
);
}
if (obj.shareY == null) {
throw new Error(
'Protocol error: value for required field "shareY" was not found in protobuf'
);
}
if (obj.nullifier == null) {
throw new Error(
'Protocol error: value for required field "nullifier" was not found in protobuf'
);
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: RateLimitProof): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec());
};
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec());
};
}
export interface WakuMessage { export interface WakuMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestampDeprecated?: number; timestampDeprecated?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export namespace WakuMessage { export namespace WakuMessage {
@ -580,6 +752,11 @@ export namespace WakuMessage {
writer.sint64(obj.timestamp); writer.sint64(obj.timestamp);
} }
if (obj.rateLimitProof != null) {
writer.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
}
if (opts.lengthDelimited !== false) { if (opts.lengthDelimited !== false) {
writer.ldelim(); writer.ldelim();
} }
@ -608,6 +785,12 @@ export namespace WakuMessage {
case 10: case 10:
obj.timestamp = reader.sint64(); obj.timestamp = reader.sint64();
break; break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;

View File

@ -545,12 +545,184 @@ export namespace HistoryRPC {
}; };
} }
export interface RateLimitProof {
proof: Uint8Array;
merkleRoot: Uint8Array;
epoch: Uint8Array;
shareX: Uint8Array;
shareY: Uint8Array;
nullifier: Uint8Array;
}
export namespace RateLimitProof {
let _codec: Codec<RateLimitProof>;
export const codec = (): Codec<RateLimitProof> => {
if (_codec == null) {
_codec = message<RateLimitProof>(
(obj, writer, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
}
if (obj.proof != null) {
writer.uint32(10);
writer.bytes(obj.proof);
} else {
throw new Error(
'Protocol error: required field "proof" was not found in object'
);
}
if (obj.merkleRoot != null) {
writer.uint32(18);
writer.bytes(obj.merkleRoot);
} else {
throw new Error(
'Protocol error: required field "merkleRoot" was not found in object'
);
}
if (obj.epoch != null) {
writer.uint32(26);
writer.bytes(obj.epoch);
} else {
throw new Error(
'Protocol error: required field "epoch" was not found in object'
);
}
if (obj.shareX != null) {
writer.uint32(34);
writer.bytes(obj.shareX);
} else {
throw new Error(
'Protocol error: required field "shareX" was not found in object'
);
}
if (obj.shareY != null) {
writer.uint32(42);
writer.bytes(obj.shareY);
} else {
throw new Error(
'Protocol error: required field "shareY" was not found in object'
);
}
if (obj.nullifier != null) {
writer.uint32(50);
writer.bytes(obj.nullifier);
} else {
throw new Error(
'Protocol error: required field "nullifier" was not found in object'
);
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
}
},
(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),
};
const end = length == null ? reader.len : reader.pos + length;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
obj.proof = reader.bytes();
break;
case 2:
obj.merkleRoot = reader.bytes();
break;
case 3:
obj.epoch = reader.bytes();
break;
case 4:
obj.shareX = reader.bytes();
break;
case 5:
obj.shareY = reader.bytes();
break;
case 6:
obj.nullifier = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
if (obj.proof == null) {
throw new Error(
'Protocol error: value for required field "proof" was not found in protobuf'
);
}
if (obj.merkleRoot == null) {
throw new Error(
'Protocol error: value for required field "merkleRoot" was not found in protobuf'
);
}
if (obj.epoch == null) {
throw new Error(
'Protocol error: value for required field "epoch" was not found in protobuf'
);
}
if (obj.shareX == null) {
throw new Error(
'Protocol error: value for required field "shareX" was not found in protobuf'
);
}
if (obj.shareY == null) {
throw new Error(
'Protocol error: value for required field "shareY" was not found in protobuf'
);
}
if (obj.nullifier == null) {
throw new Error(
'Protocol error: value for required field "nullifier" was not found in protobuf'
);
}
return obj;
}
);
}
return _codec;
};
export const encode = (obj: RateLimitProof): Uint8Array => {
return encodeMessage(obj, RateLimitProof.codec());
};
export const decode = (buf: Uint8Array | Uint8ArrayList): RateLimitProof => {
return decodeMessage(buf, RateLimitProof.codec());
};
}
export interface WakuMessage { export interface WakuMessage {
payload?: Uint8Array; payload?: Uint8Array;
contentTopic?: string; contentTopic?: string;
version?: number; version?: number;
timestampDeprecated?: number; timestampDeprecated?: number;
timestamp?: bigint; timestamp?: bigint;
rateLimitProof?: RateLimitProof;
} }
export namespace WakuMessage { export namespace WakuMessage {
@ -589,6 +761,11 @@ export namespace WakuMessage {
writer.sint64(obj.timestamp); writer.sint64(obj.timestamp);
} }
if (obj.rateLimitProof != null) {
writer.uint32(170);
RateLimitProof.codec().encode(obj.rateLimitProof, writer);
}
if (opts.lengthDelimited !== false) { if (opts.lengthDelimited !== false) {
writer.ldelim(); writer.ldelim();
} }
@ -617,6 +794,12 @@ export namespace WakuMessage {
case 10: case 10:
obj.timestamp = reader.sint64(); obj.timestamp = reader.sint64();
break; break;
case 21:
obj.rateLimitProof = RateLimitProof.codec().decode(
reader,
reader.uint32()
);
break;
default: default:
reader.skipType(tag & 7); reader.skipType(tag & 7);
break; break;