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

refactor: rename verification message #1637

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

Wazzymandias
Copy link
Contributor

@Wazzymandias Wazzymandias commented Jan 31, 2024

Motivation

  • Adding additional verification message types add a lot of complexity
  • However, existing verification message type is tightly coupled to Ethereum
  • Rename verification message type for better extensibility for future changes

Change Summary

  • Rename verification message type for better extensibility for future changes

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 renaming the verification message from "VERIFICATION_ADD_ETH_ADDRESS" to "VERIFICATION_ADD_ADDRESS".

Detailed summary

  • Renamed VERIFICATION_ADD_ETH_ADDRESS to VERIFICATION_ADD_ADDRESS in multiple files.
  • Updated related functions and type definitions accordingly.
  • Added new dependencies in package.json.

The following files were skipped due to too many changes: packages/core/src/protobufs/typeguards.ts, apps/hubble/src/rpc/server.ts, packages/core/src/crypto/eip712.ts, packages/core/src/signers/testUtils.ts, yarn.lock, packages/core/src/builders.ts, apps/hubble/src/storage/engine/index.ts, apps/hubble/src/rpc/test/httpServer.test.ts, apps/hubble/src/rpc/test/verificationService.test.ts, apps/hubble/src/storage/db/migrations/4.uniqueVerifications.test.ts, apps/replicator/src/util.ts, protobufs/schemas/message.proto, apps/replicator/src/processors/verification.ts, packages/core/src/builders.test.ts, packages/core/src/validations.ts, apps/hubble/src/storage/engine/index.test.ts, packages/core/src/factories.ts, packages/core/src/validations.test.ts, apps/hubble/src/storage/stores/verificationStore.test.ts, apps/hubble/src/storage/stores/verificationStore.ts, packages/hub-web/src/generated/message.ts, packages/hub-nodejs/src/generated/message.ts, packages/core/src/protobufs/generated/message.ts

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

Copy link

changeset-bot bot commented Jan 31, 2024

🦋 Changeset detected

Latest commit: 1b57489

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@farcaster/hub-nodejs Minor
@farcaster/hub-web Minor
@farcaster/replicator Minor
@farcaster/core Minor
@farcaster/hubble Minor

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

Copy link

vercel bot commented Jan 31, 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 Jan 31, 2024 5:27am

Copy link

socket-security bot commented Jan 31, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 9.44 kB junderw
npm/[email protected] None +1 15.7 kB junderw

View full report↗︎

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

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

Comparison is base (80c8f7d) 73.75% compared to head (1b57489) 73.78%.

Files Patch % Lines
packages/core/src/validations.ts 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1637      +/-   ##
==========================================
+ Coverage   73.75%   73.78%   +0.02%     
==========================================
  Files          99       99              
  Lines        9000     9002       +2     
  Branches     1998     1999       +1     
==========================================
+ Hits         6638     6642       +4     
+ Misses       2244     2242       -2     
  Partials      118      118              

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

Copy link
Contributor

@sanjayprabhu sanjayprabhu left a comment

Choose a reason for hiding this comment

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

Generally looks good. Left some comments. I think biggest thing is we should keep this PR to be a pure rename refactoring. And add the sol changes in a followup

/** Adds a Verification of ownership of an Address based on Protocol */
message VerificationAddAddressBody {
bytes address = 1; // Address being verified for a given Protocol
bytes protocol_signature = 2; // Signature produced by the user's address for a given Protocol
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should calls this user_signature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i wasn't sure what's best to name this

since we have the user signature for FID, i wanted something to help distinguish the two

open to user_signature if we feel it won't clash with FID signature verification

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, fair. Maybe address_verification_signature or user_address_signature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i like address_verification_signature - do we want it in this PR or can it be separate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made the update on the followup branch built on top of this one: https://github.com/farcasterxyz/hub-monorepo/tree/feat/solana-verifications

Copy link
Member

Choose a reason for hiding this comment

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

This is perhaps a silly question, but are these changes backwards compatible with the old message format? eth_signature is referenced in a lot of places in code—will that suddenly start breaking for old messages when someone updates their hub-nodejs package?

Or will the code generated by protobuf libraries automatically support both calls?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it would break. Consumers of the library would have to rename.
But maybe we can add a function to the class in hub-nodejs called eth_signature that returns the eth_signature if protocol == ethereurm and throws otherwise?

protobufs/schemas/message.proto Outdated Show resolved Hide resolved
packages/core/src/verifications.ts Outdated Show resolved Hide resolved
packages/core/src/validations.ts Outdated Show resolved Hide resolved
@Wazzymandias Wazzymandias force-pushed the refactor/verification-message-rename branch from 38e145d to 1b57489 Compare January 31, 2024 05:27
@Wazzymandias Wazzymandias marked this pull request as ready for review January 31, 2024 05:30
@Wazzymandias Wazzymandias mentioned this pull request Jan 31, 2024
5 tasks
Copy link
Member

@sds sds left a comment

Choose a reason for hiding this comment

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

Overall looks great. I always wondered why we insisted on tying it to ETH and not just have a verification_type field.

/** Adds a Verification of ownership of an Address based on Protocol */
message VerificationAddAddressBody {
bytes address = 1; // Address being verified for a given Protocol
bytes protocol_signature = 2; // Signature produced by the user's address for a given Protocol
Copy link
Member

Choose a reason for hiding this comment

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

This is perhaps a silly question, but are these changes backwards compatible with the old message format? eth_signature is referenced in a lot of places in code—will that suddenly start breaking for old messages when someone updates their hub-nodejs package?

Or will the code generated by protobuf libraries automatically support both calls?

Copy link
Contributor

@sanjayprabhu sanjayprabhu left a comment

Choose a reason for hiding this comment

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

What is this file apps/hubble/src/rustfunctions.test.ts ?

@@ -623,7 +620,12 @@ export const validateVerificationAddEthAddressBody = async (
export const validateVerificationRemoveBody = (
body: protobufs.VerificationRemoveBody,
): HubResult<protobufs.VerificationRemoveBody> => {
return validateEthAddress(body.address).map(() => body);
switch (body.protocol) {
case protobufs.Protocol.ETHEREUM:
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have this in the validate Add as well

/** Adds a Verification of ownership of an Address based on Protocol */
message VerificationAddAddressBody {
bytes address = 1; // Address being verified for a given Protocol
bytes protocol_signature = 2; // Signature produced by the user's address for a given Protocol
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it would break. Consumers of the library would have to rename.
But maybe we can add a function to the class in hub-nodejs called eth_signature that returns the eth_signature if protocol == ethereurm and throws otherwise?

@Wazzymandias
Copy link
Contributor Author

What is this file apps/hubble/src/rustfunctions.test.ts ?

@sanjayprabhu Some file aditya and cassie set up - I used it to test signature verification for phantom wallet

@sanjayprabhu
Copy link
Contributor

Ah, weird, I don't know why github thinks it's a binary file.

@Wazzymandias Wazzymandias merged commit fd9f9ff into main Jan 31, 2024
10 checks passed
@Wazzymandias Wazzymandias deleted the refactor/verification-message-rename branch January 31, 2024 21:35
sanjayprabhu added a commit to sanjayprabhu/hub-monorepo that referenced this pull request Feb 2, 2024
sanjayprabhu added a commit that referenced this pull request Feb 2, 2024
* Revert "refactor: rename verification message  (#1637)"

This reverts commit fd9f9ff.

* Add changeset
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