waku-org / js-waku

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

fix: only override ping metadata in peer store #1984

Closed adklempner closed 2 months ago

adklempner commented 2 months ago

Problem

After pinging a peer, the keep alive manager overwrites all the metadata stored for that peer and replaces it with the latency of the ping. This causes the peer store to lose any other metadata that was stored, including the peer's shard info.

Solution

Use `peerStore.merge` instead of `peerStore.patch` to update the metadata, which will only overwrite the last value of `ping` and not wipe the rest of the metadata. ## 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 181.08 KB (-0.01% 🔽) 3.7 s (-0.01% 🔽) 17.7 s (-20.25% 🔽) 21.3 s
Waku Simple Light Node 181.12 KB (+0.05% 🔺) 3.7 s (+0.05% 🔺) 16.8 s (-30.83% 🔽) 20.4 s
ECIES encryption 23.08 KB (0%) 462 ms (0%) 3.3 s (-24.79% 🔽) 3.8 s
Symmetric encryption 22.55 KB (0%) 452 ms (0%) 7.3 s (+35.17% 🔺) 7.8 s
DNS discovery 72.42 KB (0%) 1.5 s (0%) 14.6 s (+39.51% 🔺) 16 s
Peer Exchange discovery 74.1 KB (0%) 1.5 s (0%) 16.1 s (+40.82% 🔺) 17.6 s
Local Peer Cache Discovery 67.64 KB (0%) 1.4 s (0%) 10.7 s (-17.84% 🔽) 12.1 s
Privacy preserving protocols 38.87 KB (0%) 778 ms (0%) 6.7 s (-11.98% 🔽) 7.5 s
Waku Filter 111.76 KB (0%) 2.3 s (0%) 12.7 s (+3.47% 🔺) 14.9 s
Waku LightPush 110.11 KB (0%) 2.3 s (0%) 12.4 s (-14.58% 🔽) 14.6 s
History retrieval protocols 110.72 KB (0%) 2.3 s (0%) 15.3 s (+33.56% 🔺) 17.6 s
Deterministic Message Hashing 7.29 KB (0%) 146 ms (0%) 1.2 s (-74.75% 🔽) 1.3 s