mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-06 15:53:09 +00:00
feat!: remove version from decoder
Phased out of the removal of `version`. Do not read it anymore. `version` is used for encryption purposes, it is not a routing concern and hence should not be set on the Waku Message (which itself is a routing artefact)
This commit is contained in:
parent
4d5c152f5b
commit
ec8cacb7e3
@ -536,7 +536,6 @@ test.describe("Waku Server API", () => {
|
|||||||
expect(message).toHaveProperty("payload");
|
expect(message).toHaveProperty("payload");
|
||||||
expect(message).toHaveProperty("contentTopic");
|
expect(message).toHaveProperty("contentTopic");
|
||||||
expect(message).toHaveProperty("timestamp");
|
expect(message).toHaveProperty("timestamp");
|
||||||
expect(message).toHaveProperty("version");
|
|
||||||
|
|
||||||
// Test pagination
|
// Test pagination
|
||||||
const paginatedResponse = await axios.get(
|
const paginatedResponse = await axios.get(
|
||||||
|
|||||||
@ -23,7 +23,7 @@ const testRoutingInfo = createRoutingInfo(testNetworkConfig, {
|
|||||||
contentTopic: testContentTopic
|
contentTopic: testContentTopic
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Waku Message version 0", function () {
|
describe("Waku Message", function () {
|
||||||
it("Round trip binary serialization", async function () {
|
it("Round trip binary serialization", async function () {
|
||||||
await fc.assert(
|
await fc.assert(
|
||||||
fc.asyncProperty(fc.uint8Array({ minLength: 1 }), async (payload) => {
|
fc.asyncProperty(fc.uint8Array({ minLength: 1 }), async (payload) => {
|
||||||
@ -41,7 +41,6 @@ describe("Waku Message version 0", function () {
|
|||||||
|
|
||||||
expect(result.contentTopic).to.eq(testContentTopic);
|
expect(result.contentTopic).to.eq(testContentTopic);
|
||||||
expect(result.pubsubTopic).to.eq(testRoutingInfo.pubsubTopic);
|
expect(result.pubsubTopic).to.eq(testRoutingInfo.pubsubTopic);
|
||||||
expect(result.version).to.eq(0);
|
|
||||||
expect(result.ephemeral).to.be.false;
|
expect(result.ephemeral).to.be.false;
|
||||||
expect(result.payload).to.deep.eq(payload);
|
expect(result.payload).to.deep.eq(payload);
|
||||||
expect(result.timestamp).to.not.be.undefined;
|
expect(result.timestamp).to.not.be.undefined;
|
||||||
|
|||||||
@ -76,12 +76,6 @@ export class DecodedMessage implements IDecodedMessage {
|
|||||||
return this.proto.meta;
|
return this.proto.meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get version(): number {
|
|
||||||
// https://rfc.vac.dev/spec/14/
|
|
||||||
// > If omitted, the value SHOULD be interpreted as version 0.
|
|
||||||
return this.proto.version ?? Version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get rateLimitProof(): IRateLimitProof | undefined {
|
public get rateLimitProof(): IRateLimitProof | undefined {
|
||||||
return this.proto.rateLimitProof;
|
return this.proto.rateLimitProof;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,6 @@ describe("to proto message", () => {
|
|||||||
const keys = Object.keys(protoMessage);
|
const keys = Object.keys(protoMessage);
|
||||||
expect(keys).to.contain("payload");
|
expect(keys).to.contain("payload");
|
||||||
expect(keys).to.contain("contentTopic");
|
expect(keys).to.contain("contentTopic");
|
||||||
expect(keys).to.contain("version");
|
|
||||||
expect(keys).to.contain("timestamp");
|
expect(keys).to.contain("timestamp");
|
||||||
expect(keys).to.contain("rateLimitProof");
|
expect(keys).to.contain("rateLimitProof");
|
||||||
expect(keys).to.contain("ephemeral");
|
expect(keys).to.contain("ephemeral");
|
||||||
|
|||||||
@ -12,7 +12,6 @@ export interface IRateLimitProof {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IDecodedMessage {
|
export interface IDecodedMessage {
|
||||||
version: number;
|
|
||||||
payload: Uint8Array;
|
payload: Uint8Array;
|
||||||
contentTopic: ContentTopic;
|
contentTopic: ContentTopic;
|
||||||
pubsubTopic: PubsubTopic;
|
pubsubTopic: PubsubTopic;
|
||||||
|
|||||||
@ -47,7 +47,6 @@ describe("Ecies Encryption", function () {
|
|||||||
|
|
||||||
expect(result.contentTopic).to.equal(testContentTopic);
|
expect(result.contentTopic).to.equal(testContentTopic);
|
||||||
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
||||||
expect(result.version).to.equal(1);
|
|
||||||
expect(result?.payload).to.deep.equal(payload);
|
expect(result?.payload).to.deep.equal(payload);
|
||||||
expect(result.signature).to.be.undefined;
|
expect(result.signature).to.be.undefined;
|
||||||
expect(result.verifySignature(new Uint8Array())).to.be.false;
|
expect(result.verifySignature(new Uint8Array())).to.be.false;
|
||||||
@ -92,7 +91,6 @@ describe("Ecies Encryption", function () {
|
|||||||
|
|
||||||
expect(result.contentTopic).to.equal(testContentTopic);
|
expect(result.contentTopic).to.equal(testContentTopic);
|
||||||
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
||||||
expect(result.version).to.equal(1);
|
|
||||||
expect(result?.payload).to.deep.equal(payload);
|
expect(result?.payload).to.deep.equal(payload);
|
||||||
expect(result.signature).to.not.be.undefined;
|
expect(result.signature).to.not.be.undefined;
|
||||||
expect(result.verifySignature(alicePublicKey)).to.be.true;
|
expect(result.verifySignature(alicePublicKey)).to.be.true;
|
||||||
|
|||||||
@ -137,16 +137,6 @@ class Decoder extends DecoderV0 implements IDecoder<IEncryptedMessage> {
|
|||||||
): Promise<IEncryptedMessage | undefined> {
|
): Promise<IEncryptedMessage | undefined> {
|
||||||
const cipherPayload = protoMessage.payload;
|
const cipherPayload = protoMessage.payload;
|
||||||
|
|
||||||
if (protoMessage.version !== Version) {
|
|
||||||
log.error(
|
|
||||||
"Failed to decrypt due to incorrect version, expected:",
|
|
||||||
Version,
|
|
||||||
", actual:",
|
|
||||||
protoMessage.version
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let payload;
|
let payload;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -44,7 +44,6 @@ describe("Symmetric Encryption", function () {
|
|||||||
|
|
||||||
expect(result.contentTopic).to.equal(testContentTopic);
|
expect(result.contentTopic).to.equal(testContentTopic);
|
||||||
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
||||||
expect(result.version).to.equal(1);
|
|
||||||
expect(result?.payload).to.deep.equal(payload);
|
expect(result?.payload).to.deep.equal(payload);
|
||||||
expect(result.signature).to.be.undefined;
|
expect(result.signature).to.be.undefined;
|
||||||
expect(result.verifySignature(new Uint8Array())).to.be.false;
|
expect(result.verifySignature(new Uint8Array())).to.be.false;
|
||||||
@ -86,7 +85,6 @@ describe("Symmetric Encryption", function () {
|
|||||||
|
|
||||||
expect(result.contentTopic).to.equal(testContentTopic);
|
expect(result.contentTopic).to.equal(testContentTopic);
|
||||||
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
expect(result.pubsubTopic).to.equal(testRoutingInfo.pubsubTopic);
|
||||||
expect(result.version).to.equal(1);
|
|
||||||
expect(result?.payload).to.deep.equal(payload);
|
expect(result?.payload).to.deep.equal(payload);
|
||||||
expect(result.signature).to.not.be.undefined;
|
expect(result.signature).to.not.be.undefined;
|
||||||
expect(result.verifySignature(sigPubKey)).to.be.true;
|
expect(result.verifySignature(sigPubKey)).to.be.true;
|
||||||
|
|||||||
@ -137,16 +137,6 @@ class Decoder extends DecoderV0 implements IDecoder<IEncryptedMessage> {
|
|||||||
): Promise<IEncryptedMessage | undefined> {
|
): Promise<IEncryptedMessage | undefined> {
|
||||||
const cipherPayload = protoMessage.payload;
|
const cipherPayload = protoMessage.payload;
|
||||||
|
|
||||||
if (protoMessage.version !== Version) {
|
|
||||||
log.error(
|
|
||||||
"Failed to decrypt due to incorrect version, expected:",
|
|
||||||
Version,
|
|
||||||
", actual:",
|
|
||||||
protoMessage.version
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let payload;
|
let payload;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -63,7 +63,7 @@ describe("RLN codec with version 0", () => {
|
|||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toProtoObj", async function () {
|
it("toProtoObj", async function () {
|
||||||
@ -92,7 +92,7 @@ describe("RLN codec with version 0", () => {
|
|||||||
proto!
|
proto!
|
||||||
)) as RlnMessage<IDecodedMessage>;
|
)) as RlnMessage<IDecodedMessage>;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ describe("RLN codec with version 1", () => {
|
|||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Symmetric, toProtoObj", async function () {
|
it("Symmetric, toProtoObj", async function () {
|
||||||
@ -166,7 +166,7 @@ describe("RLN codec with version 1", () => {
|
|||||||
proto!
|
proto!
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Asymmetric, toWire", async function () {
|
it("Asymmetric, toWire", async function () {
|
||||||
@ -204,7 +204,7 @@ describe("RLN codec with version 1", () => {
|
|||||||
protoResult!
|
protoResult!
|
||||||
))!;
|
))!;
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Asymmetric, toProtoObj", async function () {
|
it("Asymmetric, toProtoObj", async function () {
|
||||||
@ -240,7 +240,7 @@ describe("RLN codec with version 1", () => {
|
|||||||
proto!
|
proto!
|
||||||
);
|
);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 1, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ describe("RLN Codec - epoch", () => {
|
|||||||
expect(msg.epoch!.toString(10).length).to.eq(9);
|
expect(msg.epoch!.toString(10).length).to.eq(9);
|
||||||
expect(msg.epoch).to.eq(epoch);
|
expect(msg.epoch).to.eq(epoch);
|
||||||
|
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(msg!.meta).to.deep.eq(expectedMeta);
|
expect(msg!.meta).to.deep.eq(expectedMeta);
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("toProtoObj", async function () {
|
it("toProtoObj", async function () {
|
||||||
@ -358,6 +358,6 @@ describe("RLN codec with version 0 and meta setter", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(msg!.meta).to.deep.eq(expectedMeta);
|
expect(msg!.meta).to.deep.eq(expectedMeta);
|
||||||
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, 0, rlnInstance);
|
verifyRLNMessage(msg, payload, TEST_CONSTANTS.contentTopic, rlnInstance);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -72,7 +72,6 @@ export function verifyRLNMessage(
|
|||||||
msg: any,
|
msg: any,
|
||||||
payload: Uint8Array,
|
payload: Uint8Array,
|
||||||
contentTopic: string,
|
contentTopic: string,
|
||||||
version: number,
|
|
||||||
rlnInstance: any
|
rlnInstance: any
|
||||||
): void {
|
): void {
|
||||||
expect(msg.rateLimitProof).to.not.be.undefined;
|
expect(msg.rateLimitProof).to.not.be.undefined;
|
||||||
@ -82,7 +81,6 @@ export function verifyRLNMessage(
|
|||||||
expect(msg.epoch).to.be.gt(0);
|
expect(msg.epoch).to.be.gt(0);
|
||||||
|
|
||||||
expect(msg.contentTopic).to.eq(contentTopic);
|
expect(msg.contentTopic).to.eq(contentTopic);
|
||||||
expect(msg.msg.version).to.eq(version);
|
|
||||||
expect(msg.payload).to.deep.eq(payload);
|
expect(msg.payload).to.deep.eq(payload);
|
||||||
expect(msg.timestamp).to.not.be.undefined;
|
expect(msg.timestamp).to.not.be.undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,6 @@ describe("QueryOnConnect", () => {
|
|||||||
(async function* () {
|
(async function* () {
|
||||||
yield [
|
yield [
|
||||||
Promise.resolve({
|
Promise.resolve({
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/1/content",
|
contentTopic: "/test/1/content",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -255,7 +254,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage: IDecodedMessage = {
|
const mockMessage: IDecodedMessage = {
|
||||||
hash: new Uint8Array(),
|
hash: new Uint8Array(),
|
||||||
hashStr: "",
|
hashStr: "",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/1/content",
|
contentTopic: "/test/1/content",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -501,7 +499,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage: IDecodedMessage = {
|
const mockMessage: IDecodedMessage = {
|
||||||
hash: utf8ToBytes("1234"),
|
hash: utf8ToBytes("1234"),
|
||||||
hashStr: "1234",
|
hashStr: "1234",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/offline/content",
|
contentTopic: "/test/offline/content",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -535,7 +532,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage: IDecodedMessage = {
|
const mockMessage: IDecodedMessage = {
|
||||||
hash: new Uint8Array(),
|
hash: new Uint8Array(),
|
||||||
hashStr: "1234",
|
hashStr: "1234",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/offline/content",
|
contentTopic: "/test/offline/content",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -579,7 +575,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage: IDecodedMessage = {
|
const mockMessage: IDecodedMessage = {
|
||||||
hash: new Uint8Array(),
|
hash: new Uint8Array(),
|
||||||
hashStr: "",
|
hashStr: "",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/timeout/content",
|
contentTopic: "/test/timeout/content",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -632,7 +627,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage1: IDecodedMessage = {
|
const mockMessage1: IDecodedMessage = {
|
||||||
hash: new Uint8Array(),
|
hash: new Uint8Array(),
|
||||||
hashStr: "",
|
hashStr: "",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/multi/content1",
|
contentTopic: "/test/multi/content1",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
@ -645,7 +639,6 @@ describe("QueryOnConnect", () => {
|
|||||||
const mockMessage2: IDecodedMessage = {
|
const mockMessage2: IDecodedMessage = {
|
||||||
hash: new Uint8Array(),
|
hash: new Uint8Array(),
|
||||||
hashStr: "",
|
hashStr: "",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: "/test/multi/content2",
|
contentTopic: "/test/multi/content2",
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
|
|||||||
@ -531,7 +531,6 @@ describe("Reliable Channel", () => {
|
|||||||
const autoRetrievedMessage: IDecodedMessage = {
|
const autoRetrievedMessage: IDecodedMessage = {
|
||||||
hash: hexToBytes("1234"),
|
hash: hexToBytes("1234"),
|
||||||
hashStr: "1234",
|
hashStr: "1234",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: TEST_CONTENT_TOPIC,
|
contentTopic: TEST_CONTENT_TOPIC,
|
||||||
pubsubTopic: decoder.pubsubTopic,
|
pubsubTopic: decoder.pubsubTopic,
|
||||||
@ -609,7 +608,6 @@ describe("Reliable Channel", () => {
|
|||||||
const autoRetrievedMessage1: IDecodedMessage = {
|
const autoRetrievedMessage1: IDecodedMessage = {
|
||||||
hash: hexToBytes("5678"),
|
hash: hexToBytes("5678"),
|
||||||
hashStr: "5678",
|
hashStr: "5678",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(Date.now() - 1000),
|
timestamp: new Date(Date.now() - 1000),
|
||||||
contentTopic: TEST_CONTENT_TOPIC,
|
contentTopic: TEST_CONTENT_TOPIC,
|
||||||
pubsubTopic: decoder.pubsubTopic,
|
pubsubTopic: decoder.pubsubTopic,
|
||||||
@ -622,7 +620,6 @@ describe("Reliable Channel", () => {
|
|||||||
const autoRetrievedMessage2: IDecodedMessage = {
|
const autoRetrievedMessage2: IDecodedMessage = {
|
||||||
hash: hexToBytes("9abc"),
|
hash: hexToBytes("9abc"),
|
||||||
hashStr: "9abc",
|
hashStr: "9abc",
|
||||||
version: 1,
|
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
contentTopic: TEST_CONTENT_TOPIC,
|
contentTopic: TEST_CONTENT_TOPIC,
|
||||||
pubsubTopic: decoder.pubsubTopic,
|
pubsubTopic: decoder.pubsubTopic,
|
||||||
|
|||||||
@ -430,7 +430,6 @@ export class ReliableChannel<
|
|||||||
payload: sdsMessage.content,
|
payload: sdsMessage.content,
|
||||||
hash: msg.hash,
|
hash: msg.hash,
|
||||||
hashStr: msg.hashStr,
|
hashStr: msg.hashStr,
|
||||||
version: msg.version,
|
|
||||||
contentTopic: msg.contentTopic,
|
contentTopic: msg.contentTopic,
|
||||||
pubsubTopic: msg.pubsubTopic,
|
pubsubTopic: msg.pubsubTopic,
|
||||||
timestamp: msg.timestamp,
|
timestamp: msg.timestamp,
|
||||||
|
|||||||
@ -70,7 +70,6 @@ describe("Store", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mockMessage: IDecodedMessage = {
|
const mockMessage: IDecodedMessage = {
|
||||||
version: 1,
|
|
||||||
pubsubTopic: "/waku/2/default-waku/proto",
|
pubsubTopic: "/waku/2/default-waku/proto",
|
||||||
contentTopic: "/test/1/test/proto",
|
contentTopic: "/test/1/test/proto",
|
||||||
payload: new Uint8Array([1, 2, 3]),
|
payload: new Uint8Array([1, 2, 3]),
|
||||||
|
|||||||
@ -171,13 +171,6 @@ export class MessageCollector {
|
|||||||
`Message content topic mismatch. Expected: ${options.expectedContentTopic}. Got: ${message.contentTopic}`
|
`Message content topic mismatch. Expected: ${options.expectedContentTopic}. Got: ${message.contentTopic}`
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(message.version).to.eq(
|
|
||||||
options.expectedVersion || 0,
|
|
||||||
`Message version mismatch. Expected: ${
|
|
||||||
options.expectedVersion || 0
|
|
||||||
}. Got: ${message.version}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (message.ephemeral !== undefined) {
|
if (message.ephemeral !== undefined) {
|
||||||
expect(message.ephemeral).to.eq(
|
expect(message.ephemeral).to.eq(
|
||||||
options.expectedEphemeral !== undefined
|
options.expectedEphemeral !== undefined
|
||||||
|
|||||||
@ -60,7 +60,6 @@ export interface MessageRpcQuery {
|
|||||||
export interface MessageRpcResponse {
|
export interface MessageRpcResponse {
|
||||||
payload: string;
|
payload: string;
|
||||||
contentTopic?: string;
|
contentTopic?: string;
|
||||||
version?: number;
|
|
||||||
timestamp?: bigint; // Unix epoch time in nanoseconds as a 64-bits integer value.
|
timestamp?: bigint; // Unix epoch time in nanoseconds as a 64-bits integer value.
|
||||||
ephemeral?: boolean;
|
ephemeral?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,6 @@ describe("Waku Relay, Interop", function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(msgs[0].contentTopic).to.equal(TestContentTopic);
|
expect(msgs[0].contentTopic).to.equal(TestContentTopic);
|
||||||
expect(msgs[0].version).to.equal(0);
|
|
||||||
expect(base64ToUtf8(msgs[0].payload)).to.equal(messageText);
|
expect(base64ToUtf8(msgs[0].payload)).to.equal(messageText);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,7 +98,6 @@ describe("Waku Relay, Interop", function () {
|
|||||||
const receivedMsg = await receivedMsgPromise;
|
const receivedMsg = await receivedMsgPromise;
|
||||||
|
|
||||||
expect(receivedMsg.contentTopic).to.eq(TestContentTopic);
|
expect(receivedMsg.contentTopic).to.eq(TestContentTopic);
|
||||||
expect(receivedMsg.version!).to.eq(0);
|
|
||||||
expect(bytesToUtf8(receivedMsg.payload!)).to.eq(messageText);
|
expect(bytesToUtf8(receivedMsg.payload!)).to.eq(messageText);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user