-
Notifications
You must be signed in to change notification settings - Fork 30
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
Dev Docs #2611
Dev Docs #2611
Changes from all commits
d10413d
730e855
3ca4d9c
3cc0667
1df400d
eec3832
2e454ed
f566278
4f6ce03
bdcacb4
a6cedda
b6a29a3
3365f4b
315cdf8
857154a
c8607f5
deac934
e325176
bdad989
2505830
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||
# Contracts | ||||||
|
||||||
Synapse CCTP contracts deployed on several chains and are documented inline. Synapse CCTP routes tokens through the CCTP module and [SynapseCCTP](https://github.com/synapsecns/synapse-contracts/blob/master/contracts/cctp/SynapseCCTP.sol) interacts with the Circle contracts to mint/burn USDC. These contracts sit on top of the Circle CCTP contracts and are responsible for minting and burning USDC on supported chains. | ||||||
|
||||||
### Synapse CCTP | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change the heading level to maintain proper semantic structure. - ### Synapse CCTP
+ ## Synapse CCTP Committable suggestion
Suggested change
|
||||||
|
||||||
| Chain | Address | | ||||||
| --------- | -------------------------------------------------------------------------------------------------------------------------------- | | ||||||
| Arbitrum | [0x12715a66773bd9c54534a01abf01d05f6b4bd35e](https://arbiscan.io/address/0x12715a66773bd9c54534a01abf01d05f6b4bd35e) | | ||||||
| Avalanche | [0x12715a66773bd9c54534a01abf01d05f6b4bd35e](https://snowtrace.io/address/0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E) | | ||||||
| Base | [0x12715a66773bd9c54534a01abf01d05f6b4bd35e](https://basescan.org/address/0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E) | | ||||||
| Ethereum | [0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E](https://etherscan.io/address/0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E) | | ||||||
| Optimism | [0x12715a66773bd9c54534a01abf01d05f6b4bd35e](https://optimistic.etherscan.io/address/0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E) | | ||||||
| Polygon | [0x12715a66773bd9c54534a01abf01d05f6b4bd35e](https://polygonscan.com/address/0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E) | | ||||||
|
||||||
## Circle Contracts | ||||||
|
||||||
Please refer to [this page](https://developers.circle.com/stablecoins/docs/evm-smart-contracts) for Circle contract addresses. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Synapse CCTP is a custom module built on top of Circle's [Cross-Chain Transfer Protocol](https://www.circle.com/en/cross-chain-transfer-protocol) that allows for bridge requests to natively mint & burn USDC on [supported chains](https://developers.circle.com/stablecoins/docs/cctp-getting-started#supported-blockchains). | ||
|
||
Synapse's CCTP implementation consists of two main components: | ||
|
||
- [CCTP Relayer](./Relayer.md): An off-chain service that fulfills transactions requested through the CCTP contracts. The relayer is responsible for fetching attestations from the [Circle API](https://developers.circle.com/stablecoin/reference) and submitting them to the CCTP contracts. Anyone can run a relayer. | ||
- [CCTP Contracts](./Contracts.md): A set of smart contracts that allow for the minting and burning of USDC on supported chains, and instant swaps to/from any supported asset. These contracts are deployed on each supported chain and are responsible for minting and burning USDC. | ||
|
||
As a modular component of Synapse's router system, CCTP can be configured to bridge through any supported liquidity source, such as [Curve](https://github.com/synapsecns/synapse-contracts/blob/885cbe06a960591b1bdef330f3d3d57c49dba8e2/contracts/router/modules/pool/curve/CurveV1Module.sol), [Algebra](https://github.com/synapsecns/synapse-contracts/blob/885cbe06a960591b1bdef330f3d3d57c49dba8e2/contracts/router/modules/pool/algebra/AlgebraModule.sol), [DAI PSM](https://github.com/synapsecns/synapse-contracts/blob/885cbe06a960591b1bdef330f3d3d57c49dba8e2/contracts/router/modules/pool/dss/DssPsmModule.sol), and others. |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,107 @@ | ||||||||||||||||||||||||||||||||||
# CCTP Relayer | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The CCTP relayer is an off-chain service aimed at fulfilling transactions requested through the [CCTP Contracts](./Contracts.md). The relayer is responsible for fetching attestations from the [Circle API](https://developers.circle.com/stablecoin/reference) and submitting them to the CCTP contracts. Anyone can run a relayer. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Architecture | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adjust heading level for "Architecture" to maintain proper semantic structure. - ### Architecture
+ ## Architecture Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The relayer is a Golang application that polls for events on chain and uses a combo state (db status) and event (on-chain logs) driven [architecture](https://medium.com/@matt.denobrega/state-vs-event-based-web-architectures-59ab1f47656b) to process transactions. The relayer is designed to be run by anyone and be easily observable. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
At a high level, the relayer works like this: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
1. Poll for new transactions from the CCTP contracts and add them to the database as [Pending](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState) | ||||||||||||||||||||||||||||||||||
2. Fetch the attestation from the Circle API. Once successful add attestation to the database and update status to be [Attested](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState) | ||||||||||||||||||||||||||||||||||
3. Submit the attestation to the CCTP contracts. Once the transaction has been added to [Submitter](../Services/Submitter.md), mark as [Submitted](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState) | ||||||||||||||||||||||||||||||||||
4. Poll for the transaction receipt and mark as [Confirmed](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState) | ||||||||||||||||||||||||||||||||||
Comment on lines
+11
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct the markdown links by adding the missing closing brackets. - [Pending](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState
+ [Pending](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState)
- [Attested](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState
+ [Attested](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState)
- [Submitted](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState
+ [Submitted](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState)
- [Confirmed](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState
+ [Confirmed](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageState) Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Modes | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
As specified by the [cctp_type](#Configuration), the CCTP relayer can be run in one of two modes. In [Synapse mode](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageType), the [Synapse CCTP](./Contracts.md)contracts are listened to and events relayed through there (including metadata). In [Circle Mode](https://pkg.go.dev/github.com/synapsecns/sanguine/services/cctp-relayer@v0.10.0/types#MessageType), raw [TokenMessenger](https://github.com/circlefin/evm-cctp-contracts/blob/817397db0a12963accc08ff86065491577bbc0e5/src/TokenMessenger.sol) events are relayed. This mode can only be used for USDC to USDC bridges and is not commonly used. | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct the link fragment to point to the valid section ID. - As specified by the [cctp_type](#Configuration)
+ As specified by the [cctp_type](#configuration) Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
## Running the Relayer | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Building From Source | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
To build the CCTP Relayer from source, you will need to clone the repository and run the main.go file with the config file. Building from source requires go 1.21 or higher and is generally not recommended for end-users. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
1. `git clone https://github.com/synapsecns/sanguine --recursive` | ||||||||||||||||||||||||||||||||||
2. `cd sanguine/services/cctp-relayer` | ||||||||||||||||||||||||||||||||||
3. `go run main.go --config /path/to/config.yaml` | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Running the Docker Image | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The CCTP Relayer can also be run with docker. To do this, you will need to pull the [docker image](https://github.com/synapsecns/sanguine/pkgs/container/sanguine%2Fcctp-relayer) and run it with the config file: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||||||
docker run ghcr.io/synapsecns/sanguine/cctp-relayer:latest --config /path/to/config | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
There is also a helm chart available for the CCTP Relayer [here](https://artifacthub.io/packages/helm/synapse/cctp/0.2.0), but it is recommended you create your own. | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Configuration | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The CCTP Relayer is configured with a yaml file. The following is an example configuration: | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
<details> | ||||||||||||||||||||||||||||||||||
<summary>example config</summary> | ||||||||||||||||||||||||||||||||||
```yaml | ||||||||||||||||||||||||||||||||||
cctp_type: "synapse" | ||||||||||||||||||||||||||||||||||
# prod contract addresses | ||||||||||||||||||||||||||||||||||
chains: | ||||||||||||||||||||||||||||||||||
- chain_id: 1 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
- chain_id: 43114 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
- chain_id: 42161 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
- chain_id: 10 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
- chain_id: 8453 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
- chain_id: 137 | ||||||||||||||||||||||||||||||||||
synapse_cctp_address: "0x12715a66773BD9C54534a01aBF01d05F6B4Bd35E" | ||||||||||||||||||||||||||||||||||
base_omnirpc_url: "http://omnrpc-url/" | ||||||||||||||||||||||||||||||||||
unbonded_signer: | ||||||||||||||||||||||||||||||||||
type: "AWS" | ||||||||||||||||||||||||||||||||||
# should be a mounted secret | ||||||||||||||||||||||||||||||||||
file: "/config/aws.txt" | ||||||||||||||||||||||||||||||||||
http_backoff_initial_interval_ms: 1000 | ||||||||||||||||||||||||||||||||||
http_backoff_max_elapsed_time_ms: 300000 | ||||||||||||||||||||||||||||||||||
# submitter config for cctp | ||||||||||||||||||||||||||||||||||
submitter_config: | ||||||||||||||||||||||||||||||||||
chains: | ||||||||||||||||||||||||||||||||||
1: | ||||||||||||||||||||||||||||||||||
supports_eip_1559: true | ||||||||||||||||||||||||||||||||||
gas_estimate: 1000000 | ||||||||||||||||||||||||||||||||||
42161: | ||||||||||||||||||||||||||||||||||
gas_estimate: 30000000 | ||||||||||||||||||||||||||||||||||
max_gas_price: 10000000000 | ||||||||||||||||||||||||||||||||||
supports_eip_1559: true | ||||||||||||||||||||||||||||||||||
43114: | ||||||||||||||||||||||||||||||||||
gas_estimate: 5000000 | ||||||||||||||||||||||||||||||||||
max_gas_price: 1000000000000 | ||||||||||||||||||||||||||||||||||
supports_eip_1559: true | ||||||||||||||||||||||||||||||||||
10: | ||||||||||||||||||||||||||||||||||
gas_estimate: 5000000 | ||||||||||||||||||||||||||||||||||
max_gas_price: 2000000000 | ||||||||||||||||||||||||||||||||||
supports_eip_1559: true | ||||||||||||||||||||||||||||||||||
8453: | ||||||||||||||||||||||||||||||||||
gas_estimate: 5000000 | ||||||||||||||||||||||||||||||||||
137: | ||||||||||||||||||||||||||||||||||
gas_estimate: 5000000 | ||||||||||||||||||||||||||||||||||
max_gas_price: 10000000000000 | ||||||||||||||||||||||||||||||||||
supports_eip_1559: true | ||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||
</details> | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
- `cctp_type`: The type of CCTP to listen to. Can be either `synapse` or `circle`. | ||||||||||||||||||||||||||||||||||
- `chains`: A list of chain ids and their corresponding CCTP contract addresses. If synapse mode, this should be `synapse_cctp_address` and if circle mode, this should be `token_messenger_address`. Both modes cannot be used at once and the other will be ignored if both are set. | ||||||||||||||||||||||||||||||||||
- `base_omnirpc_url`: The base URL for the OmniRPC service. | ||||||||||||||||||||||||||||||||||
- `unbonded_signer`: The signer to use for transactions. Can be either `AWS`, `File` or `GCP`. The file should be a mounted secret. More details can be found [here](../Services/Signer). | ||||||||||||||||||||||||||||||||||
- `port`: The port to run the relayer on (e.g. 8080) | ||||||||||||||||||||||||||||||||||
- `host`: The host to run the relayer on (e.g. localhost). Note: this should not be publicly exposed | ||||||||||||||||||||||||||||||||||
- `http_backoff_initial_interval_ms`: The initial interval for the backoff in milliseconds. | ||||||||||||||||||||||||||||||||||
- `retry_interval_ms`: The interval to wait between attestation request retries in milliseconds. The [CCTP API Rate Limit](https://developers.circle.com/stablecoins/docs/limits) should be kept in mind. | ||||||||||||||||||||||||||||||||||
Comment on lines
+96
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct the indentation of the unordered list items to align with Markdown standards. - - `cctp_type`: The type of CCTP to listen to. Can be either `synapse` or `circle`.
- - `chains`: A list of chain ids and their corresponding CCTP contract addresses. If synapse mode, this should be `synapse_cctp_address` and if circle mode, this should be `token_messenger_address`. Both modes cannot be used at once and the other will be ignored if both are set.
- - `base_omnirpc_url`: The base URL for the OmniRPC service.
- - `unbonded_signer`: The signer to use for transactions. Can be either `AWS`, `File` or `GCP`. The file should be a mounted secret. More details can be found [here](../Services/Signer).
- - `port`: The port to run the relayer on (e.g. 8080)
- - `host`: The host to run the relayer on (e.g. localhost). Note: this should not be publicly exposed
- - `http_backoff_initial_interval_ms`: The initial interval for the backoff in milliseconds.
- - `retry_interval_ms`: The interval to wait between attestation request retries in milliseconds. The [CCTP API Rate Limit](https://developers.circle.com/stablecoins/docs/limits) should be kept in mind.
+ - `cctp_type`: The type of CCTP to listen to. Can be either `synapse` or `circle`.
+ - `chains`: A list of chain ids and their corresponding CCTP contract addresses. If synapse mode, this should be `synapse_cctp_address` and if circle mode, this should be `token_messenger_address`. Both modes cannot be used at once and the other will be ignored if both are set.
+ - `base_omnirpc_url`: The base URL for the OmniRPC service.
+ - `unbonded_signer`: The signer to use for transactions. Can be either `AWS`, `File` or `GCP`. The file should be a mounted secret. More details can be found [here](../Services/Signer).
+ - `port`: The port to run the relayer on (e.g. 8080)
+ - `host`: The host to run the relayer on (e.g. localhost). Note: this should not be publicly exposed
+ - `http_backoff_initial_interval_ms`: The initial interval for the backoff in milliseconds.
+ - `retry_interval_ms`: The interval to wait between attestation request retries in milliseconds. The [CCTP API Rate Limit](https://developers.circle.com/stablecoins/docs/limits) should be kept in mind. Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
### Observability | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
The CCTP relayer implements open telemetry for both tracing and metrics. Please see the [Observability](../Observability) page for more info. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "CCTP", | ||
"position": 3, | ||
"link": { | ||
"type": "doc", | ||
"id": "CCTP/Overview" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
All off-chain systems are by default observable and configured through the [metrics](https://pkg.go.dev/github.com/synapsecns/sanguine/core/metrics#section-readme) package. The observability stack is built around [open telemetry](https://opentelemetry.io/) with metrics also being exported using this standard. | ||
|
||
"Metrics" themselves are divided into 3 different types of metrics: | ||
|
||
1. **Traces**: These are used to trace the flow of a request through the system. Our code uses traces for all sorts of events, from the start of a request to the end of a request. Traces are used to debug and profile the system. Traces are made up of spans, which are individual events that occur during the lifetime of a trace. Traces are aggregated ex-post facto by observability solutions. Please see [this article](https://grafana.com/docs/tempo/latest/traces/) for a good overview. | ||
2. **Metrics**: Metrics consist of things like gauges, counters, and histograms. These are used to monitor the health of the system. Metrics are aggregated in real-time by observability solutions. Please see [this article](https://grafana.com/docs/grafana-cloud/metrics/) for a good overview. We use the Prometheus exporter for metrics and by default make them available on `METRICS_PORT` at `METRICS_PATH`. | ||
3. **APM (Application Performance Monitoring)**: APM is a combination of traces and metrics. It is used to monitor the performance of the system. We use Pyroscope for APM and by default make it available on `PYROSCOPE_ENDPOINT`. | ||
|
||
:::tip | ||
Sanguine is an open-source repo and tries to be as unopinionated as possible when it comes to which libraries it uses for observability. If you're interested in maintaining an unsupported module as part of the [metrics](https://pkg.go.dev/github.com/synapsecns/sanguine/core/metrics#section-readme) package, pull requests are always welcome! | ||
::: | ||
|
||
### Configuring Observability | ||
|
||
**Configuring Tracing**: | ||
|
||
1. Pick a vendor that supports the [OTLP](https://opentelemetry.io/ecosystem/vendors/) standard. We recommend Signoz for OSS. | ||
2. Set the `METRICS_HANDLER` environment variable to `OTLP`. If you're using a legacy jaeger instance, you can also use `JAEGER` | ||
3. Set the `OTLP_ENDPOINT` environment variable to the endpoint of your observability solution. | ||
|
||
**Configuring Metrics** | ||
|
||
1. Pick a vendor that supports the [prometheus](https://prometheus.io/docs/instrumenting/exporters/) standard. We recommend Grafana for OSS. | ||
2. Set the `METRICS_PORT_ENABLED` environment variable to `true` to enable the metrics endpoint. | ||
3. Find your metrics on `METRICS_PORT` at `METRICS_PATH` and configure scrapers. | ||
|
||
**Configuring APM** | ||
|
||
Set the `PYROSCOPE_ENDPOINT` environment variable to the endpoint of your [pyroscope instance](https://pyroscope.io/). |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,77 @@ | ||||||||||||||||||||||||||||||
Omnirpc is an rpc load balancer and verifier that allows users to query chain data from multiple chains. It is a service that should be run by Quoters and interfaces that allow Solvers to post quotes. Omnirpc takes in a yaml config that allows the user to specify which chains it should run on. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Running OmniRPC | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Building From Source | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
To build omnirpc from source, you will need to have Go installed. You can install Go by following the instructions [here](https://golang.org/doc/install). Once you have Go installed, you can build the relayer by running the following commands: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
1. `git clone https://github.com/synapsecns/sanguine --recursive` | ||||||||||||||||||||||||||||||
2. `cd sanguine/services/omnirpc` | ||||||||||||||||||||||||||||||
3. `go run main.go --config /path/to/config.yaml` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Running the Docker Image | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
The relayer can also be run with docker. To do this, you will need to pull the [docker image](https://github.com/synapsecns/sanguine/pkgs/container/sanguine%2Frfq-relayer) and run it with the config file: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||
docker run ghcr.io/synapsecns/sanguine/omnirpc:latest --config /path/to/config | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
There is also a helm chart available for omnirpc [here](https://artifacthub.io/packages/helm/synapse/omnirpc). | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
### Configuration | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Omnirpc is configured with a yaml file. The following is an example configuration: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```yaml | ||||||||||||||||||||||||||||||
chains: | ||||||||||||||||||||||||||||||
1: | ||||||||||||||||||||||||||||||
rpcs: | ||||||||||||||||||||||||||||||
- https://api.mycryptoapi.com/eth | ||||||||||||||||||||||||||||||
- https://rpc.flashbots.net/ | ||||||||||||||||||||||||||||||
- https://eth-mainnet.gateway.pokt.network/v1/5f3453978e354ab992c4da79 | ||||||||||||||||||||||||||||||
- https://cloudflare-eth.com/ | ||||||||||||||||||||||||||||||
- https://mainnet-nethermind.blockscout.com/ | ||||||||||||||||||||||||||||||
- https://nodes.mewapi.io/rpc/eth | ||||||||||||||||||||||||||||||
- https://main-rpc.linkpool.io/ | ||||||||||||||||||||||||||||||
- https://mainnet.eth.cloud.ava.do/ | ||||||||||||||||||||||||||||||
- https://ethereumnodelight.app.runonflux.io | ||||||||||||||||||||||||||||||
- https://rpc.ankr.com/eth | ||||||||||||||||||||||||||||||
- https://eth-rpc.gateway.pokt.network | ||||||||||||||||||||||||||||||
- https://main-light.eth.linkpool.io | ||||||||||||||||||||||||||||||
- https://eth-mainnet.public.blastapi.io | ||||||||||||||||||||||||||||||
- http://18.211.207.34:8545 | ||||||||||||||||||||||||||||||
- https://eth-mainnet.nodereal.io/v1/1659dfb40aa24bbb8153a677b98064d7 | ||||||||||||||||||||||||||||||
- wss://eth-mainnet.nodereal.io/ws/v1/1659dfb40aa24bbb8153a677b98064d7 | ||||||||||||||||||||||||||||||
- https://api.bitstack.com/v1/wNFxbiJyQsSeLrX8RRCHi7NpRxrlErZk/DjShIqLishPCTB9HiMkPHXjUM9CNM9Na/ETH/mainnet | ||||||||||||||||||||||||||||||
confirmations: 5 | ||||||||||||||||||||||||||||||
10: | ||||||||||||||||||||||||||||||
rpcs: | ||||||||||||||||||||||||||||||
- https://mainnet.optimism.io | ||||||||||||||||||||||||||||||
confirmations: 1 | ||||||||||||||||||||||||||||||
# port to run on | ||||||||||||||||||||||||||||||
port: 5000 | ||||||||||||||||||||||||||||||
# expressed in seconds | ||||||||||||||||||||||||||||||
refreshInterval: 60 | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
In this example, any request to ethereum (chain id: 1) will need at least 5 rpcs to agree on the data before it is considered valid, but op will only need 1. | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Data can be fetched like so, where the last character is the chain id: | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
```bash | ||||||||||||||||||||||||||||||
curl --location --request POST 'http://localhost:5000/rpc/1' \ | ||||||||||||||||||||||||||||||
--header 'Content-Type: application/json' \ | ||||||||||||||||||||||||||||||
--data-raw '{ | ||||||||||||||||||||||||||||||
"jsonrpc":"2.0", | ||||||||||||||||||||||||||||||
"method":"eth_getTransactionCount", | ||||||||||||||||||||||||||||||
"params":[ | ||||||||||||||||||||||||||||||
"0x230a1ac45690b9ae1176389434610b9526d2f21b", | ||||||||||||||||||||||||||||||
"0xec1d40" | ||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||
"id":1 | ||||||||||||||||||||||||||||||
Comment on lines
+67
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace hard tabs with spaces in the code block for consistency and to adhere to common Markdown practices. - "jsonrpc":"2.0",
- "method":"eth_getTransactionCount",
- "params":[
- "0x230a1ac45690b9ae1176389434610b9526d2f21b",
- "0xec1d40"
- ],
- "id":1
+ "jsonrpc":"2.0",
+ "method":"eth_getTransactionCount",
+ "params":[
+ "0x230a1ac45690b9ae1176389434610b9526d2f21b",
+ "0xec1d40"
+ ],
+ "id":1 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
}' | ||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Not all requests are confirmable. Please see [here](https://pkg.go.dev/github.com/synapsecns/sanguine/services/omnirpc#section-readme) for details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Signer | ||
|
||
This section is still in progress, please see [here](https://pkg.go.dev/github.com/synapsecns/sanguine/ethergo@v0.9.0/signer/signer#section-readme) for details. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,7 @@ | ||||||
# Submitter | ||||||
|
||||||
This section is still in progress, please see [here](https://pkg.go.dev/github.com/synapsecns/sanguine/ethergo/submitter#section-readme) for details. | ||||||
|
||||||
### Submitter Config | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change heading level from h3 to h2 for consistency. - ### Submitter Config
+ ## Submitter Config Committable suggestion
Suggested change
|
||||||
|
||||||
This section is still in progress, please see [here](https://pkg.go.dev/github.com/synapsecns/sanguine/ethergo@v0.9.0/submitter/config) for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the TODO comment or implementing the suggested action to ensure documentation completeness.
Would you like me to help implement this CI task or should we track this with a GitHub issue?