waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
162 stars 41 forks source link

fix(message-hash): account for `timestamp` #1986

Closed danisharora099 closed 2 months ago

danisharora099 commented 2 months ago

Problem

Based on the specs: https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/14/message.md#deterministic-message-hashing, the current message-hash algorithm does not take into account the timestamp.

The test vectors mentioned in the spec also varied from the one in the implementation.

Solution

Notes

Contribution checklist:

github-actions[bot] commented 2 months ago

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 180.8 KB (-0.07% 🔽) 3.7 s (-0.07% 🔽) 20.9 s (-7.46% 🔽) 24.5 s
Waku Simple Light Node 180.87 KB (+0.02% 🔺) 3.7 s (+0.02% 🔺) 18 s (+42.59% 🔺) 21.6 s
ECIES encryption 23.08 KB (0%) 462 ms (0%) 6.1 s (+8.79% 🔺) 6.6 s
Symmetric encryption 22.55 KB (0%) 452 ms (0%) 5.5 s (+76.5% 🔺) 6 s
DNS discovery 72.42 KB (0%) 1.5 s (0%) 15.4 s (+39.18% 🔺) 16.9 s
Peer Exchange discovery 74.1 KB (0%) 1.5 s (0%) 7.6 s (-10.52% 🔽) 9 s
Local Peer Cache Discovery 67.64 KB (0%) 1.4 s (0%) 7.7 s (+1.63% 🔺) 9.1 s
Privacy preserving protocols 38.87 KB (0%) 778 ms (0%) 8.1 s (+15.13% 🔺) 8.9 s
Waku Filter 111.51 KB (+0.08% 🔺) 2.3 s (+0.08% 🔺) 13.1 s (+1.68% 🔺) 15.4 s
Waku LightPush 110.11 KB (0%) 2.3 s (0%) 16.2 s (-4.54% 🔽) 18.4 s
History retrieval protocols 110.72 KB (0%) 2.3 s (0%) 13 s (-3.27% 🔽) 15.3 s
Deterministic Message Hashing 7.29 KB (+50.89% 🔺) 146 ms (+50.89% 🔺) 977 ms (+82.24% 🔺) 1.2 s