-
Notifications
You must be signed in to change notification settings - Fork 445
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
feat: Add ContactInfoContent signing + config toggle for strict validation + StrictNoSign #1545
Conversation
🦋 Changeset detectedLatest commit: 8ea555c The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAttention:
... and 2 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
@@ -113,9 +123,11 @@ describe("networkConfig", () => { | |||
keyRegistryAddress: undefined, | |||
idRegistryAddress: undefined, | |||
allowlistedImmunePeers: undefined, | |||
strictContactInfoValidation: undefined, | |||
strictNoSign: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe time to extract this to a common function. Always annoying to have to modify all these test just to add an extra param.
@@ -710,6 +734,8 @@ export class Hub implements HubInterface { | |||
this.deniedPeerIds = deniedPeerIds; | |||
|
|||
this.allowlistedImmunePeers = allowlistedImmunePeers; | |||
this.strictContactInfoValidation = !!strictContactInfoValidation; | |||
this.strictNoSign = !!strictNoSign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to restart the GossipNode node if this changed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, will follow up
apps/hubble/src/hubble.ts
Outdated
appVersion: content.appVersion, | ||
timestamp: content.timestamp, | ||
dataBytes: content.dataBytes, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ContactInfoContent.decode(ContactInfoContent.encode(content).finish())
is more future proofs for when new fields get added. Maybe also worth pulling the dataBytes check out here for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't have a envelope to this, we have to explicitly extract the values that would exist pre-signed, but agreed we need a way to future proof this better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could introduce a body
field just like Message and duplicate the fields on there since we're changing it anyway. We can deprecate the outer fields in 1.8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, happy to proceed with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth testing on testnet or locally with two hub instances.
if (shouldRestart) { | ||
log.info({}, "Network config restart signal"); | ||
await this._hub.stop(); | ||
await this._hub.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we just restart the gossipNode instead of the whole hub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are calls being made to the worker which could behave unpredictably if we only restarted the gossipNode
if (shouldExit) { | ||
log.error({}, "Network config exit signal"); | ||
process.kill(process.pid, "SIGQUIT"); | ||
} | ||
|
||
if (shouldRestart) { | ||
log.info({}, "Network config restart signal"); | ||
await this._hub.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GossipNode.stop
calls terminate on the worker.
await this._nodeWorker?.terminate(); |
I think we'll need to modify start
to re-create the worker. Otherwise it won't start back up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, lmk if this approach handles this better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation
StrictSign support on hubs is using javascript methods for signature creation and validation, which are both very slow compared to our rust implementation and make up a large portion of CPU time. To support use of StrictNoSign, we need signatures added to ContactInfoContent to verify provenance, and also need to allow network config based toggling of the features.
Change Summary
This PR updates ContactInfoContent messages to include signature payloads following the message signing convention used for other Farcaster messages, and utilizes native methods. It also adds configuration support both at the hub options and network configuration level for contactinfo strict validation and StrictNoSign.
Merge Checklist
Choose all relevant options below by adding an
x
now or at any time before submitting for reviewAdditional 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 adding support for contact info content signing and introducing a new strictNoSign option.
Detailed summary