feath: use sha256 for Relay msgIdFn (#1322)

This commit is contained in:
Sasha 2023-05-05 18:26:54 +02:00 committed by GitHub
parent d65996b210
commit 4615b51568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

1
nwaku Submodule

@ -0,0 +1 @@
Subproject commit 03f0de365cfee3a946257a6ce8a61fe19284976c

View File

@ -8,6 +8,7 @@ import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types";
import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types"; import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types";
import type { Libp2p } from "@libp2p/interface-libp2p"; import type { Libp2p } from "@libp2p/interface-libp2p";
import type { PubSub } from "@libp2p/interface-pubsub"; import type { PubSub } from "@libp2p/interface-pubsub";
import { sha256 } from "@noble/hashes/sha256";
import type { import type {
ActiveSubscriptions, ActiveSubscriptions,
Callback, Callback,
@ -228,6 +229,7 @@ export function wakuGossipSub(
return (components: GossipSubComponents) => { return (components: GossipSubComponents) => {
init = { init = {
...init, ...init,
msgIdFn: ({ data }) => sha256(data),
// Ensure that no signature is included nor expected in the messages. // Ensure that no signature is included nor expected in the messages.
globalSignaturePolicy: SignaturePolicy.StrictNoSign, globalSignaturePolicy: SignaturePolicy.StrictNoSign,
fallbackToFloodsub: false, fallbackToFloodsub: false,