merging geth-poa into go-ethereum repo

This commit is contained in:
kant 2023-11-30 18:07:09 -08:00
parent c244b5fbb9
commit 588539bbeb
18 changed files with 784 additions and 0 deletions

6
geth-poa/.env.example Normal file
View file

@ -0,0 +1,6 @@
CONTRACT_DEPLOYER_PRIVATE_KEY=
NODE1_PRIVATE_KEY=
NODE2_PRIVATE_KEY=
RELAYER_PRIVATE_KEY=
NEXT_PUBLIC_WALLET_CONNECT_ID=
DD_KEY=

1
geth-poa/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.env

26
geth-poa/Dockerfile Normal file
View file

@ -0,0 +1,26 @@
FROM golang:1.21-alpine AS builder
RUN apk add --no-cache gcc musl-dev linux-headers git make
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download
ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
FROM alpine:latest
RUN apk add --no-cache jq
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
COPY genesis.json /genesis.json
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8545 6060
ENTRYPOINT ["/entrypoint.sh"]

37
geth-poa/Makefile Normal file
View file

@ -0,0 +1,37 @@
# Prod targets reg the amd agent image for this commit:
# https://github.com/hyperlane-xyz/hyperlane-monorepo/commit/69850642365251e16b9f23b87d6caf187036b3ee
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=gcr.io/abacus-labs-dev/hyperlane-agent@sha256:854f92966eac6b49e5132e152cc58168ecdddc76c2d390e657b81bdaf1396af0 L2_NODE_URL=http://34.215.163.180:8545 docker compose --profile settlement --profile bridge --profile prod_agents up -d
up-prod-build:
@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 L2_NODE_URL=http://34.215.163.180:8545 docker compose --profile settlement --profile bridge --profile prod_agents up -d --build
up-prod-settlement:
@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 L2_NODE_URL=nil docker compose --profile settlement up -d --build
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=shaspitz/hyperlane-agent-mac:6985064 L2_NODE_URL=http://localhost:8545 docker compose --profile settlement --profile bridge up -d
up-dev-build:
@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 L2_NODE_URL=http://localhost:8545 docker compose --profile settlement --profile bridge up -d --build
up-dev-settlement:
@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 L2_NODE_URL=http://localhost:8545 docker compose --profile settlement up -d --build
down:
AGENT_BASE_IMAGE=nil L2_NODE_URL=nil docker compose --profile settlement --profile bridge --profile prod_agents 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 down --rmi all --volumes
-docker compose --profile settlement --profile bridge rm -fv
docker image prune -f
pull-image:
docker pull shaspitz/geth-poa:v0

45
geth-poa/README.md Normal file
View file

@ -0,0 +1,45 @@
# geth-poa
Tool for spinning up a POA ethereum sidechain bridged to goerli via [hyperlane](https://www.hyperlane.xyz/) token warp route.
## TODOs
* add container which stress tests network with txs
* merge branch with local anvil l1 once hyperlane v3 is released -> useful for mev-commit docker testing
## Metrics
Metrics recorded by bootnode are exposed to host at http://127.0.0.1:6060/debug/metrics
## Key Summary
Testnet private keys are in notion, and need to be copied into an .env.
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).
## Contract deployer
Address: `0xBe3dEF3973584FdcC1326634aF188f0d9772D57D`
Note if the relayer is emitting errors related to unexpected contract routing, try using a new deployer key pair. It's likely that the current bridge contract deployments are clashing with previous deployments.
You'd need to replace `Address` above, the allocs field of `genesis.json`, and the `CONTRACT_DEPLOYER_PRIVATE_KEY` in `.env`.
## Validator Accounts (also POA signers)
### Node1
Address: `0xd9cd8E5DE6d55f796D980B818D350C0746C25b97`
### Node2
Address: `0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4`
## Relayer
Address: `0x0DCaa27B9E4Db92F820189345792f8eC5Ef148F6`
## Local Run
1. To run the local setup, set the .env file with the keys specified in .env.example.
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.

