From b7e78ca37032b6bc4c3424841d7acefb40d710d1 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Fri, 22 Dec 2023 10:52:19 +0100 Subject: [PATCH] light-push/index.node.spec.ts: adjust metadata size to nwaku max size adjustment The "Fails to push message with large meta" test used 10 ** 6 when `nwaku` node had MaxWakuMessageSize == 1MiB ( 1*2^20 .) `nwaku` establishes the max lightpush msg size as `const MaxRpcSize* = MaxWakuMessageSize + 64 * 1024` see: https://github.com/waku-org/nwaku/blob/07beea02095035f4f4c234ec2dec1f365e6955b8/waku/waku_lightpush/rpc_codec.nim#L15 In the PR https://github.com/waku-org/nwaku/pull/2298 we reduced the MaxWakuMessageSize from 1MiB to 150KiB. Therefore, the 105024 number comes from substracting ( 1*2^20 - 150*2^10 ) to the original 10^6 that this test had when MaxWakuMessageSize == 1*2^20 --- packages/tests/tests/light-push/index.node.spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/tests/tests/light-push/index.node.spec.ts b/packages/tests/tests/light-push/index.node.spec.ts index cf00748fb2..048d726629 100644 --- a/packages/tests/tests/light-push/index.node.spec.ts +++ b/packages/tests/tests/light-push/index.node.spec.ts @@ -141,9 +141,16 @@ describe("Waku Light Push", function () { it("Fails to push message with large meta", async function () { const customTestEncoder = createEncoder({ contentTopic: TestContentTopic, - metaSetter: () => new Uint8Array(10 ** 6) + metaSetter: () => new Uint8Array(105024) // see the note below *** }); + // *** note: this test used 10 ** 6 when `nwaku` node had MaxWakuMessageSize == 1MiB ( 1*2^20 .) + // `nwaku` establishes the max lightpush msg size as `const MaxRpcSize* = MaxWakuMessageSize + 64 * 1024` + // see: https://github.com/waku-org/nwaku/blob/07beea02095035f4f4c234ec2dec1f365e6955b8/waku/waku_lightpush/rpc_codec.nim#L15 + // In the PR https://github.com/waku-org/nwaku/pull/2298 we reduced the MaxWakuMessageSize + // from 1MiB to 150KiB. Therefore, the 105024 number comes from substracting ( 1*2^20 - 150*2^10 ) + // to the original 10^6 that this test had when MaxWakuMessageSize == 1*2^20 + const pushResponse = await waku.lightPush.send( customTestEncoder, messagePayload