Skip to content

Commit

Permalink
Devnet (#1381)
Browse files Browse the repository at this point in the history
* docker first pass

* fix omnirpc port default behavior

* Docker-compose updates

* add guide for adding new go modules

* typo fix

* indentation fix

* kink fix

* remove vanity

* devnet fix

* backup for max attempt change

* hi

* make retry defaults more sensible

* lint fix

* Revert "hi"

This reverts commit 60dd2b7.

* test

* omnirpc chains endpoint

* close response handle

* actually close response

* more fixes

* wip

* forge install: solmate

* newmates

* create3

* create3factory

* custom config path

* Revert "custom config path"

This reverts commit 47ee5f9.

* deploy config defaults

* Revert "deploy config defaults"

This reverts commit 969a6cd.

* devnet check

* basic updates

* factory fixes

* cleanup

* devnet up/down

* first pass

* guard it up

* guard

* 1 notary

* more updates

* fix wrong domain in deploy script

* diff fix

* comment fix

* agent proof updates

* synapse domain fix

* generic linter fix

* get guard to boot [goreleaser]

* more yaml lint

* some nice debugging tools

* generic linter fix

* finish devnet

* fix lint commandS

* d

* wrap up rudimentary devneT

* create3

* deployer/create fix

* fix ubuntu

* lowercase non-constants

* icreate3 import

* Revert "icreate3 import"

This reverts commit bcb2522.

* move to internal

* another internal change

* update installs on dev containers for easier debugging

* Update packages/contracts-core/README.md

Co-authored-by: χ² <[email protected]>

* address #1381 (comment)

* Replace Create3 with ZeframLou/create3-factory (#1387)

* create3

* forge install: create3-factory

* replace create3 w/ external module

* fix naming issues

* create3 factory re-addition to address #1387 (comment)

---------

Co-authored-by: Trajan0x <[email protected]>

* Revert "Replace Create3 with ZeframLou/create3-factory (#1387)" (#1388)

This reverts commit 616c5ab.

* Replace Create3 with ZeframLou/create3-factory

This reverts commit 6b100fd.

* fix package issue

---------

Co-authored-by: Trajan0x <[email protected]>
Co-authored-by: χ² <[email protected]>
Co-authored-by: Daniel Wasserman <[email protected]>
  • Loading branch information
4 people authored Nov 10, 2023
1 parent 8e4ecdc commit bdcaa94
Show file tree
Hide file tree
Showing 44 changed files with 1,002 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ coverage:

# from go.work file
flags:
# note: go.work flags should be in order of the directory structure
# also, if you're using multiple module names, you're doing something wrong
agents:
paths:
- agents/
Expand Down
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
.vscode

node_modules
**/node_modules
3 changes: 3 additions & 0 deletions .github/workflows/goreleaser-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
push: true
file: ./docker/goreleaser/Dockerfile
# TODO this needs to be versioned
# Note: this automatically pushes the latest tag for sanguine-goreleaser even on branched workflows. While unlikely,
# this could break local devnets that rely on working versions of this image and as such the latest tag should only be pushed on master
# additionally, tags representing a specific version rather than the hash of the file should be considered for future use.
tags: ghcr.io/synapsecns/sanguine-goreleaser:latest,${{ steps.name-export.outputs.TAG_NAME }}
cache-from: type=registry,ref=ghcr.io/synapsecns/sanguine-goreleaser:buildcache
cache-to: type=registry,ref=ghcr.io/synapsecns/sanguine-goreleaser:buildcache,mode=max
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ codecov/
# fasthttp
fastcache.tmp*

#vercel

# ignore all go built files in local dirs
main
**/.vercel
.devnet/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
[submodule "services/cctp-relayer/external/synapse-contracts"]
path = services/cctp-relayer/external/synapse-contracts
url = https://github.com/synapsecns/synapse-contracts
[submodule "packages/contracts-core/lib/create3-factory"]
path = packages/contracts-core/lib/create3-factory
url = https://github.com/zeframlou/create3-factory
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,10 @@ Use the above commands to recompile the packages.
## Dealing with submodules

This repo make use of [multiple](.gitattributes) [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules). To avoid issues when checking out different branches, you can use `git submodule update --init --recursive` after switching to a branch or `git checkout feat/branch-name --recurse-submodules` when switching branches.

# Building Agents Locally

<!-- TODO: we need to move this thing into an ops docs package. Given that the docs are still a work in progress, I'm leaving this here for now. -->
<!-- Actually, it's unclear if this belongs in a contributing.md file, the docs or both. Maybe a symlink? -->

In order to minimize risks coming from extraneous dependencies or supply chain attacks in a production like enviornment, all distributed images are built as [scratch](https://hub.docker.com/_/scratch) or [distroless](https://github.com/GoogleContainerTools/distroless#distroless-container-images) images. Builder containers are also not used to restrict the build enviornment to the [goreleaser container](https://github.com/synapsecns/sanguine/pkgs/container/sanguine-goreleaser). All production images are kept in the `docker/` file as `[dir].Dockerfile`. Local
21 changes: 21 additions & 0 deletions docker/devnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Local contains dockerfiles for local development. These files should be able to be built from the root of the repo without any external dependencies.

These don't need to be made for every package, just those involved in devnet.

# Let's keep track of commands here we'll need in our devnet script

1. cd `docker/devnet`
2. `docker compose build --progress=plain`

## Default Port Map:

| Container | Port |
|------------------------|------|
| omnirpc | 9001 |
| chain_a (chain_id: 42) | 8042 |
| chain_b (chain_id: 43) | 8043 |
| chain_c (chain_id: 44) | 8044 |
| scribe | 9002 |



26 changes: 26 additions & 0 deletions docker/devnet/agents.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ghcr.io/synapsecns/sanguine-goreleaser:latest as builder

ARG VERSION=v0.0.0

COPY ./services /app/services
COPY ./agents /app/agents
COPY ./core /app/core
COPY ./ethergo /app/ethergo
COPY ./tools /app/tools
COPY ./contrib /app/contrib
COPY ./go.work /app/go.work
COPY ./go.work.sum /app/go.work.sum
COPY ./.git /app/.git

WORKDIR /app/agents

RUN --mount=type=cache,target=/root/go/pkg/mod GOPROXY=https://proxy.golang.org go mod download -x
RUN --mount=type=cache,target=/root/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build CC=gcc CXX=g++ go build -tags=netgo,osusergo -ldflags="-s -w -extldflags '-static'" -o /app/bin/agents main.go

FROM ubuntu:20.04

RUN apt update && apt install -y bash sqlite3 ca-certificates htop
RUN update-ca-certificates
COPY --from=builder /app/bin/agents /usr/local/bin

CMD ["agents"]
53 changes: 53 additions & 0 deletions docker/devnet/config/executor-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# The `db_config` field specifies the database type and the source (either a path or a connection string).
db_config:
# Must be mysql or sqlite.
type: sqlite
# Source is either a path (for sqlite) or a connection string (for mysql).
source: '/config/synapse.db'

# The base omnirpc url which each chain's collection of RPC's will be proxied through.
base_omnirpc_url: http://omnirpc:9001
execute_interval: 5
summit_chain_id: 42
summit_address: 0x1EC96ab1Fdb92565A0839b12d42c13c8135f6c11
inbox_address: 0x2eB68A0C21413aA78055F6F7F262De56979aFBEa

# For each chain (including the Summit chain), specify the origin and destination addresses.
# For remote chains, also specify the light inbox address.
chains:
- chain_id: 42
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
- chain_id: 43
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b
- chain_id: 44
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b

# The `unbonded_signer` field specifies the path to the file containing the private key of the signer
unbonded_signer:
type: 'File'
file: '/config/executor-signer.txt'

submitter_config:
chains:
42:
supports_eip_1559: true
gas_estimate: 7500000
43:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
44:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000

scribe_config:
type: 'remote'
port: 9002
url: 'scribe'

1 change: 1 addition & 0 deletions docker/devnet/config/executor-signer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
103a9ef39d4ced2988f1d5084460ebf8ea3baea2b2ca78265b637e48d99dce82
1 change: 1 addition & 0 deletions docker/devnet/config/guard-bonded-signer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b31048b0aa87649bdb9016c0ee28c788ddfc45e52cd71cc0da08c47cb4390ae7
66 changes: 66 additions & 0 deletions docker/devnet/config/guard-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# The `db_config` field specifies the database type and the source (either a path or a connection string).
db_config:
# Must be mysql or sqlite.
type: sqlite
# Source is either a path (for sqlite) or a connection string (for mysql).
source: '/data/synapse.db'

# The base omnirpc url which each chain's collection of RPC's will be proxied through.
base_omnirpc_url: http://omnirpc:9001
refresh_interval_seconds: 5

# For each chain (domain), specify the necessary contracts. ***** TODO: Update this *****
domains:
domain_client1:
domain_id: 43
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
domain_client2:
domain_id: 42
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
summit_address: 0x1EC96ab1Fdb92565A0839b12d42c13c8135f6c11
inbox_address: 0x2eB68A0C21413aA78055F6F7F262De56979aFBEa
domain_client3:
domain_id: 44
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0

# Specify the summit domain id
summit_domain_id: 42
# Guards have a `domain_id` of 0.
domain_id: 0

# The `unbonded_signer` field specifies the path to the file containing the private key of the signer
unbonded_signer:
type: 'File'
file: '/config/guard-bonded-signer.txt'

# The `bonded_signer` is the account that will post a bond to the Summit contract. Specify its path to
# the file containing the private key of the signer
bonded_signer:
type: 'File'
file: '/config/guard-bonded-signer.txt'

# The `submitter_config` field specifies how the submitter should submit messages to the chains.
submitter_config:
chains:
42:
supports_eip_1559: true
gas_estimate: 7500000
43:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
44:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000

scribe_config:
type: 'remote'
port: 9002
url: 'scribe'
1 change: 1 addition & 0 deletions docker/devnet/config/notary43-bonded-signer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d5c561f92921a5d7eb8a91cc81cb392d1877dcc6b856260c1676cb28ef7203b0
73 changes: 73 additions & 0 deletions docker/devnet/config/notary43-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# The `db_config` field specifies the database type and the source (either a path or a connection string).
db_config:
# Must be mysql or sqlite.
type: sqlite
# Source is either a path (for sqlite) or a connection string (for mysql).
source: '/config/synapse.db'

# The base omnirpc url which each chain's collection of RPC's will be proxied through.
base_omnirpc_url: http://omnirpc:9001
refresh_interval_seconds: 5

# For each chain (domain), specify the necessary contracts.
# Remotes need: origin_address, destination_address, light_inbox_address, light_manager_address
# Summit needs: origin_address, destination_address, summit_address, inbox_address, bonding_manager_address
domains:
domain_client43:
domain_id: 43
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b
light_manager_address: 0x807A8d4469DD803B9b2c9e3568D5E83784bec25D
domain_client44:
domain_id: 44
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b
light_manager_address: 0x807A8d4469DD803B9b2c9e3568D5E83784bec25D
domain_client42:
domain_id: 42
type: EVM
required_confirmations: 0
# for some reason, origin and summit addresses are switched on synchain
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
summit_address: 0x1EC96ab1Fdb92565A0839b12d42c13c8135f6c11
inbox_address: 0x2eB68A0C21413aA78055F6F7F262De56979aFBEa
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
bonding_manager_address: 0x27006519C5786863fAE35612Da9E0f0622ff8c58


# Specify the summit domain id
summit_domain_id: 42
# A Notary's `domain_id` is the domain id of the chain it has posted a bond for.
domain_id: 43

# The `unbonded_signer` field specifies the path to the file containing the private key of the signer
unbonded_signer:
type: 'File'
file: '/config/notary-bonded-signer.txt'

# The `bonded_signer` is the account that will post a bond to the Summit contract. Specify its path to
# the file containing the private key of the signer
bonded_signer:
type: 'File'
file: '/config/notary-bonded-signer.txt'

# The `submitter_config` field specifies how the submitter should submit messages to the chains.
submitter_config:
chains:
42:
supports_eip_1559: true
gas_estimate: 7500000
43:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
44:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
1 change: 1 addition & 0 deletions docker/devnet/config/notary44-bonded-signer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f466f6f4d2d61a11eddd10eb80aae500c7601539d08d1d55f9e5efe25ecf95bc
73 changes: 73 additions & 0 deletions docker/devnet/config/notary44-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# The `db_config` field specifies the database type and the source (either a path or a connection string).
db_config:
# Must be mysql or sqlite.
type: sqlite
# Source is either a path (for sqlite) or a connection string (for mysql).
source: '/config/synapse.db'

# The base omnirpc url which each chain's collection of RPC's will be proxied through.
base_omnirpc_url: http://omnirpc:9001
refresh_interval_seconds: 5

# For each chain (domain), specify the necessary contracts.
# Remotes need: origin_address, destination_address, light_inbox_address, light_manager_address
# Summit needs: origin_address, destination_address, summit_address, inbox_address, bonding_manager_address
domains:
domain_client43:
domain_id: 43
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b
light_manager_address: 0x807A8d4469DD803B9b2c9e3568D5E83784bec25D
domain_client44:
domain_id: 44
type: EVM
required_confirmations: 0
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
light_inbox_address: 0xa6A694d8D2430964DcD11f2E649649Fc9557a56b
light_manager_address: 0x807A8d4469DD803B9b2c9e3568D5E83784bec25D
domain_client42:
domain_id: 42
type: EVM
required_confirmations: 0
# for some reason, origin and summit addresses are switched on synchain
origin_address: 0xD755a6D98C4557c66ebbD9D76f1BEbC48e84afa0
summit_address: 0x1EC96ab1Fdb92565A0839b12d42c13c8135f6c11
inbox_address: 0x2eB68A0C21413aA78055F6F7F262De56979aFBEa
destination_address: 0x7219284B26F44B2A584827034422a33450635f7A
bonding_manager_address: 0x27006519C5786863fAE35612Da9E0f0622ff8c58


# Specify the summit domain id
summit_domain_id: 42
# A Notary's `domain_id` is the domain id of the chain it has posted a bond for.
domain_id: 44

# The `unbonded_signer` field specifies the path to the file containing the private key of the signer
unbonded_signer:
type: 'File'
file: '/config/notary-bonded-signer.txt'

# The `bonded_signer` is the account that will post a bond to the Summit contract. Specify its path to
# the file containing the private key of the signer
bonded_signer:
type: 'File'
file: '/config/notary-bonded-signer.txt'

# The `submitter_config` field specifies how the submitter should submit messages to the chains.
submitter_config:
chains:
42:
supports_eip_1559: true
gas_estimate: 7500000
43:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
44:
gas_bump_percentage: 40
is_l2: true
gas_estimate: 7500000
17 changes: 17 additions & 0 deletions docker/devnet/config/omnirpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
chains:
42:
rpcs:
- http://chain_a:8545/
confirmations: 1
43:
rpcs:
- http://chain_b:8545/
confirmations: 1
44:
rpcs:
- http://chain_c:8545/
confirmations: 1
# port to run on
port: 9001
# expressed in seconds
refreshInterval: 60
Loading

0 comments on commit bdcaa94

Please sign in to comment.