From d4febea46989f07cdbb6010046d2e77c4f20d07e Mon Sep 17 00:00:00 2001 From: NIC619 Date: Tue, 6 Aug 2019 13:05:31 +0800 Subject: [PATCH] Message was not enforced to carry signature yet --- libp2p/pubsub/pubsub.py | 2 +- libp2p/pubsub/validators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libp2p/pubsub/pubsub.py b/libp2p/pubsub/pubsub.py index 37eb9321..75058e5f 100644 --- a/libp2p/pubsub/pubsub.py +++ b/libp2p/pubsub/pubsub.py @@ -409,7 +409,7 @@ class Pubsub: # TODO: - Validate the message. If failed, reject it. # Validate the signature of the message # FIXME: `signature_validator` is currently a stub. - if not signature_validator(msg.key, msg.SerializeToString(), msg.singature): + if not signature_validator(msg.key, msg.SerializeToString()): log.debug(f"Signature validation failed for msg={msg}") return # Validate the message with registered topic validators. diff --git a/libp2p/pubsub/validators.py b/libp2p/pubsub/validators.py index 4d99eded..e575980d 100644 --- a/libp2p/pubsub/validators.py +++ b/libp2p/pubsub/validators.py @@ -1,5 +1,5 @@ # FIXME: Replace the type of `pubkey` with a custom type `Pubkey` -def signature_validator(pubkey: bytes, msg: bytes, sig: bytes) -> bool: +def signature_validator(pubkey: bytes, msg: bytes) -> bool: """ Verify the message against the given public key. :param pubkey: the public key which signs the message.