Merge pull request #15 from primevprotocol/rm-bridge

refactor: remove bridge
This commit is contained in:
Shawn 2024-01-11 12:57:20 -08:00 committed by GitHub
commit 35aff8430c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 21 additions and 394 deletions

View file

@ -1,33 +1,25 @@
# Prod targets ref the amd agent image for this commit:
# https://github.com/hyperlane-xyz/hyperlane-monorepo/commit/69850642365251e16b9f23b87d6caf187036b3ee
up-prod-settlement:
up-prod:
@if [ ! -f .env ]; then echo "Error: .env file not found. Please populate the .env file before running this command."; exit 1; fi
AGENT_BASE_IMAGE=nil SETTLEMENT_RPC_URL=nil docker compose --profile settlement up -d --build
DD_KEY=nil docker compose --profile settlement up -d --build
up-dev-settlement:
up-dev:
@if [ ! -f .env ]; then echo "Error: .env file not found. Please populate the .env file before running this command."; exit 1; fi
AGENT_BASE_IMAGE=nil SETTLEMENT_RPC_URL=nil docker compose --profile settlement up -d --build
up-dev-bridge:
@if [ ! -f .env ]; then echo "Error: .env file not found. Please populate the .env file before running this command."; exit 1; fi
AGENT_BASE_IMAGE=shaspitz/hyperlane-agent-mac:6985064 SETTLEMENT_RPC_URL=http://172.29.0.98:8545 docker compose --profile bridge up -d --build
up-prod-bridge:
@if [ ! -f .env ]; then echo "Error: .env file not found. Please populate the .env file before running this command."; exit 1; fi
AGENT_BASE_IMAGE=gcr.io/abacus-labs-dev/hyperlane-agent@sha256:854f92966eac6b49e5132e152cc58168ecdddc76c2d390e657b81bdaf1396af0 SETTLEMENT_RPC_URL=http://172.29.0.98:8545 docker compose --profile bridge up -d --build
DD_KEY=nil docker compose --profile settlement up -d --build
up-dev-local-l1:
@if [ ! -f .env ]; then echo "Error: .env file not found. Please populate the .env file before running this command."; exit 1; fi
AGENT_BASE_IMAGE=nil SETTLEMENT_RPC_URL=nil docker compose --profile settlement --profile local_l1 up -d
DD_KEY=nil docker compose --profile settlement --profile local_l1 up -d
down:
AGENT_BASE_IMAGE=nil SETTLEMENT_RPC_URL=nil docker compose --profile settlement --profile bridge --profile prod_agents --profile local_l1 down
docker compose --profile settlement --profile prod_agents --profile local_l1 down
clean-dbs:
@read -p "WARNING: This command will wipe all persistent disk data relevant to the containers. Press enter to continue or Ctrl+C to cancel." _
-docker compose --profile settlement --profile bridge --profile local_l1 down --rmi all --volumes
-docker compose --profile settlement --profile bridge --profile local_l1 rm -fv
-docker compose --profile settlement --profile local_l1 down --rmi all --volumes
-docker compose --profile settlement --profile local_l1 rm -fv
docker image prune -f
pull-image:
@ -45,7 +37,3 @@ create-docker-network:
deploy-create2:
@echo "Deploying create2 deployment proxy..."
./util/deploy_create2.sh "http://localhost:8545"
print-warp-deploy:
@echo "Printing hyperlane warp deployment artifact"
docker run --rm -v geth-poa_hyperlane-deploy-artifacts:/data alpine cat /data/warp-deployment.json

View file