251
geth-poa/docker-compose.yml Normal file
View file

@ -0,0 +1,251 @@
version: '3'
services:
bootnode:
build:
context: .
dockerfile: Dockerfile
environment:
- GETH_NODE_TYPE=bootnode
- BOOT_KEY=7b548c1c0fbe80ef1eb0aaec2edf26fd20fb0d758e94948cf6c5f2a486e735f6
networks:
poa_net:
ipv4_address: '172.13.0.100'
ports:
- 8545:8545
- 8546:8546
- 6060:6060 # metrics server @ /debug/metrics
volumes:
- geth-data-bootnode:/data
profiles:
- settlement
labels:
com.datadoghq.ad.check_names: '["openmetrics"]'
com.datadoghq.ad.init_configs: '[{}]'
com.datadoghq.ad.instances: |
[
{
"openmetrics_endpoint": "http://%%host%%:6060/debug/metrics/prometheus",
"namespace": "geth-poa",
"metrics": [
"txpool*",
"trie*",
"system*",
"state*",
"rpc*",
"p2p*",
"eth*",
"chain*"
]
}
]
node1:
build:
context: .
dockerfile: Dockerfile
environment:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0xd9cd8E5DE6d55f796D980B818D350C0746C25b97
- BLOCK_SIGNER_PRIVATE_KEY=${NODE1_PRIVATE_KEY}
networks:
poa_net:
ipv4_address: '172.13.0.2'
volumes:
- geth-data-node1:/data
profiles:
- settlement
labels:
com.datadoghq.ad.check_names: '["openmetrics"]'
com.datadoghq.ad.init_configs: '[{}]'
com.datadoghq.ad.instances: |
[
{
"openmetrics_endpoint": "http://%%host%%:6060/debug/metrics/prometheus",
"namespace": "geth-poa",
"metrics": [
"clique*"
]
}
]
node2:
build:
context: .
dockerfile: Dockerfile
environment:
- GETH_NODE_TYPE=signer
- BLOCK_SIGNER_ADDRESS=0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4
- BLOCK_SIGNER_PRIVATE_KEY=${NODE2_PRIVATE_KEY}
networks:
poa_net:
ipv4_address: '172.13.0.3'
volumes:
- geth-data-node2:/data
profiles:
- settlement
labels:
com.datadoghq.ad.check_names: '["openmetrics"]'
com.datadoghq.ad.init_configs: '[{}]'
com.datadoghq.ad.instances: |
[
{
"openmetrics_endpoint": "http://%%host%%:6060/debug/metrics/prometheus",
"namespace": "geth-poa",
"metrics": [
"clique*"
]
}
]
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:
- CONTRACT_DEPLOYER_PRIVATE_KEY=${CONTRACT_DEPLOYER_PRIVATE_KEY}
networks:
poa_net:
ipv4_address: '172.13.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}
# 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:
poa_net:
ipv4_address: '172.13.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}
# 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:
poa_net:
ipv4_address: '172.13.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:
poa_net:
ipv4_address: '172.13.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}
- L2_NODE_URL=${L2_NODE_URL}
networks:
poa_net:
ipv4_address: '172.13.0.90'
ports:
- 80:3000
volumes:
- hyperlane-deploy-artifacts:/deploy-artifacts
profiles:
- bridge
datadog-agent:
image: gcr.io/datadoghq/agent:latest
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
environment:
- DD_API_KEY=${DD_KEY}
- DD_TAGS=env:test
- DD_SITE=datadoghq.com
- DD_LOGS_ENABLED=true
- DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true
- DD_CONTAINER_EXCLUDE="name:datadog-agent"
ports:
- "5000:5000"
networks:
poa_net:
ipv4_address: 172.13.4.24
profiles:
- prod_agents
networks:
poa_net:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.13.0.0/16
volumes:
geth-data-bootnode:
geth-data-node1:
geth-data-node2:
hyperlane-deploy-artifacts:
hyperlane-validator1-sigs:
hyperlane-validator2-sigs:
hyperlane-validator1-db:
hyperlane-validator2-db:
hyperlane-relayer-db:

