From fd2fd86746ec91c8ce4e6c345cf925d6dbbd07a7 Mon Sep 17 00:00:00 2001 From: Vincent Geddes <117534+vgeddes@users.noreply.github.com> Date: Sun, 31 Mar 2024 18:50:57 +0200 Subject: [PATCH 1/3] Make gopls work in VS Code (#1166) --- go.work | 3 +++ go.work.sum | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 go.work create mode 100644 go.work.sum diff --git a/go.work b/go.work new file mode 100644 index 0000000000..dc4f7fca0e --- /dev/null +++ b/go.work @@ -0,0 +1,3 @@ +go 1.20 + +use ./relayer diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000000..c799d27f1b --- /dev/null +++ b/go.work.sum @@ -0,0 +1,39 @@ +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= +github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From 8ab0d56b56d76d2b38af5c0701b16814f59ab3c3 Mon Sep 17 00:00:00 2001 From: Clara van Staden Date: Wed, 3 Apr 2024 12:46:30 +0000 Subject: [PATCH 2/3] GITBOOK-73: Relayer and Lodestar runbook --- docs/SUMMARY.md | 1 + ...initial-deployment-of-gateway-contracts.md | 5 +- docs/runbooks/run-relayers.md | 133 ++++++++++++++++++ 3 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 docs/runbooks/run-relayers.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 4a78f8ba83..767305de6d 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -41,3 +41,4 @@ * [Initial Deployment of Gateway Contracts](runbooks/initial-deployment-of-gateway-contracts.md) * [Halt Bridge in Case of Emergency](runbooks/halt-bridge-in-case-of-emergency.md) * [Contract Upgrades](runbooks/contract-upgrades.md) +* [Run Relayers](runbooks/run-relayers.md) diff --git a/docs/runbooks/initial-deployment-of-gateway-contracts.md b/docs/runbooks/initial-deployment-of-gateway-contracts.md index ae5db71fa2..c182e5b4ff 100644 --- a/docs/runbooks/initial-deployment-of-gateway-contracts.md +++ b/docs/runbooks/initial-deployment-of-gateway-contracts.md @@ -1,7 +1,8 @@ --- description: >- - How to upgrade the Ethereum gateway controlling the bridge on the Ethereum - side. + How to set the Ethereum gateway controlling the bridge on the Ethereum side. + This guide is specifically for setting the gateway address when deployed + initially, not when the contracts are upgraded. --- # Initial Deployment of Gateway Contracts diff --git a/docs/runbooks/run-relayers.md b/docs/runbooks/run-relayers.md new file mode 100644 index 0000000000..269daf3a97 --- /dev/null +++ b/docs/runbooks/run-relayers.md @@ -0,0 +1,133 @@ +--- +description: How to run relayers that are rewarded for relaying bridge messages +--- + +# Run Relayers + +## Snowbridge Infra Suite Repository + +This guide references Github repository [Snowfork/snowbridge-infra-suite](https://github.com/Snowfork/snowbridge-infra-suite) for example scripts and config files. + +Clone this repository on your server. + +``` +git clone https://github.com/Snowfork/snowbridge-infra-suite.git +``` + +## Relayer Binary + +### Build Relayer + +To build the relayer from source, follow these steps. + +1. [Install Mage](https://github.com/magefile/mage?tab=readme-ov-file#installation) +2. Clone Snowbridge repository and build the relayer + +``` +git clone https://github.com/Snowfork/snowbridge.git +cd snowbridge/relayer +mage build +``` + +The relayer binary will be built at `build/snowbridge-relay`. Copy the binary over to the snowbridge-infra-suite directory + +``` +cp build/snowbridge ../../snowbridge-infra-suite +``` + +### Docker + +TODO update docker release + +``` +docker pull ghcr.io/snowfork/snowbridge-relay:169e308 +``` + +## Private Keys + +You will need the follow private keys for the relayers: + +1. Ethereum private keys for + 1. the BEEFY relayer + 2. the Parachain relayer (x2 keys - one for the primary governance channel and one for the secondary governance channel) +2. Polkadot private keys for + 1. the Beacon relayer + 2. the Execution relayer + +Add the private key files in directory `keys` in `snowbridge-infra-suite`. Create the following key files: + +* beefy-relayer.key +* parachain-0-relayer.key (primary governance) +* parachain-1-relayer.key (secondary governance) +* beacon-relayer.key +* execution-relayer.key + +These keys are used by the scripts. + +## BEEFY Relayer + +The BEEFY relayer relays BEEFY commitments to track consensus on Polkadot. + +To run the BEEFY relayer, run script `/scripts/start-beefy-relayer.sh` in `snowbridge-infra-suite`. + +It expects: + +* A config file at `./config/beefy-relayer.json` Set the following values in the config file: + * `BeefyClient`: The contract address where the BeefyClient is deployed. + * `beefy-activation-block`: The beefy block to start syncing from. + * `endpoint`: Both the Polkadot and Ethereum nodes to connect to. + * `gas-limit`: The Ethereum gaslimit to limit the gas used per transaction. +* An Ethereum private key file at `./keys/beefy-relayer.key` + +## Parachain Relayer + +The Parachain relayer relays messages from Polkadot to Ethereum for a certain channel. You need to run a relayer per channel that you would like to support. + +To run the Parachain relayer, run script `/scripts/start-parachain-relayer.sh 0` in `snowbridge-infra-suite`. + +It expects: + +* A config file at `./config/parachain-0-relayer.json` Set the following values in the config file: + * `BeefyClient`: The contract address where the BeefyClient is deployed. + * `Gateway`: The contract address where the Gateway contract is deployed. + * `beefy-activation-block`: The beefy block to start syncing from. + * `endpoint`: All the endpoints for the respective chains. + * `channel-id:` The channel of the messages that will be relayed. + * `gas-limit`: The Ethereum gaslimit to limit the gas used per transaction. +* An Ethereum private key file at `./keys/parachain-0-relayer.key` + +## Beacon Relayer + +The Beacon relayer relays consensus updates on Ethereum to Polkadot. + +To run the Beacon relayer, run script `/scripts/start-beacon-relayer.sh` in `snowbridge-infra-suite`. + +It expects: + +* A config file at `./config/parachain-0-relayer.json` Set the following values in the config file: + * `endpoint`: Both the Polkadot and Ethereum nodes to connect to. +* A Polkadot private key file at `./keys/beacon-relayer.key` + +## Execution Relayer + +The Execution relayer relays messages from Ethereum to Polkadot for a certain channel. You need to run a relayer per channel that you would like to support. + +To run the Beacon relayer, run script `/scripts/start-execution-relayer.sh` in `snowbridge-infra-suite`. + +It expects: + +* A config file at `./config/parachain-0-relayer.json` Set the following values in the config file: + * `Gateway`: The contract address where the Gateway contract is deployed. + * `endpoint`: Both the Polkadot and Ethereum nodes to connect to. + * `channel-id:` The channel of the messages that will be relayed. +* A Polkadot private key file at `./keys/beacon-relayer.key` + +## Service Files + +To register the relayers as systemd services, use each service file under `snowbridge-infra-suite/services`. Each service can be registered with these steps: + +``` +sudo systemctl enable services/beacon-relay.service +sudo systemctl start beacon-relay.service +sudo systemctl status beacon-relay.service +``` From 24b9d310809d937a83f6891f305b4976445e916a Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Fri, 5 Apr 2024 13:09:12 +0200 Subject: [PATCH 3/3] Make beefy client public (#1167) * make beefy client public * add to interface * added agent executor * update relayer * remove custom accessors * fix naming * update contracts * removed from the interface * update bindings * Revert Gateway.t.sol --- contracts/src/Gateway.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/src/Gateway.sol b/contracts/src/Gateway.sol index 4f237d35f2..29900f438f 100644 --- a/contracts/src/Gateway.sol +++ b/contracts/src/Gateway.sol @@ -50,10 +50,10 @@ contract Gateway is IGateway, IInitializable { using Address for address; using SafeNativeTransfer for address payable; - address internal immutable AGENT_EXECUTOR; + address public immutable AGENT_EXECUTOR; // Verification state - address internal immutable BEEFY_CLIENT; + address public immutable BEEFY_CLIENT; // BridgeHub ParaID internal immutable BRIDGE_HUB_PARA_ID;