diff --git a/geth-poa/Makefile b/geth-poa/Makefile index 6890bb67e3af..76ae03e97abb 100644 --- a/geth-poa/Makefile +++ b/geth-poa/Makefile @@ -23,13 +23,17 @@ 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:v3.3-patch-mac L2_NODE_URL=http://localhost:8545 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=shaspitz/hyperlane-agent-mac:6985064 L2_NODE_URL=http://localhost:8545 docker compose --profile settlement --profile local_l1 up -d + down: - AGENT_BASE_IMAGE=nil L2_NODE_URL=nil docker compose --profile settlement --profile bridge --profile prod_agents down + AGENT_BASE_IMAGE=nil L2_NODE_URL=nil docker compose --profile settlement --profile bridge --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 down --rmi all --volumes - -docker compose --profile settlement --profile bridge rm -fv + -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 image prune -f pull-image: diff --git a/geth-poa/docker-compose.yml b/geth-poa/docker-compose.yml index 666d7228b3d5..e28d4b74cb7a 100644 --- a/geth-poa/docker-compose.yml +++ b/geth-poa/docker-compose.yml @@ -7,6 +7,7 @@ services: environment: - GETH_NODE_TYPE=bootnode - BOOT_KEY=7b548c1c0fbe80ef1eb0aaec2edf26fd20fb0d758e94948cf6c5f2a486e735f6 + - NET_RESTRICT=172.29.0.0/16 networks: primev_net: ipv4_address: '172.29.0.98' @@ -48,6 +49,8 @@ services: - GETH_NODE_TYPE=signer - BLOCK_SIGNER_ADDRESS=0xd9cd8E5DE6d55f796D980B818D350C0746C25b97 - BLOCK_SIGNER_PRIVATE_KEY=${NODE1_PRIVATE_KEY} + - BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.29.0.98:30301 + - NET_RESTRICT=172.29.0.0/16 networks: primev_net: ipv4_address: '172.29.0.99' @@ -77,7 +80,6 @@ services: } ] - sl-node2: build: context: .. @@ -86,6 +88,8 @@ services: - GETH_NODE_TYPE=signer - BLOCK_SIGNER_ADDRESS=0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4 - BLOCK_SIGNER_PRIVATE_KEY=${NODE2_PRIVATE_KEY} + - BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.29.0.98:30301 + - NET_RESTRICT=172.29.0.0/16 networks: primev_net: ipv4_address: '172.29.0.100' @@ -115,6 +119,59 @@ services: } ] + # L1 geth services only used for local dev + l1-bootnode: + build: + context: . + dockerfile: ./local-l1/Dockerfile + environment: + - GETH_NODE_TYPE=bootnode + - BOOT_KEY=7b548c1c0fbe80ef1eb0aaec2edf26fd20fb0d758e94948cf6c5f2a486e735f6 + - NET_RESTRICT=172.14.0.0/24 + networks: + l1_net: + ipv4_address: '172.14.0.2' + volumes: + - geth-data-l1-bootnode:/data + profiles: + - local_l1 + + l1-node1: + build: + context: . + dockerfile: ./local-l1/Dockerfile + environment: + - GETH_NODE_TYPE=signer + - BLOCK_SIGNER_ADDRESS=0xd9cd8E5DE6d55f796D980B818D350C0746C25b97 + - BLOCK_SIGNER_PRIVATE_KEY=${NODE1_PRIVATE_KEY} + - BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.14.0.2:30301 + - NET_RESTRICT=172.14.0.0/24 + networks: + l1_net: + ipv4_address: '172.14.0.3' + volumes: + - geth-data-l1-first-signer:/data + profiles: + - local_l1 + + l1-node2: + build: + context: . + dockerfile: ./local-l1/Dockerfile + environment: + - GETH_NODE_TYPE=signer + - BLOCK_SIGNER_ADDRESS=0x788EBABe5c3dD422Ef92Ca6714A69e2eabcE1Ee4 + - BLOCK_SIGNER_PRIVATE_KEY=${NODE2_PRIVATE_KEY} + - BOOTNODE_ENDPOINT=enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.14.0.2:30301 + - NET_RESTRICT=172.14.0.0/24 + networks: + l1_net: + ipv4_address: '172.14.0.4' + volumes: + - geth-data-l1-second-signer:/data + profiles: + - local_l1 + hyperlane-deployer: build: context: ./hyperlane-deployer @@ -250,11 +307,20 @@ services: networks: primev_net: external: true + l1_net: + driver: bridge + ipam: + driver: default + config: + - subnet: 172.14.0.0/16 volumes: geth-data-bootnode: geth-data-node1: geth-data-node2: + geth-data-l1-bootnode: + geth-data-l1-first-signer: + geth-data-l1-second-signer: hyperlane-deploy-artifacts: hyperlane-validator1-sigs: hyperlane-validator2-sigs: diff --git a/geth-poa/entrypoint.sh b/geth-poa/entrypoint.sh index ac07e618d019..e0bd863beb44 100644 --- a/geth-poa/entrypoint.sh +++ b/geth-poa/entrypoint.sh @@ -74,7 +74,7 @@ if [ "$GETH_NODE_TYPE" = "bootnode" ]; then --metrics.addr=0.0.0.0 \ --metrics.port=6060 \ --nodekey $GETH_DATA_DIR/boot.key \ - --netrestrict 172.29.0.0/16 \ + --netrestrict $NET_RESTRICT \ --nat extip:$NODE_IP \ --txpool.accountqueue=512 \ --rpc.allow-unprotected-txs @@ -96,7 +96,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then --http.addr=0.0.0.0 \ --http.port="$RPC_PORT" \ --http.api=web3,debug,eth,txpool,net,engine \ - --bootnodes enode://34a2a388ad31ca37f127bb9ffe93758ee711c5c2277dff6aff2e359bcf2c9509ea55034196788dbd59ed70861f523c1c03d54f1eabb2b4a5c1c129d966fe1e65@172.29.0.98:30301 \ + --bootnodes $BOOTNODE_ENDPOINT \ --networkid=$CHAIN_ID \ --unlock=$BLOCK_SIGNER_ADDRESS \ --password="$GETH_DATA_DIR"/password \ @@ -104,7 +104,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then --miner.etherbase=$BLOCK_SIGNER_ADDRESS \ --allow-insecure-unlock \ --nousb \ - --netrestrict 172.29.0.0/16 \ + --netrestrict $NET_RESTRICT \ --metrics \ --metrics.addr=0.0.0.0 \ --metrics.port=6060 \ diff --git a/geth-poa/local-l1/Dockerfile b/geth-poa/local-l1/Dockerfile new file mode 100644 index 000000000000..47ad72b808a1 --- /dev/null +++ b/geth-poa/local-l1/Dockerfile @@ -0,0 +1,12 @@ +# Local L1 nodes are NOT built from source +FROM ethereum/client-go:v1.13.4 as builder + +RUN apk add --no-cache jq + +# Reuse entrypoint for mev-commit chain +COPY ./entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +COPY ./local-l1/genesis.json /genesis.json + +ENTRYPOINT ["/bin/sh", "/entrypoint.sh"] diff --git a/geth-poa/local-l1/README.md b/geth-poa/local-l1/README.md new file mode 100644 index 000000000000..620c49300da2 --- /dev/null +++ b/geth-poa/local-l1/README.md @@ -0,0 +1,5 @@ +# Local L1 + +This directory contains a genesis and dockerfile for running a local L1 chain in addition to the mev-commit chain. + +Nodes for the local L1 chain are built from geth v1.13.4 images, not built from source code in this repo like the mev-commit chain. diff --git a/geth-poa/local-l1/genesis.json b/geth-poa/local-l1/genesis.json new file mode 100644 index 000000000000..2ac8c763836f --- /dev/null +++ b/geth-poa/local-l1/genesis.json @@ -0,0 +1,52 @@ +{ + "config": { + "chainId": 39999, + "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": 12, + "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 + }