-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Epic: Relayer payments should be conditional on relaying #2456
Comments
I was originally thinking that this needed to be built into the mailbox, but I don't think that is the case. I.e. you can just have a middleware around the mailbox that the relayer calls, which itself is the source of truth of who processed a message |
Just to be clear it doesn't store the amount paid per message in a mapping, it just emits it And yeah you're right that you can just have a contract that the relayer calls. In v3 we could consider putting the relayer address in the It'd kinda be nice to not need to deploy another contract for each chain to get this to work well & to configure it in the relayer. So I wonder if we should just consider this change in v3 |
Thinking more about this, this feels like fundamentally the same problem as settlement oracles in UniswapX. I.e. you put up the |
IdeaQuick thought. Currently, refunding the relayer's expenses on the source chain necessitates gas/price oracles or cross-chain proofs of relaying. What if we refunded relayers on the destination chain instead? Relayer calls to IMessageRecipient(recipient).handle. The To determine the gas consumed, the The The AnalysisThe key idea is to shift the responsibility to charge the user from the Hyperlane protocol to the DApp. Hyperlane is a framework. It is always used via some DApp. Let DApps decide how and how much to charge the user on the source chain. And DApp will handle the relayers' refund then. |
I like the ability by the message recipient to fund this, it is possible to somewhat grief this prefunding however, i.e. a message sender could just send a bunch of messages from a cheap chain to this one which will cause the funds to be emptied. |
We've had a conversation in DM. I'm posting the summary of my proposal here: DApps have full control over how they charge. Controlled by the application layer, they have several options:
The relayer's refund can be a single-chain atomic operation, where the relayer delivers the message and gets refunded in one transaction. This contrasts with the current system where the relayer relies on off-chain guarantees to be refunded. This solves the challenge to refund any solver who delivers the message. |
We added the following functions to the function processor(bytes32 _id) external view returns (address) function processedAt(bytes32 _id) external view returns (uint48) The relayer can call a contract on the destination chain function claim(uint32 origin, address hook, bytes32 id) {
bytes memory claimMsg = abi.encode(id, mailbox.processor(id), mailbox.processedAt(id));
mailbox.dispatch(origin, hook, claimMsg);
} The function handle(uint32 origin, bytes32 sender, bytes claimMsg) {
(bytes32 id, address relayer, uint48 timestamp) = abi.decode(claimMsg);
// pay out id bounty to relayer (as a function of timestamp?)
} |
Have you considered if the origin chain and destination chain are different protocols? so the processor address on the destination wouldn't relate to the relayer on the origin chain |
I also feel like solutions that don't require an additional message for each message that's been processed would be much preferable. I.e. instead of claiming for a specific message, you claim for a large batch of messages |
nope, lets add
ofc you can implement batching as an optimization |
And require msg.sender to equal the processor? A little unfortunate that we wouldn't allow claiming from any key (like we do rn), but this isn't so bad
How would the batching work? I guess I'm hoping for something where you can claim for like hundreds or thousands of messages at a time |
If we really wanted to, we could have a mapping of
honestly I think this is a premature optimization but the simplest would be a eventually this could be some ZK or fancy cryptographic accumulator but I definitely wouldn't start with that |
Idk doesn't large batching feel like a requirement for costs to make sense? Imagine e.g. Ethereum -> inEVM messages, where (made up numbers) an Ethereum tx costs $30 and an inEVM tx costs $0.50. The message back to claim would be prohibitively expensive - claiming only makes sense if we have hundreds or thousands of processed txs to claim for. Or would we only want to offer this for cheap chains? Also on the origin side, is the idea we keep a mapping of id => payment so that when the claim is processed, it reads that from storage? |
Unless the message itself is high value, the originating Ethereum tx would also be prohibitively expensive
That's the simplest implementation yeah |
I think it's fair to not design for Ethereum as an origin. If this is something meant to replace our current IGP setup I'd like to see us do some cost estimates before going down a path without batching In the non-batching case, even if the origin and destination chain have a $1 tx fee, you'd need to charge a $2 IGP fee on the origin for the relayer to not lose any money |
we could do some sort of multi-merkle proof thing against the mailbox storage root |
+1 that batching can be done at the Hyperlane message processing level |
The current IGP scheme requires message senders to pay a specific relayer via their
InterchainGasPaymaster
This function currently does a bunch of things:
DefaultISMInterchainGasPaymaster
, it will consider the overhead of using the default ISM on the destination chain + mailbox.process overhead and use the amended gas amount downstreamIGasOracle
that is configured on the IGPmsg.value
on the contract and refunds the the remainder back to the `refundAddressThere are a few shortcomings of this approach:
This ticket seeks to track an improved version of a relayer payment scheme.
Alternate Approaches
IBC
IBC as the OG permissionless interoperability protocol had this problem for a while and like Hyperlane started with the simplest approach of just having some independent party running relayers for message senders for free (often paid by one/both chains to incentivize activity). It looks like the IBC folks have largely rallied around ICS29
At a high-level, it works by putting up a bounty on the origin chain. When relayers process on the destination chain, the fee middleware captures the origin chain address of the relayer (previously registered), and passes that along in the
ack
package back to the origin chain which unlocks the fee payment and gives it to the relayer. Interestingly, the spec allows for specific bounties for specific packages, i.e. for the original message, but also for theack
message back. (IBC also has timeout packages that can be paid for)Unspecified is how a sender determines a large enough bounty, as well as any refund mechanism if an overpayment has happened.
Wormhole
Wormhole originally mainly was the mechanism for it's canonical token bridge Portal (which they would run dedicated relayers for or allow for self-relaying on the token bridge UI), but has since improved their relaying:
They now have generalized relayers (which according to the docs is not yet on Mainnet). It looks pretty similar to our current system as far as I can tell.
Alternatives
The text was updated successfully, but these errors were encountered: