Skip to content
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

Split out Wormhole relayer #1284

Merged
merged 19 commits into from
Sep 23, 2024
Merged

Split out Wormhole relayer #1284

merged 19 commits into from
Sep 23, 2024

Conversation

area
Copy link
Member

@area area commented Aug 6, 2024

With the current multichain functionality, we focussed on the contracts and not on the additional infrastructure around it. This PR is intended to at least create the scaffolding for that infrastructure, which we can hopefully build on.

As it stands, the mockBridgeMonitor script represents three components of the Wormhole system:

  1. The Guardian Network - these are the trusted 'oracles' of the network, who sign attestations that messages have been emitted on a particular chain
  2. The Spy - this is something that monitors the guardian network for messages of interest
  3. The Relayer - this is something that listens for messages from the spy and relays them to the other chain(s)

We certainly aren't going to be responsible for the Guardian Network. We might end up running our own spy. However, we will certainly need our own relayer to deliver the desired experience for people - they sign a message on one chain and it appears on the other chain, with no further interaction from them. This ends up very similar to the Metatransaction Broadcaster - they execute a transaction that emits an event on one chain, and the relayer ends up executing a transaction on the other chain, paying for gas.

This PR splits out the relayer from the mockBridgeMonitor script, and has it running in a separate process, communicating with the spy via the protocol that it would use in a real deployment. This give us a platform to build a robust relayer on as we go forward. The relayer is extremely simple at the moment. One thing that we had avoided doing 'properly' previously was considering VAAs, but given the libraries being used expect to see VAAs at various points, I've had to do those much more 'properly'.

Some of the changes here we just... stumbled across being necessary. Changing providers to use RetryProvider where I could is certainly something that coul be in a separate PR (and will move if desired), but splitting this relayer out made us more sensitive to connection errors during builds, somehow? We also started to reliably run across issues with hardhat's memory usage during the cross-chain tests, which we've avoided for now by deleting the build-info between the two sets of tests. It feels like that's not going to be able to be a long-term solution, but it's what we've got for now.

There's a lot here, so keen to answer questions and get this in to a mergeable (and understandable) state.

@area area changed the title Feat/wormhole relayer 2 Split out Wormhole relayer Aug 6, 2024
@area area mentioned this pull request Aug 9, 2024
1 task
@area area force-pushed the feat/wormhole-relayer-2 branch 2 times, most recently from dfd2a32 to 7828db3 Compare August 9, 2024 15:15
Copy link
Member

@kronosapiens kronosapiens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Why write it in typescript? Was it needed to use the libraries, or just a good opportunity to try it out?

@area
Copy link
Member Author

area commented Aug 26, 2024

Nice. Why write it in typescript? Was it needed to use the libraries, or just a good opportunity to try it out?

It wasn't needed, but was certainly helpful for some of this. I also think it's just better for things being deployed to production.

@area area force-pushed the feat/wormhole-relayer-2 branch 4 times, most recently from 69de687 to 5cc2bc9 Compare September 13, 2024 13:22
@area
Copy link
Member Author

area commented Sep 13, 2024

We also started to reliably run across issues with hardhat's NomicFoundation/hardhat#3471 during the cross-chain tests, which we've avoided for now by deleting the build-info between the two sets of tests. It feels like that's not going to be able to be a long-term solution, but it's what we've got for now.

With these last changes, we've started running in to this even for the first run of the tests, so deleting the build-info was no longer sufficient. I don't like it, but I've upped the resource class for the coverage-test-bridging job to large, which has resolved the issue.

@area area force-pushed the feat/wormhole-relayer-2 branch from 5cc2bc9 to 2ee1eff Compare September 16, 2024 06:20
@area area marked this pull request as ready for review September 16, 2024 15:40
Copy link
Member

@kronosapiens kronosapiens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! A few minor comments.

@kronosapiens kronosapiens merged commit e126a9e into develop Sep 23, 2024
2 checks passed
@kronosapiens kronosapiens deleted the feat/wormhole-relayer-2 branch September 23, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants