Gossipsub message id to shortened bytes (#1607)
## Issue Addressed https://github.com/ethereum/eth2.0-specs/pull/2044 ## Proposed Changes Shifts the gossipsub message id to use the first 8 bytes of the SHA256 hash of the gossipsub message data field. ## Additional Info We should merge this in once the spec has been decided on. It will cause issues with gossipsub scoring and gossipsub propagation rates (as we won't receive IWANT) messages from clients that also haven't made this update.
This commit is contained in:
parent
e5fc6bab48
commit
2074beccdc
@ -85,13 +85,9 @@ impl Default for Config {
|
||||
];
|
||||
|
||||
// The function used to generate a gossipsub message id
|
||||
// We use base64(SHA256(data)) for content addressing
|
||||
let gossip_message_id = |message: &GossipsubMessage| {
|
||||
MessageId::from(base64::encode_config(
|
||||
&Sha256::digest(&message.data),
|
||||
base64::URL_SAFE_NO_PAD,
|
||||
))
|
||||
};
|
||||
// We use the first 8 bytes of SHA256(data) for content addressing
|
||||
let gossip_message_id =
|
||||
|message: &GossipsubMessage| MessageId::from(&Sha256::digest(&message.data)[..8]);
|
||||
|
||||
// gossipsub configuration
|
||||
// Note: The topics by default are sent as plain strings. Hashes are an optional
|
||||
|
Loading…
Reference in New Issue
Block a user