constants.proto to define protocol constants#542
Conversation
FARCASTER_EPOCH = 1609459200
|
@vrypan is attempting to deploy a commit to the farcaster Team on Vercel. A member of the Team first needs to authorize it. |
|
Defining these values at the protobuf level allows easier upgrades to the protocol, if developers use them. For example, changing the size of casts, the max number of embeds, etc, will be automatic when developers upgrade to the newer version, if instead of defining their own constants (up to two embeds per cast, for example), they use the protocol constants. |
|
Hmm, I like the idea, but not sure protobuf enums are the right fit. Maybe it can be a config file. Let me think about this. |
|
Since we define the protocol in protobufs, this is the protobuff-native hack :-) to define constants... A config file will have to be fetched and parsed, etc, ie one more dependency and possible point of failure. the only problem I see is that you can't have two constants in the same group, with the same value (I think so). |
|
How about this. The comment is a serialized version of a populated instance of Constants. A cleaner way would be to have a GetConstants() endpoint return these. |
When using protocol messages, I always have to check and redefine FARCASTER_EPOCH, sometimes in multiple modules in my code.
This PR introduces an idiomatic way to define such constants and make them available to any protobuf consumer (
CONST_FARCASTER_EPOCHin this case).Other constants, such as cast size, longcast size, etc could be added to make it easy for developer to access them.