diff --git a/waku/factory/external_config.nim b/waku/factory/external_config.nim index abdff75c7..c5209abc6 100644 --- a/waku/factory/external_config.nim +++ b/waku/factory/external_config.nim @@ -665,8 +665,15 @@ with the drawback of consuming some more bandwidth.""", .}: bool #Mix config - mixkey* {.desc: "ED25519 private key as 64 char hex string.", name: "mixkey".}: - Option[string] + mix* {. + desc: "Enable mix protocol: true|false", + defaultValue: false, + name: "mix" + .}: bool + mixkey* {. + desc: "ED25519 private key as 64 char hex string.", + name: "mixkey" + .}: Option[string] #TODO: Temp config for simulations.Ideally need to get this info from bootstrap ENRs #[ mixBootstrapNodes* {. desc: diff --git a/waku/factory/internal_config.nim b/waku/factory/internal_config.nim index 064a03acd..87be67711 100644 --- a/waku/factory/internal_config.nim +++ b/waku/factory/internal_config.nim @@ -122,6 +122,7 @@ proc networkConfiguration*(conf: WakuNodeConf, clientId: string): NetConfigResul store = conf.store, relay = conf.relay, sync = conf.storeSync, + mix = conf.mix, ) # Resolve and use DNS domain IP diff --git a/waku/factory/node_factory.nim b/waku/factory/node_factory.nim index 76f91ad38..eddd69bc2 100644 --- a/waku/factory/node_factory.nim +++ b/waku/factory/node_factory.nim @@ -427,16 +427,17 @@ proc setupProtocols( err("failed to set node waku peer-exchange peer: " & peerExchangeNode.error) #mount mix - let mixPrivKey:string = - if conf.mixkey.isSome(): - conf.mixkey.get() - else: - error "missing mix key" - return err("missing mix key") - ( - await node.mountMix(mixPrivKey) - ).isOkOr: - return err("failed to mount waku mix protocol: " & $error) + if conf.mix: + let mixPrivKey:string = + if conf.mixkey.isSome(): + conf.mixkey.get() + else: + error "missing mix key" + return err("missing mix key") + ( + await node.mountMix(mixPrivKey) + ).isOkOr: + return err("failed to mount waku mix protocol: " & $error) return ok() ## Start node diff --git a/waku/waku_enr/capabilities.nim b/waku/waku_enr/capabilities.nim index 2f09796c8..b11e0e8d5 100644 --- a/waku/waku_enr/capabilities.nim +++ b/waku/waku_enr/capabilities.nim @@ -20,6 +20,7 @@ type Filter = 2 Lightpush = 3 Sync = 4 + Mix = 5 const capabilityToCodec = { Capabilities.Relay: WakuRelayCodec, @@ -30,7 +31,7 @@ const capabilityToCodec = { }.toTable func init*( - T: type CapabilitiesBitfield, lightpush, filter, store, relay, sync: bool = false + T: type CapabilitiesBitfield, lightpush, filter, store, relay, sync, mix: bool = false ): T = ## Creates an waku2 ENR flag bit field according to RFC 31 (https://rfc.vac.dev/spec/31/) var bitfield: uint8 @@ -44,6 +45,8 @@ func init*( bitfield.setBit(3) if sync: bitfield.setBit(4) + if mix: + bitfield.setBit(5) CapabilitiesBitfield(bitfield) func init*(T: type CapabilitiesBitfield, caps: varargs[Capabilities]): T = diff --git a/waku/waku_lightpush/client.nim b/waku/waku_lightpush/client.nim index d97973c71..9e7167dd7 100644 --- a/waku/waku_lightpush/client.nim +++ b/waku/waku_lightpush/client.nim @@ -127,4 +127,6 @@ proc publishWithConn*( for obs in wl.publishObservers: obs.onMessagePublished(pubSubTopic, message) - return lightpushSuccessResult(1) \ No newline at end of file + #TODO: Implement response handling. + + return lightpushSuccessResult(1)