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

perf: discard old contact info messages early #1710

Merged

Conversation

karmacoma-eth
Copy link
Contributor

@karmacoma-eth karmacoma-eth commented Feb 17, 2024

Motivation

When processing a contact info message, the old behavior was:

  1. hashing the content, verifying the signature
  2. then checking the timestamp and discarding the message if it's too old

The new behavior just inverts the order of these two operations, so we avoid doing expensive work if we're going to discard the message.

Please advise on how to add a test for this, at least it doesn't break any existing tests.

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review

Additional Context

If this is a relatively large or complex change, provide more details here that will help reviewers


PR-Codex overview

This PR focuses on improving the message processing in the Hub class of the Hubble application. The notable changes include:

  • Added a check to ignore messages that are too old
  • Added validation for message signatures if present
  • Updated the address book for the peer

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

This avoids hashing the content and verifying signatures if the message is too old
Copy link

changeset-bot bot commented Feb 17, 2024

⚠️ No Changeset found

Latest commit: 5467c20

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 17, 2024 0:18am

Copy link
Contributor

@sagar-a16z sagar-a16z left a comment

Choose a reason for hiding this comment

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

Lgtm!

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (1a52b86) 74.65% compared to head (5467c20) 74.66%.
Report is 1 commits behind head on main.

Files Patch % Lines
apps/hubble/src/hubble.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1710   +/-   ##
=======================================
  Coverage   74.65%   74.66%           
=======================================
  Files          99       99           
  Lines        9324     9327    +3     
  Branches     2097     2100    +3     
=======================================
+ Hits         6961     6964    +3     
  Misses       2250     2250           
  Partials      113      113           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sanjayprabhu
Copy link
Contributor

I missed this. Thank you!

@sanjayprabhu sanjayprabhu merged commit 82204fe into farcasterxyz:main Feb 29, 2024
9 of 10 checks passed
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.

3 participants