115
geth-poa/entrypoint.sh Normal file
View file

@ -0,0 +1,115 @@
#!/bin/sh
set -exu
GENESIS_L1_PATH="/genesis.json"
VERBOSITY=3
GETH_DATA_DIR=/data
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata"
GETH_KEYSTORE_DIR="$GETH_DATA_DIR/keystore"
CHAIN_ID=$(cat "$GENESIS_L1_PATH" | jq -r .config.chainId)
RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
# Generate signer key if needed
if [ ! -d "$GETH_KEYSTORE_DIR" ] && [ "$GETH_NODE_TYPE" = "signer" ]; then
echo "$GETH_KEYSTORE_DIR missing, running account import"
echo -n "pwd" > "$GETH_DATA_DIR"/password
echo -n "$BLOCK_SIGNER_PRIVATE_KEY" | sed 's/0x//' > "$GETH_DATA_DIR"/block-signer-key
geth --verbosity="$VERBOSITY" \
--nousb \
account import \
--datadir="$GETH_DATA_DIR" \
--password="$GETH_DATA_DIR"/password \
"$GETH_DATA_DIR"/block-signer-key
else
echo "$GETH_KEYSTORE_DIR exists."
fi
# Init geth if needed
if [ ! -d "$GETH_CHAINDATA_DIR" ]; then
echo "$GETH_CHAINDATA_DIR missing, running init"
echo "Initializing genesis."
geth --verbosity="$VERBOSITY" \
--nousb \
--datadir="$GETH_DATA_DIR" init \
"$GENESIS_L1_PATH"
else
echo "$GETH_CHAINDATA_DIR exists."
fi
# Obtain assigned container IP for p2p
NODE_IP=$(hostname -i)
if [ "$GETH_NODE_TYPE" = "bootnode" ]; then
echo "Starting bootnode"
# Generate boot.key
echo "$BOOT_KEY" > $GETH_DATA_DIR/boot.key
exec geth \
--verbosity="$VERBOSITY" \
--datadir="$GETH_DATA_DIR" \
--port 30301 \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net,engine \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--syncmode=full \
--gcmode=archive \
--networkid=$CHAIN_ID \
--nousb \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \
--nodekey $GETH_DATA_DIR/boot.key \
--netrestrict 172.13.0.0/24 \
--nat extip:$NODE_IP
elif [ "$GETH_NODE_TYPE" = "signer" ]; then
echo "Starting signer node"
exec geth \
--verbosity="$VERBOSITY" \
--datadir="$GETH_DATA_DIR" \
--port 30311 \
--syncmode=full \
--gcmode=full \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net,engine \
--bootnodes enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.13.0.100:30301 \
--networkid=$CHAIN_ID \
--unlock=$BLOCK_SIGNER_ADDRESS \
--password="$GETH_DATA_DIR"/password \
--mine \
--miner.etherbase=$BLOCK_SIGNER_ADDRESS \
--allow-insecure-unlock \
--nousb \
--netrestrict 172.13.0.0/24 \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port=6060 \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net,engine \
--rpc.allow-unprotected-txs \
--authrpc.addr="0.0.0.0" \
--authrpc.port="8551" \
--authrpc.vhosts="*" \
--nat extip:$NODE_IP
else
echo "Invalid GETH_NODE_TYPE specified"
fi

View file

@ -0,0 +1,18 @@
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 48ae5056012ae579897acca35535f35adf53fdda
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

@ -0,0 +1,14 @@
#!/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
# 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: '$L2_NODE_URL'|g" "$SRC_CHAINS_PATH"
exec yarn dev

52
geth-poa/genesis.json Normal file
View file

