Teleporter Anycasting #180
Replies: 2 comments
-
A call out here that the publishers of the anycast data might not have any additional incentive to call Additional open questions:
|
Beta Was this translation helpful? Give feedback.
-
Idea: A pub/sub registry, one (or more) on each chain, where a contract can register to receive messages from a particular address/blockchainID combo. The contract can specify a reward, max frequency, etc. First let's think about what a rudimentary anycast with just send/receive methods on the contracts with no pub/sub would look like. I think the only param the receive method needs is the Now imagine we implement the pub/sub registry. The pubsub registry's receive method will need |
Beta Was this translation helpful? Give feedback.
-
What is anycasting?
Currently,
TeleporterMessenger
supports point-to-point messaging. Message senders specify which contract on which blockchain that they want to be called. Many applications though may not care about what the destination of a message is, they could just publish values to be consumed by any contract/chain that wants them. This is a form of "anycasting" where the sender does not care who the receiver of a message is, or if the message is delivered at all.One possible use case for anycasting is publishing price feed values from one chain to any other chain that wants to consume them. When a new subnet launches, it likely will not have direct price feed integrations on it, but it can easily consume price feeds from other chains that do have such integrations (i.e. the C-chain) using AWM.
How could anycasting be implemented?
The
AddressedCall
Warp message format defined in AvalancheGo is already generic enough to support this type of use case because it only includes information about the sender of the message, and does not include any information about the intended destination.The publishing of anycast messages could be done through an interface along the lines of:
The implementation of this function would call assign a unique ID to the message, and then submit it to the Warp precompile by calling
sendWarpMessage
.An AWM relayer instance should be configured to listen for such messages being sent from specific source chains and addresses, and to know where and how to deliver the messages when it hears of them. To make the delivery of anycast messages uniform across chains and contracts, there can be an
IAnycastReceiver
interface similar toITeleporterReceiver
that should be implemented by any contracts looking to receive these messages.Some receiving applications may have different requirements for message ordering. For instance, when receiving a price feed value you may only want whatever is the latest value, ignoring any stale values delivered. It's also possible applications would want strict ordering of all messages received, or want to be able to receive any messages that were ever sent and not care about ordering at all (an archive of sorts). Using the message ID assigned by the sender, it shouldn't be difficult to implement
AnycastLastestReceiver
,AnycastOrderedReceiver
, andAnycastArchiveReceiver
to meet each of these possible use cases.Open Questions
TeleporterMessenger
, or should there be parent contract implementations that applications can inherit from to send and receive anycast messages?TeleporterMessenger
.Beta Was this translation helpful? Give feedback.
All reactions