FIP-2: Flexible targets for messages #71
Replies: 7 comments 9 replies
-
Supportive of this direction! A few extensions I'm proposing: 1. Explicitly encourage the use of canonical identifiers over URL identifiersConsider this cast which includes the embed: https://warpcast.com/v/0x99b0d8. When this is rendered in a client, clicking on the link will take you to warpcast which is not a good ux. Each client should be able to render the cast in its own UI if possible and can fall back to warpcast if necessary. Using a canonical identifier like the Cast ID : is much more flexible. The same applies to using CAIP-19 NFT identifiers over OpenSea links for NFTs. 2. Create a lightweight, self-organizing process for developers to introduce new target formats / embed schemasPeople will want to add new extensions as soon as this is out. If it evolves organically without structure it will be difficult for developers to integrate. We should make a lightweight system for proposing, validation and avoiding conflicts between target types:
We could write the first proposal for URLs and Ethereum NFT's and let the community propose more over time. There's no guarantee that a client supports them, but it provides an interoperable way for people to build asynchronously. 3. Turning CastId into a form of string embed.Instead of a oneof of CastId or string, can we just have target format string schema called cast id? Example |
Beta Was this translation helpful? Give feedback.
-
This is epic and has been top of mind for me recently, would love to be able to use this soon! I strongly agree canonical identifiers are better than URL identifiers. Some ideas:
|
Beta Was this translation helpful? Give feedback.
-
Initial supported formatsAfter some further discussion, here are the two formats clients should initially support: 1. Web URL
2. Ethereum asset or collection
Client upgrade guidePhase 1In the next few days, Warpcast will start submitting casts with embeds structured as Ethereum asset URIs in the above format. Other Farcaster clients should ensure that their UIs will not break if cast embeds are not web URLs—and ideally render them as OpenSea or Etherscan links. Phase 2Once this spec is adopted by the protocol, the location of embeds in the
The embeds in the old format after the upgrade will still be readable from a field called
Once an upgrade cut-off is set (at least two weeks after hubs support the new format), casts that use the old embeds format and have a timestamp after the cut-off will be rejected by hubs. Over time, casts using the old embeds format will be pruned from hubs, so clients should plan on rendering both formats for at least one year after the upgrade (casts are pruned after one year). |
Beta Was this translation helpful? Give feedback.
-
Per latest proposal, here's a sample stub that can convert CAIP-19 asset URIs to OpenSea asset URLs. Sharing in case it is helpful for folks to plug & play right away:
|
Beta Was this translation helpful? Give feedback.
-
@pfletcherhill and I discussed offline and wanted to split this into two separate proposals: Proposal 1: Canonical URIs, a scheme for referencing urls, onchain elements and more with a flexible, evolving standard Proposal 2: URI Targets, a protocol upgrade that allows casts and reactions to point to URIs (this proposal) |
Beta Was this translation helpful? Give feedback.
-
Detailed implementation (updated 4/18)This comment aims to cover exactly what upgrades will be made to the protobuf messages and gRPC hub service. The code implementing this proposal is here: farcasterxyz/hub-monorepo#847 Message protobuf upgradesNote: fields in this note use the protobufs underscore syntax, though ts-proto generated code uses camelCase syntax (i.e. CastAddBody.embeds
The upgraded version will store
|
Beta Was this translation helpful? Give feedback.
-
Er. Greetings, fellow PFH. Github decided to tell me about this because you mentioned @pfh. |
Beta Was this translation helpful? Give feedback.
-
FIP-2: Flexible targets for messages
Title: Flexible targets for messages
Type: Implementation FIP
Author: Paul Fletcher-Hill (gh: @pfletcherhill , fc: @pfh)
Abstract
A proposal to make Casts and Reactions more flexible by allowing them to "reply" to arbitrary strings instead of Casts, and to allow Casts to embed CastIds for more efficient quoting.
Problem
Users can broadcast new content to their followers by creating casts and reactions. But users may want to have a conversation on the side about a particular topic or item without introducing it into their main feed, and delivering it only when others express interest in that topic. For example, a discussion around an NFT or a recent sports event that doesn't need to be sent to all their followers. A second issue is that users commonly want to embed other casts, but using the embed string type is very inefficient in the Hubs.
Specification
Casts and Reactions should allow a string value for parents and targets which applications can use to detect that a message is relevant only in a particular context. Applications can use schemas like FIP-1 to interpret these strings. Additionally, references to casts within casts should be made with CastIds over FIP-1 strings where possible since they take up less space and allow for indexing and enable efficient gRPC queries.
Cast and reaction protobufs should be upgraded to have embeds, parents, and targets that can be either strings or CastIds.
1. CastId support for cast embeds
Casts previously contained a string in the
embeds
field at position 1. Now, they will contain anEmbed
type in theembeds
field at position 6, and the older string embed field at position one is renamed and will be deprecated.2. String support for cast parents and reaction targets
Cast parent and reaction target types should be extended to allow strings. Similar to embeds, hubs will validate the length in bytes of these strings but not their contents. This is a backwards compatible change that will not affect older message types. However, some gRPC apis will need to be updated.
GetReactionsByCast
A new
GetReactionsByTarget
method is added and the olderGetReactionsByCast
method is deprecated. The response type of both methods will be upgraded toReactionsByTargetRequest
which contains atarget_cast_id
andtarget_url
as fields.GetReaction
GetReaction
acceptstarget_cast_id
andtarget_url
instead ofcast_id
. Backwards compatibility is preserved for this API since the field number for the cast id property remains the same.GetCastsByParent
This method now accepts
parent_cast_id
andparent_url
, whereas it previously just acceptedcast_id
. Apps using the new client should upgrade to useparent_cast_id
, though the field number is the same so old clients can still use the method without problem.Rationale
Why do CastIds need to be embedded in Casts as a native type?
While CastIds can be serialized and embedded in Casts as a string, using the native type allows more efficient storage and indexing and lookups in the Hubs in the future. This is particularly important since "quote casts" are likely a commonly used feature.
Release
FIP-2 will be included in the
2023.4.19
protocol release and implemented in v1.2.0 of Hubble which will be released on 4/19/23. Client developers will need to make several changes and it is recommended that they upgrade to the latest version of @farcaster/hub-nodejs or @farcaster/hub-web as quickly as possible.Reading from Hubs
GetReactionsByCast
must be changed toGetReactionsByTarget
before version2023.5.23
GetReactionsByTarget
should providetarget_cast_id
ortarget_url
in the request.GetCastsByParent
should provideparent_cast_id
orparent_url
in the request.GetReaction
should providetarget_cast_id
ortarget_url
in the requestembeds_deprecated
andembeds
when reading CastAdd messages since older formats will be around for a year.Most gRPC changes are backwards compatible and older clients can still read new messages from new hubs. However, they will fail validation and without changes to look for the new properties, important data might be missed.
Cast Messages that use
parent_cast_id
and reaction messages that usetarget_cast_id
will be valid in old and new hubs and will not be deprecated.Writing to Hubs
Using the latest version of the @farcaster/hub-nodejs or @farcaster/hub-web will handle most cases, but there are a few things to be aware of:
Cast Messages created with timestamps after 5/3/23 00:00 UTC (Farcaster time
73612800
) must not includeembeds_deprecated
or hey will be rejected by Hubs. The cast builder inhub-nodejs
will handle this automatically.Cast Messages created with the new
embeds
property orparent_url
and Reactions created withtarget_url
will fail validation on Hubs running protocol version2023.3.1
. Such messages should only be broadcast to hubs implementing2023.4.19
and old hubs will shut down at 4/27/23 00:00 UTC.Appendix: Target Examples
Examples of targets we want to embed, reply to, or react to:
{ fid: 2, hash: "0x2e6bc2ef8a08157144c571baeebe450e28bd7534" }
Beta Was this translation helpful? Give feedback.
All reactions