@ -1,6 +1,6 @@
# geth-poa
Tool for spinning up a POA ethereum sidechain bridged to sepolia via [hyperlane](https://www.hyperlane.xyz/) token warp route.
Tool for spinning up a POA ethereum sidechain.
## Metrics
@ -10,22 +10,7 @@ Metrics recorded by bootnode are exposed to host at http://127.0.0.1:6060/debug/
All relevant accounts are funded on sidechain genesis, you may need to fund these accounts on L1 with faucets. See [hyperlane docs](https://docs.hyperlane.xyz/docs/deploy/deploy-hyperlane#1.-setup-keys).
## Hyperlane Contract deployer
Address: `0xBcA333b67fb805aB18B4Eb7aa5a0B09aB25E5ce2`
Note if the relayer is emitting errors related to unexpected contract routing, try redeploying the hyperlane contracts using a new key pair. It's likely the current deployments are clashing with previous deployments on Sepolia.
To properly set a new hyperlane deployer:
* Generate a new key pair (ex: `cast wallet new`)
* Send or [mine](https://sepolia-faucet.pk910.de/) some Sepolia ETH to `Address`
* replace `Address` above for book keeping
* replace `CONTRACT_DEPLOYER_PRIVATE_KEY` in `.env`
* allocate funds to `Address` in the allocs field of `genesis.json`
Note the deployer of [primev contracts](https://github.com/primevprotocol/contracts) can be a separate account.
## Validator Accounts (also POA signers)
## POA signers
### Node1
@ -35,10 +20,6 @@ Address: `0xd9cd8E5DE6d55f796D980B818D350C0746C25b97`
Address: `0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4`
## Relayer
Address: `0x0DCaa27B9E4Db92F820189345792f8eC5Ef148F6`
## Create2 Deployment Proxy
A Create2 deployment proxy is can be deployed to this chain at `0x4e59b44847b379578588920ca78fbf26c0b4956c`. see more [here](https://github.com/primevprotocol/deterministic-deployment-proxy). Note this proxy is required to deploy the whitelist bridge contract, and is consistent to foundry's suggested process for create2 deployment. The deployment signer, `0x3fab184622dc19b6109349b94811493bf2a45362` is funded on genesis.
@ -49,4 +30,13 @@ A Create2 deployment proxy is can be deployed to this chain at `0x4e59b44847b379
2. Run `$ make up-dev-build` to run the whole stack including bridge, or `$ make up-dev-settlement` to bring up only the settlement layer.
## Starter .env file
To get a standard starter .env file from primev internal development, [click here.](https://www.notion.so/Private-keys-and-env-for-settlement-layer-245a4f3f4fe040a7b72a6be91131d9c2?pvs=4)
The chain must be started with two private keys for POA signers.
.env file should look like:
```
NODE1_PRIVATE_KEY=0xpk1
NODE2_PRIVATE_KEY=0xpk2
```
To get a standard starter .env file from primev internal development, [click here.](https://www.notion.so/Private-keys-and-env-for-settlement-layer-245a4f3f4fe040a7b72a6be91131d9c2?pvs=4), populate only the `NODE1_PRIVATE_KEY` and `NODE2_PRIVATE_KEY` fields.

View file

@ -218,119 +218,6 @@ services:
profiles:
- local_l1
hyperlane-deployer:
build:
context: ./hyperlane-deployer
dockerfile: Dockerfile
healthcheck:
test: ["CMD-SHELL", "test -f /hyperlane-monorepo/artifacts/done-warp-route || exit 1"]
interval: 5s
retries: 100
environment:
- HYPERLANE_DEPLOYER_PRIVATE_KEY=${HYPERLANE_DEPLOYER_PRIVATE_KEY}
networks:
primev_net:
ipv4_address: '172.29.0.50'
volumes:
- hyperlane-deploy-artifacts:/hyperlane-monorepo/artifacts
profiles:
- bridge
hyperlane-validator1:
build:
context: ./hyperlane-validator
dockerfile: Dockerfile
args:
# Image can be built for arm64 with https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/rust/build.sh
- AGENT_BASE_IMAGE=${AGENT_BASE_IMAGE}
- SETTLEMENT_RPC_URL=${SETTLEMENT_RPC_URL}
# Reuse geth private key for validator
command: ./validator --validator.key ${NODE1_PRIVATE_KEY} --chains.mevcommitsettlement.signer.key ${NODE1_PRIVATE_KEY} --checkpointSyncer.path /val1-sigs
# TODO: evaluate why container needs to run as root
user: "0:0"
depends_on:
hyperlane-deployer:
condition: service_healthy
networks:
primev_net:
ipv4_address: '172.29.0.75'
volumes:
- hyperlane-deploy-artifacts:/deploy-artifacts
- hyperlane-validator1-sigs:/val1-sigs
- hyperlane-validator1-db:/val-db
profiles:
- bridge
hyperlane-validator2:
build:
context: ./hyperlane-validator
dockerfile: Dockerfile
args:
- AGENT_BASE_IMAGE=${AGENT_BASE_IMAGE}
- SETTLEMENT_RPC_URL=${SETTLEMENT_RPC_URL}
# Reuse geth private key for validator
command: ./validator --validator.key ${NODE2_PRIVATE_KEY} --chains.mevcommitsettlement.signer.key ${NODE2_PRIVATE_KEY} --checkpointSyncer.path /val2-sigs
# TODO: evaluate why container needs to run as root
user: "0:0"
depends_on:
hyperlane-deployer:
condition: service_healthy
networks:
primev_net:
ipv4_address: '172.29.0.76'
volumes:
- hyperlane-deploy-artifacts:/deploy-artifacts
- hyperlane-validator2-sigs:/val2-sigs
- hyperlane-validator2-db:/val-db
profiles:
- bridge
hyperlane-relayer:
build:
context: ./hyperlane-relayer
dockerfile: Dockerfile
args:
- AGENT_BASE_IMAGE=${AGENT_BASE_IMAGE}
user: "0:0"
depends_on:
hyperlane-deployer:
condition: service_healthy
environment:
- RELAYER_PRIVATE_KEY=${RELAYER_PRIVATE_KEY}
networks:
primev_net:
ipv4_address: '172.29.0.77'
volumes:
- hyperlane-deploy-artifacts:/deploy-artifacts
- hyperlane-validator1-sigs:/val1-sigs
- hyperlane-validator2-sigs:/val2-sigs
- hyperlane-relayer-db:/relayer-db
profiles:
- bridge
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_WALLET_CONNECT_ID=${NEXT_PUBLIC_WALLET_CONNECT_ID}
depends_on:
hyperlane-deployer:
condition: service_healthy
environment:
- NEXT_PUBLIC_WALLET_CONNECT_ID=${NEXT_PUBLIC_WALLET_CONNECT_ID}
- SETTLEMENT_RPC_URL=${SETTLEMENT_RPC_URL}
- PUBLIC_SETTLEMENT_RPC_URL=${PUBLIC_SETTLEMENT_RPC_URL}
networks:
primev_net:
ipv4_address: '172.29.0.90'
ports:
- 80:3000
volumes:
- hyperlane-deploy-artifacts:/deploy-artifacts
profiles:
- bridge
datadog-agent:
image: gcr.io/datadoghq/agent:latest
restart: always
@ -371,9 +258,4 @@ volumes:
geth-data-l1-bootnode:
geth-data-l1-first-signer:
geth-data-l1-second-signer:
hyperlane-deploy-artifacts:
hyperlane-validator1-sigs:
hyperlane-validator2-sigs:
hyperlane-validator1-db:
hyperlane-validator2-db:
hyperlane-relayer-db:

View file

@ -1,18 +0,0 @@
FROM alpine:latest
RUN apk add --no-cache git yarn jq
RUN git clone https://github.com/primevprotocol/hyperlane-ui.git
WORKDIR /hyperlane-ui
RUN git checkout ff1586ed9cad6eeddba2cebc5f9b7828c74f25d1
RUN yarn
ARG NEXT_PUBLIC_WALLET_CONNECT_ID
RUN yarn build
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

View file

@ -1,20 +0,0 @@
#!/bin/sh
set -exu
# Update src tokens.ts file with hypNativeAddress value from deploy config
ARTIFACT_PATH="/deploy-artifacts/warp-ui-token-config.json"
SRC_TOKENS_PATH="/hyperlane-ui/src/consts/tokens.ts"
HYP_NATIVE_ADDR=$(jq -r '.hypNativeAddress' $ARTIFACT_PATH)
sed -i "/hypNativeAddress/c\ hypNativeAddress: \"$HYP_NATIVE_ADDR\"," $SRC_TOKENS_PATH
# Check if PUBLIC_SETTLEMENT_RPC_URL is set and non-empty, otherwise use SETTLEMENT_RPC_URL
if [ -n "${PUBLIC_SETTLEMENT_RPC_URL+x}" ] && [ -n "$PUBLIC_SETTLEMENT_RPC_URL" ]; then
RPC_URL="$PUBLIC_SETTLEMENT_RPC_URL"
else
RPC_URL="$SETTLEMENT_RPC_URL"
fi
# Update src chains.ts file with L2 node url depending on dev vs prod
SRC_CHAINS_PATH="/hyperlane-ui/src/consts/chains.ts"
sed -i "s|http: 'http://[^']*'|http: '$RPC_URL'|g" "$SRC_CHAINS_PATH"
exec yarn dev

View file

@ -1,27 +0,0 @@
FROM alpine:latest
RUN apk update && apk add --no-cache git yarn expect
WORKDIR /
RUN git clone https://github.com/primevprotocol/hyperlane-monorepo.git
WORKDIR /hyperlane-monorepo
# Hyperlane 3.5 release w/ merged primev changes
# https://github.com/primevprotocol/hyperlane-monorepo/commit/1c8cdc9e57389024274242d28e032a2de535c2c7
RUN git checkout 1c8cdc9e57389024274242d28e032a2de535c2c7
RUN yarn install
RUN yarn build
RUN ln -s /hyperlane-monorepo/typescript/cli/dist/cli.js /usr/local/bin/hyperlane
RUN chmod +x /usr/local/bin/hyperlane
COPY chain-config.yml /chain-config.yml
COPY multisig-ism.yml /multisig-ism.yml
COPY warp-tokens.yml /warp-tokens.yml
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

View file

@ -1,41 +0,0 @@
---
mevcommitsettlement:
chainId: 17864
domainId: 17864
name: mevcommitsettlement
protocol: ethereum
rpcUrls:
# This RPC URL is specific to a local geth POA setup
- http: http://172.29.0.98:8545
pagination:
maxBlockRange: 1000
maxBlockAge: 1000
minBlockNumber: 1000
retry:
maxRequests: 5
baseRetryMs: 1000
isTestnet: true
# blockExplorers: # Array: List of BlockExplorer configs
# # Required fields:
# - name: My Chain Explorer # String: Human-readable name for the explorer
# url: https://mychain.com/explorer # String: Base URL for the explorer
# apiUrl: https://mychain.com/api # String: Base URL for the explorer API
# # Optional fields:
# apiKey: myapikey # String: API key for the explorer (optional)
# family: etherscan # ExplorerFamily: See ExplorerFamily for valid values
nativeToken:
name: cETH # String
symbol: cETH # String
decimals: 18 # Number
displayName: MEV Commit Settlement
displayNameShort: MEV Commit Settlement
logoURI: https://mychain.com/logo.png
blocks:
confirmations: 12 # Number: Blocks to wait before considering a transaction confirmed
reorgPeriod: 100 # Number: Blocks before a transaction has a near-zero chance of reverting
estimateBlockTime: 1
# Partial override sepolia config for custom rpc
sepolia:
rpcUrls:
- http: https://eth-sepolia.g.alchemy.com/v2/a0wg_g1X-Wz4IeVA-0SS3PsQhbyQNjc_

View file

@ -1,77 +0,0 @@
#!/bin/sh
set -exu
# Sleep to ensure chain is up
sleep 10
if test -f /hyperlane-monorepo/artifacts/done; then
echo "Deploy artifacts already exist. Skipping deployment."
else
echo "Deploying core contracts"
# Define the expect script inline
/usr/bin/expect <<EOF
set timeout -1
spawn hyperlane deploy core \
--yes \
--targets sepolia,mevcommitsettlement \
--chains /chain-config.yml \
--ism /multisig-ism.yml \
--out "/hyperlane-monorepo/artifacts" \
--key $HYPERLANE_DEPLOYER_PRIVATE_KEY
expect {
"*low balance on*" {
send -- "Y\r"
exp_continue
}
eof
}
EOF
# Standardize artifact names
for file in /hyperlane-monorepo/artifacts/agent-config-*.json; do
mv "$file" "/hyperlane-monorepo/artifacts/agent-config.json"
done
for file in /hyperlane-monorepo/artifacts/core-deployment-*.json; do
mv "$file" "/hyperlane-monorepo/artifacts/core-deployment.json"
done
# Signal done
touch /hyperlane-monorepo/artifacts/done
fi
if test -f artifacts/done-warp-route; then
echo "Warp route already deployed. Skipping."
else
echo "Deploying warp route"
# Define the expect script inline
/usr/bin/expect <<EOF
set timeout -1
spawn hyperlane deploy warp \
--yes \
--key $HYPERLANE_DEPLOYER_PRIVATE_KEY \
--chains /chain-config.yml \
--config /warp-tokens.yml \
--core /hyperlane-monorepo/artifacts/core-deployment.json
expect {
"*low balance on*" {
send -- "Y\r"
exp_continue
}
eof
}
EOF
# Standardize artifact names
for file in /hyperlane-monorepo/artifacts/warp-deployment-*.json; do
mv "$file" "/hyperlane-monorepo/artifacts/warp-deployment.json"
done
for file in /hyperlane-monorepo/artifacts/warp-ui-token-config-*.json; do
mv "$file" "/hyperlane-monorepo/artifacts/warp-ui-token-config.json"
done
# Signal done
touch artifacts/done-warp-route
fi
# Sleep to allow deployer health check (polled every 5sec) to pass
sleep 10

View file

@ -1,6 +0,0 @@
---
mevcommitsettlement:
threshold: 2
validators:
- '0xd9cd8E5DE6d55f796D980B818D350C0746C25b97'
- '0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4'

View file

@ -1,8 +0,0 @@
base:
chainName: sepolia
type: native
synthetics:
- chainName: mevcommitsettlement
# name: "Commit ETH"
# symbol: "cETH"
# totalSupply: 10000000

View file

@ -1,20 +0,0 @@
ARG AGENT_BASE_IMAGE
ARG SETTLEMENT_RPC_URL
FROM ${AGENT_BASE_IMAGE}
# Relayer config, see:
# - https://docs.hyperlane.xyz/docs/operators/relayers/setup
# - https://docs.hyperlane.xyz/docs/operators/agent-configuration#config-layers
ENV CONFIG_FILES="/deploy-artifacts/agent-config.json"
# TODO: enforce minimum gas payment in prod
CMD ./relayer \
--relayChains mevcommitsettlement,sepolia \
--chains.mevcommitsettlement.connection.url ${SETTLEMENT_RPC_URL} \
--chains.sepolia.connection.url "https://eth-sepolia.g.alchemy.com/v2/a0wg_g1X-Wz4IeVA-0SS3PsQhbyQNjc_" \
--db /relayer-db \
--defaultSigner.key $RELAYER_PRIVATE_KEY \
--allowLocalCheckpointSyncers true \
--gasPaymentEnforcement '[{"type": "none"}]'

View file

@ -1,16 +0,0 @@
ARG AGENT_BASE_IMAGE
ARG SETTLEMENT_RPC_URL
FROM ${AGENT_BASE_IMAGE}
# Validator config, see:
# - https://docs.hyperlane.xyz/docs/operators/validators/setup
# - https://docs.hyperlane.xyz/docs/operators/agent-configuration#config-layers
ENV CONFIG_FILES="/deploy-artifacts/agent-config.json"
ENV HYP_BASE_REORGPERIOD=20
ENV HYP_BASE_ORIGINCHAINNAME="mevcommitsettlement"
ENV HYP_BASE_CHAINS_MEVCOMMITSETTLEMENT_CONNECTION_URL=${SETTLEMENT_RPC_URL}
ENV HYP_BASE_DB="/val-db"
ENV HYP_CHECKPOINTSYNCER_TYPE="localStorage"
ENV HYP_ORIGINCHAINNAME="mevcommitsettlement"