Skip to content

Conversation

@christopherwxyz
Copy link
Contributor

Summary

  • Extracts protocol buffer definitions into a separate snapchain-proto crate so consumers can import protos without depending on the entire snapchain project
  • Converts the project to a Cargo workspace with proto/ as a workspace member
  • Uses extension traits pattern to maintain functionality while respecting Rust's orphan rules

Changes

  • Create proto/ workspace member with its own Cargo.toml and build.rs
  • Move proto definitions from src/proto/ to proto/definitions/
  • Move proto-only impls (Height, ShardHash, Message, FullProposal, ConsensusMessage, BlockEvent) to proto crate
  • Add extension traits for methods requiring main crate types:
    • CommitsExt for commit certificate conversion
    • FullProposalExt for proposer address
    • HubEventExt for event construction
    • HubEventStorageExt for storage operations
  • Rename HubEvent::from() to HubEvent::new_event() to avoid trait conflict with std::convert::From

Test plan

  • Docker compose build passes
  • All existing tests pass
  • Proto crate can be imported independently

@vercel
Copy link

vercel bot commented Dec 4, 2025

@christopherwxyz is attempting to deploy a commit to the farcaster Team on Vercel.

A member of the Team first needs to authorize it.

Extract protocol buffer definitions into a separate `snapchain-proto`
crate so consumers can import protos without depending on the entire
snapchain project.

Changes:
- Create `proto/` workspace member with its own Cargo.toml and build.rs
- Move proto definitions from `src/proto/` to `proto/definitions/`
- Move proto-only impls (Height, ShardHash, Message, etc.) to proto crate
- Add extension traits for methods requiring main crate types:
  - CommitsExt for commit certificate conversion
  - FullProposalExt for proposer address
  - HubEventExt for event construction
  - HubEventStorageExt for storage operations
- Update imports throughout codebase to use extension traits
- Rename HubEvent::from() to HubEvent::new_event() to avoid trait conflict
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.

1 participant