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

Cleanup config #206

Merged
merged 13 commits into from
Mar 4, 2024
63 changes: 19 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ See the [Building](#building) section for instructions on how to build the relay
- platform.validatedBy
- platform.getValidatorsAt OR platform.getCurrentValidators

The Fuji and Mainnet [public API nodes](https://docs.avax.network/tooling/rpc-providers) provided by Avalanche have these methods enabled, and are suitable for use with the relayer.

## Usage

### Building
Expand Down Expand Up @@ -90,25 +92,22 @@ The relayer binary accepts a path to a JSON configuration file as the sole argum

The relayer is configured via a JSON file, the path to which is passed in via the `--config-file` command line argument. The following configuration options are available:

`"log-level": "debug" | "info" | "warn" | "error" | "fatal" | "panic"`
`"log-level": "verbo" | "debug" | "info" | "warn" | "error" | "fatal" | "panic"`

- The log level for the relayer. Defaults to `info`.

`"network-id": unsigned integer`

- The ID of the Avalanche network to which the relayer will connect. Defaults to `1` (Mainnet).

`"p-chain-api-url": string`

- The URL of the Avalanche P-Chain API node to which the relayer will connect. This API node needs to have the following methods enabled:
- info.peers
- platform.getHeight
- platform.validatedBy
- platform.getValidatorsAt

`"encrypt-connection": boolean`
`"info-api-url": string`

Choose a reason for hiding this comment

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

i'm not too familiar with the info api nodes, is it common for the p chain api node to have info api enabled as well?

Choose a reason for hiding this comment

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

thinking if worth have more documentation about how to find their info api node, or whether to add a comment about testing with the p chain api node

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's entirely up to the node operator which APIs to support. The P-Chain and Info APIs are independent, so we shouldn't assume that they'll both be enabled on the same node here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The public APIs support both the info endpoints and most of the P-chain endpoints (with the exception of getValidatorsAt.

$ curl 'https://api.avax-test.network/ext/info' \
> --header 'Content-Type: application/json' \
> --data '{
>     "jsonrpc":"2.0",
>     "id"     :1,
>     "method" :"info.getNetworkID"
> }'
{"jsonrpc":"2.0","result":{"networkID":"5"},"id":1}

I probably would have gone the route of having a single avalancheAPIURL configuration option and adding the path extensions as needed in the application, but not opposed to having these split up in the event that the node used for the P-chain API (possibly private node) doesn't have the Info API enabled (all public APIs have the Info API available).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, in the case of the public API, both the info and P-chain API share the same base URL. That's not true in general though, so I think it's better to make as few assumptions here as we can.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, totally agree. Thanks for elaborating.

Choose a reason for hiding this comment

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

is there any additional comment/documentation we can add for finding the info api, or is this relatively understood/straightforward for node operators?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is the place to dive too deeply into API availability. We can add a note that the public API should support the required methods though.

Choose a reason for hiding this comment

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

makes sense, I agree


- Whether or not to encrypt the connection to the P-Chain API node. Defaults to `true`.
- The URL of the Avalanche Info API node to which the relayer will connect. This API node needs to have the following methods enabled:
- info.peers
- info.getNetworkID

`"storage-location": string`

Expand Down Expand Up @@ -142,45 +141,33 @@ The relayer is configured via a JSON file, the path to which is passed in via th

- The address of the destination account that will receive the Warp message.

`"source-subnets": []SourceSubnets`
`"source-blockchains": []SourceBlockchains`

- The list of source subnets to support. Each `SourceSubnet` has the following configuration:
- The list of source subnets to support. Each `SourceBlockchain` has the following configuration:

`"subnet-id": string`

- cb58-encoded Subnet ID
- cb58-encoded Subnet ID.

`"blockchain-id": string`

- cb58-encoded Blockchain ID
- cb58-encoded Blockchain ID.

`"vm": string`

- The VM type of the source subnet.

`"api-node-host": string`

- The host of the source subnet's API node.

`"api-node-port": unsigned integer`

- The port of the source subnet's API node.

`"encrypt-connection": boolean`

- Whether or not to encrypt the connection to the source subnet's API node.

`"rpc-endpoint": string`

- The RPC endpoint of the source subnet's API node. Used in favor of `api-node-host`, `api-node-port`, and `encrypt-connection` when constructing the endpoint
- The RPC endpoint of the source subnet's API node.

`"ws-endpoint": string`

- The WebSocket endpoint of the source subnet's API node. Used in favor of `api-node-host`, `api-node-port`, and `encrypt-connection` when constructing the endpoint
- The WebSocket endpoint of the source subnet's API node.

`"message-contracts": map[string]MessageProtocolConfig`

- Map of contract addresses to the config options of the protocol at that address. Each `MessageProtocolConfig` consists of a unique `message-format` name, and the raw JSON `settings`
- Map of contract addresses to the config options of the protocol at that address. Each `MessageProtocolConfig` consists of a unique `message-format` name, and the raw JSON `settings`.

`"supported-destinations": []string`

Expand All @@ -190,37 +177,25 @@ The relayer is configured via a JSON file, the path to which is passed in via th

- The block height at which to back-process transactions from the source subnet. If the database already contains a later block height for the source subnet, then that will be used instead. Must be non-zero.

`"destination-subnets": []DestinationSubnets`
`"destination-blockchains": []DestinationBlockchains`

- The list of destination subnets to support. Each `DestinationSubnet` has the following configuration:
- The list of destination subnets to support. Each `DestinationBlockchain` has the following configuration:

`"subnet-id": string`

- cb58-encoded Subnet ID
- cb58-encoded Subnet ID.

`"blockchain-id": string`

- cb58-encoded Blockchain ID
- cb58-encoded Blockchain ID.

`"vm": string`

- The VM type of the source subnet.

`"api-node-host": string`

- The host of the source subnet's API node.

`"api-node-port": unsigned integer`

- The port of the source subnet's API node.

`"encrypt-connection": boolean`

- Whether or not to encrypt the connection to the source subnet's API node.

`"rpc-endpoint": string`

- The RPC endpoint of the destination subnet's API node. Used in favor of `api-node-host`, `api-node-port`, and `encrypt-connection` when constructing the endpoint
- The RPC endpoint of the destination subnet's API node.

`"account-private-key": string`

Expand Down
Loading