Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for handling uncompressed Gossip MessageId #155

Merged
merged 16 commits into from
Nov 10, 2020

Conversation

Nashatyrev
Copy link
Collaborator

@Nashatyrev Nashatyrev commented Nov 9, 2020

Changes to Libp2p Gossip to make it possible for Teku to calculate Gossip message-id based on uncompressed payload content and allow to:

  • Avoid expensive uncompressing a gossip message twice (First on message-id calculation, second on message handling)
  • Avoid duplicate calculation of message-id (which need duplicate uncompressing) for duplicate inbound messages: by using fast-message-id (id based on compressed content)

The first is achieved by introducing a PubsubMessage wrapper class instead of the raw protobuf Rpc.Message and AbstractRouter.messageFactory by which the client code may create his own PubsubMessage implementation with necessary caching of uncompressed payload

The second is achieved by changing AbstractRouter.seenMessages to a pluggable custom 'Map-like' SeenCache interface with FastIdSeenCache implementation

Related Teku PR: Consensys/teku#3188

…ch is created by pluggable messageFactory.

messageFactory replaces messageIdGenerator because of PubsubMessage.messageId property
…e which is capable of handling PubsubMessage.messageId in a lazy fashion
# Conflicts:
#	src/main/kotlin/io/libp2p/pubsub/AbstractRouter.kt
#	src/main/kotlin/io/libp2p/pubsub/PubsubMessageValidator.kt
#	src/main/kotlin/io/libp2p/pubsub/PubsubRouter.kt
#	src/main/kotlin/io/libp2p/pubsub/gossip/MCache.kt
@Nashatyrev Nashatyrev changed the title Prepare for handling slow Gossip MessageId Prepare for handling uncompressed Gossip MessageId Nov 9, 2020
@Nashatyrev Nashatyrev marked this pull request as ready for review November 9, 2020 21:34
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work.

@Nashatyrev Nashatyrev merged commit eb0303a into develop Nov 10, 2020
@Nashatyrev Nashatyrev deleted the feature/message-id branch November 10, 2020 16:45
@Nashatyrev Nashatyrev mentioned this pull request Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants