FIP: Countable Messages (Leaderboard Events) #95
Replies: 5 comments 15 replies
-
Interesting proposal. A few questions:
|
Beta Was this translation helpful? Give feedback.
-
Adding this message type should enable more developers to build apps that are orthogonal to Warpcast. |
Beta Was this translation helpful? Give feedback.
-
Just read through the proposal, my initial reaction is that the design seems way more complicated than what the problem outlined needs. If you want to build a leaderboard, couldn't we just get away with a message with a simple signed integer, numeric type? Apps can issue "delta counts" periodically, and you just sum them up to get the current count. LMK if I'm missing some use cases that you're thinking of here. |
Beta Was this translation helpful? Give feedback.
-
Closing due to inactivity |
Beta Was this translation helpful? Give feedback.
-
Abstract
Leaderboards enable Farcaster clients to build social components that promote gamification, engagement, and discovery. The frequency of updates (write operations) necessary to keep leaderboards up-to-date in real-time make leaderboards difficult and cost prohibitive to maintain on-chain.
Hubs, on the other hand, are well-suited for real-time updates:
Terms
Proposal
Farcaster should define a
MessageData
format designed for arithmetic to enable the construction of arbitrary leaderboards.[Insert picture of many nodes labeled countable nodes with numbers all pointing to a single node labeled target]
=>
[Insert picture of a leaderboard titled target with row values of the countable nodes rendered by a Farcaster client]
Specification
I propose to introduce a new countable message type, which defines a countably finite set, that represents an arithmetic delta a user may accrue in relation to another user, a cast, or some FIP-2 compatible embed. Leaderboards can be constructed by aggregating a collection of countable messages (series of arithmetic deltas) of the same target(s). We define the necessary protos as follows:
Message Validation
primary_target
orsecondary_target
is aCastID
embed, validate that theCastID
existsprimary_target
orsecondary_target
is afid
, validate that thefid
is registeredorigin_meta
can be at most 128 bytes (Rationale: We give enough room for an ECDSA signature — 65 bytes, we leave 63 bytes for other kinds of metadata)signature_scheme
of the countable message must beSIGNATURE_SCHEME_ED25519
Countable CRDT Limits
primary_target
size limit of 300 (Rationale: I chose based on the number of Game 5 NFT mints)Countable APIs
Hubs must also provide the following APIs to fetch + stream countable messages:
Out of Scope
Long-term persistence
Clients should expect hubs to persist countable messages for a finite duration. For long-running leaderboards, clients should consume countables as ephemeral events and persist countable messages outside of hubs.
Ordering by countable value
Clients should not rely on hubs for reliable ordering of countable messages by their values. Algorithms used to determine the ordering of countable messages (or collections of countable messages) by value may vary from client to client.
Trust model for timestamps
Currently, timestamps are user-reported. We should explore a better trust model for timestamps at the protocol level such as application specific signers at a later time. For now, clients are free to submit a verifiable app-specific signature in
origin_meta
, and publish its signing key somewhere for other clients to verify that the counting message was produced from a particular client.Recounting
In the event of network failures (or other failures), consuming clients may miss countable messages that fall out of the CRDT limit.
Consuming clients should be able to send a request to the originating client for a recount.
We can introduce a recount CRDT message set, where consuming clients ask the originating client to re-publish the updated countable message set for requested targets. The proto message for the recounts may look like:
After receiving the recount message, the originating client should publish countable messages with the
UPSERT
operator for consuming clients to update their countable set. (We may need to augment theCountableAddBody
message with additional fields for recounts to be handled properly, but we'll leave that out of scope.)There aren't enough clients on the Farcaster network today, so requests for recounts can be done ad-hoc outside of Hubs. Also, app-specific signatures on the protocol level would help consuming clients verify that countable messages submitted for recount were submitted by the same originating client.
Other Use Cases
Beta Was this translation helpful? Give feedback.
All reactions