@ -0,0 +1,52 @@
{
"config": {
"chainId": 17864,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"clique": {
"period": 200,
"epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x6546df6d",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000d9cd8E5DE6d55f796D980B818D350C0746C25b97788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x1c9c380",
"difficulty": "0x1",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0xBe3dEF3973584FdcC1326634aF188f0d9772D57D": {
"balance": "10000000000000000000000"
},
"d9cd8E5DE6d55f796D980B818D350C0746C25b97": {
"balance": "10000000000000000000000"
},
"788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4": {
"balance": "10000000000000000000000"
},
"0DCaa27B9E4Db92F820189345792f8eC5Ef148F6": {
"balance": "10000000000000000000000"
},
"f39Fd6e51aad88F6F4ce6aB8827279cffFb92266": {
"balance": "10000000000000000000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": "0x3b9aca00",
"excessBlobGas": null,
"blobGasUsed": null
}

View file

@ -0,0 +1,25 @@
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
# RUN git checkout v3-audit-remediations
RUN git checkout ca301c80861701e17b13b9a06454795b317696b2
# TODO: checkout stable version, seemed like v3-audit-remediations changed build process
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

@ -0,0 +1,59 @@
---
mevcommitsettlement:
chainId: 17864
domainId: 17864
name: mevcommitsettlement
protocol: ethereum
rpcUrls:
# Only http field is required
- http: http://172.13.0.100: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
sepolia:
chainId: 11155111
domainId: 11155111
name: sepolia
protocol: ethereum
displayName: Sepolia
nativeToken:
name: Ether
symbol: ETH
decimals: 18
rpcUrls:
- http: https://eth-sepolia.g.alchemy.com/v2/a0wg_g1X-Wz4IeVA-0SS3PsQhbyQNjc_
blockExplorers:
- name: Etherscan
url: https://sepolia.etherscan.io
apiUrl: https://api-sepolia.etherscan.io/api
family: etherscan
blocks:
confirmations: 1
reorgPeriod: 2
estimateBlockTime: 13
isTestnet: true

View file

@ -0,0 +1,69 @@
#!/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
# 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 $CONTRACT_DEPLOYER_PRIVATE_KEY
expect {
"? Do you want use some existing contract addresses? (Y/n)" {
send -- "n\r"
exp_continue
}
"*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."
hyperlane deploy warp \
--yes \
--key $CONTRACT_DEPLOYER_PRIVATE_KEY \
--chains /chain-config.yml \
--config /warp-tokens.yml \
--core /hyperlane-monorepo/artifacts/core-deployment.json
# 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
touch artifacts/done-warp-route
fi
# Sleep to allow deployer health check (polled every 5sec) to pass
sleep 10

View file

@ -0,0 +1,7 @@
---
mevcommitsettlement:
type: 'messageIdMultisigIsm'
threshold: 2
validators:
- '0xd9cd8E5DE6d55f796D980B818D350C0746C25b97'
- '0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4'

View file

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

View file

@ -0,0 +1,19 @@
ARG AGENT_BASE_IMAGE
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 "http://172.13.0.100:8545" \
--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

@ -0,0 +1,15 @@
ARG AGENT_BASE_IMAGE
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="http://172.13.0.100:8545"
ENV HYP_BASE_DB="/val-db"
ENV HYP_CHECKPOINTSYNCER_TYPE="localStorage"
ENV HYP_ORIGINCHAINNAME="mevcommitsettlement"

View file

@ -0,0 +1,17 @@
#!/bin/bash
# See: https://geth.ethereum.org/docs/fundamentals/private-network's extradata section.
# Start with 32 bytes of zeros
extradata="0x$(printf '0%.0s' {1..64})"
for addr in "$@"; do
# Remove '0x' from the start of the address if present
addr="${addr#0x}"
extradata+="$addr"
done
# End with 65 bytes of zeros
extradata+=$(printf '0%.0s' {1..130})
echo "$extradata"