Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 59 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,70 @@ go-ubuntu-builder:

################## devnet 4 nodes ####################

devnet-up: submodules go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=.
EXECUTION_CLIENT ?= geth
MORPH_RETH_BUILD_FROM_SOURCE ?= false
ifeq ($(MORPH_RETH_BUILD_FROM_SOURCE),true)
MORPH_RETH_IMAGE ?= morph-reth:latest
MORPH_RETH_ENTRYPOINT ?= /app/morph-reth
else
MORPH_RETH_IMAGE ?= ghcr.io/morph-l2/morph-reth:latest
MORPH_RETH_ENTRYPOINT ?= /usr/local/bin/morph-reth
endif
MORPH_RETH_DIR ?= ../morph-reth
MORPH_RETH_BUILD_PROFILE ?= release
MORPH_RETH_RUSTFLAGS ?=
MORPH_RETH_DOCKER_TARGET ?= builder
export MORPH_RETH_IMAGE
export MORPH_RETH_DIR
export MORPH_RETH_BUILD_PROFILE
export MORPH_RETH_RUSTFLAGS
export MORPH_RETH_DOCKER_TARGET
export MORPH_RETH_ENTRYPOINT
DEVNET_COMPOSE_FILES := -f docker-compose-4nodes.yml

ifeq ($(EXECUTION_CLIENT),geth)
DEVNET_EXECUTION_DEPS := submodules
else ifeq ($(EXECUTION_CLIENT),reth)
DEVNET_COMPOSE_FILES += -f docker-compose-reth.yml
ifeq ($(MORPH_RETH_BUILD_FROM_SOURCE),true)
DEVNET_EXECUTION_DEPS := reth
else
DEVNET_EXECUTION_DEPS := reth-image
endif
else
$(error unsupported EXECUTION_CLIENT "$(EXECUTION_CLIENT)", expected "geth" or "reth")
endif
Comment on lines +161 to +172
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

cat >/tmp/exec-client-parse.mk <<'EOF'
EXECUTION_CLIENT ?= bad
ifeq ($(EXECUTION_CLIENT),geth)
else ifeq ($(EXECUTION_CLIENT),reth)
else
$(error unsupported EXECUTION_CLIENT "$(EXECUTION_CLIENT)")
endif

lint:
	@:
EOF

env EXECUTION_CLIENT=bad make -f /tmp/exec-client-parse.mk lint

Repository: morph-l2/morph

Length of output: 99


🏁 Script executed:

sed -n '161,173p' Makefile

Repository: morph-l2/morph

Length of output: 490


Avoid validating EXECUTION_CLIENT at parse time.

Line 172 is evaluated while Make parses the file, so an inherited EXECUTION_CLIENT=foo will break unrelated targets like make lint before target resolution. Please scope this check to the devnet targets, or rename the knob to something less collision-prone such as DEVNET_EXECUTION_CLIENT.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 161 - 173, The Makefile currently validates
EXECUTION_CLIENT at parse time (the conditional block setting
DEVNET_EXECUTION_DEPS / DEVNET_COMPOSE_FILES and the $(error ...)) which can
abort unrelated targets; move this validation into the devnet-specific target
logic or switch to a separate variable name (e.g. DEVNET_EXECUTION_CLIENT) to
avoid global parse-time evaluation. Specifically, replace references to
EXECUTION_CLIENT with DEVNET_EXECUTION_CLIENT (or wrap the existing conditional
inside the devnet target recipe) and ensure MORPH_RETH_BUILD_FROM_SOURCE,
DEVNET_EXECUTION_DEPS and DEVNET_COMPOSE_FILES are set only when the devnet
target is invoked; remove or relocate the $(error ...) so it runs at target
execution time rather than during Makefile parsing.


devnet-up: $(DEVNET_EXECUTION_DEPS) go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=. --execution-client=$(EXECUTION_CLIENT)
.PHONY: devnet-up

devnet-up-debugccc:
python3 ops/devnet-morph/main.py --polyrepo-dir=. --debugccc
devnet-up-reth:
$(MAKE) devnet-up EXECUTION_CLIENT=reth
.PHONY: devnet-up-reth

devnet-up-debugccc: $(DEVNET_EXECUTION_DEPS) go-ubuntu-builder
python3 ops/devnet-morph/main.py --polyrepo-dir=. --execution-client=$(EXECUTION_CLIENT) --debugccc
.PHONY: devnet-up-debugccc

devnet-down:
cd ops/docker && docker compose -f docker-compose-4nodes.yml down
cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) down
.PHONY: devnet-down

devnet-clean-build: devnet-l1-clean
cd ops/docker && docker compose -f docker-compose-4nodes.yml down --volumes --remove-orphans
cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) down --volumes --remove-orphans
docker volume ls --filter name=docker_ --format='{{.Name}}' | xargs docker volume rm 2>/dev/null || true
rm -rf ops/l2-genesis/.devnet
rm -rf ops/docker/.devnet
rm -rf ops/docker/consensus/beacondata ops/docker/consensus/validatordata ops/docker/consensus/genesis.ssz
rm -rf ops/docker/execution/geth
rm -rf ops/docker/execution/reth
.PHONY: devnet-clean-build

devnet-clean-build-reth:
$(MAKE) devnet-clean-build EXECUTION_CLIENT=reth
.PHONY: devnet-clean-build-reth

devnet-clean: devnet-clean-build
docker image ls '*morph*' --format='{{.Repository}}' | xargs -r docker rmi
docker image ls '*sentry-*' --format='{{.Repository}}' | xargs -r docker rmi
Expand All @@ -171,9 +214,18 @@ devnet-l1-clean:
.PHONY: devnet-l1-clean

devnet-logs:
@(cd ops/docker && docker-compose logs -f)
@(cd ops/docker && docker compose $(DEVNET_COMPOSE_FILES) logs -f)
.PHONY: devnet-logs

reth-image:
docker pull "$(MORPH_RETH_IMAGE)"
.PHONY: reth-image

reth:
@test -d "$(MORPH_RETH_DIR)" || (echo "morph-reth directory not found: $(MORPH_RETH_DIR)" && exit 1)
docker build -t "$(MORPH_RETH_IMAGE)" --target "$(MORPH_RETH_DOCKER_TARGET)" --build-arg BUILD_PROFILE="$(MORPH_RETH_BUILD_PROFILE)" --build-arg RUSTFLAGS="$(MORPH_RETH_RUSTFLAGS)" "$(MORPH_RETH_DIR)"
.PHONY: reth

# tx-submitter
SUBMITTERS := $(shell grep -o 'tx-submitter-[0-9]*[^:]' ops/docker/docker-compose-4nodes.yml | sort | uniq)
rebuild-all-tx-submitter:
Expand Down
16 changes: 8 additions & 8 deletions node/ops-morph/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: '3.8'

volumes:
sequencer_geth_data:
sequencer_el_data:
sequencer_node_data:

services:
sequencer_geth:
morph-el-0:
image: morph/l2geth:latest
ports:
- "8545:8545"
Expand All @@ -18,7 +18,7 @@ services:
timeout: 5s
retries: 3
volumes:
- "sequencer_geth_data:${GETH_DATA_DIR}"
- "sequencer_el_data:${GETH_DATA_DIR}"
- "${PWD}/jwt-secret.txt:${JWT_SECRET_PATH}"
- "${PWD}/genesis_geth.json:${GENESIS_FILE_PATH}"
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
Expand All @@ -27,7 +27,7 @@ services:

sequencer_node:
depends_on:
sequencer_geth:
morph-el-0:
condition: service_started
build:
context: ..
Expand All @@ -37,8 +37,8 @@ services:
- "26656:26656"
environment:
- EMPTY_BLOCK_DELAY=true
- MORPH_NODE_L2_ETH_RPC=http://sequencer_geth:8545
- MORPH_NODE_L2_ENGINE_RPC=http://sequencer_geth:8551
- MORPH_NODE_L2_ETH_RPC=http://morph-el-0:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-el-0:8551
- MORPH_NODE_L2_ENGINE_AUTH=jwt-secret.txt
## todo need to replace it to a public network
- MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC}
Expand All @@ -54,15 +54,15 @@ services:

tx-submitter:
depends_on:
sequencer_geth:
morph-el-0:
condition: service_started
sequencer_node:
condition: service_started
image: tx-submitter:latest
command: rollup
environment:
- TX_SUBMITTER_L1_PRIVATE_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- TX_SUBMITTER_L2_RPC_URL=http://sequencer_geth:8545
- TX_SUBMITTER_L2_RPC_URL=http://morph-el-0:8545
- TX_SUBMITTER_L1_RPC_URL=${L1_ETH_RPC}
- TX_SUBMITTER_ROLLUP_CONTRACT_ADDRESS=0x6900000000000000000000000000000000000010
- TX_SUBMITTER_EVENT_NAME=SubmitBatches
Expand Down
48 changes: 24 additions & 24 deletions node/ops-morph/testnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ volumes:
o: bind

services:
morph-geth-0:
morph-el-0:
image: morph/l2geth:latest
ports:
- "8545:8545"
Expand All @@ -48,9 +48,9 @@ services:
- "/bin/bash"
- "/entrypoint.sh"

morph-geth-1:
morph-el-1:
depends_on:
- morph-geth-0
- morph-el-0
image: morph/l2geth:latest
ports:
- "8645:8545"
Expand All @@ -63,14 +63,14 @@ services:
- "${PWD}/../genesis_geth.json:/genesis.json"
- "${PWD}/static-nodes.json:/db/geth/static-nodes.json"
environment:
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-geth-0:30303
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-el-0:30303
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
- "/bin/bash"
- "/entrypoint.sh"

morph-geth-2:
morph-el-2:
depends_on:
- morph-geth-0
- morph-el-0
image: morph/l2geth:latest
ports:
- "8745:8545"
Expand All @@ -83,14 +83,14 @@ services:
- "${PWD}/../genesis_geth.json:/genesis.json"
- "${PWD}/static-nodes.json:/db/geth/static-nodes.json"
environment:
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-geth-0:30303
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-el-0:30303
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
- "/bin/bash"
- "/entrypoint.sh"

morph-geth-3:
morph-el-3:
depends_on:
- morph-geth-0
- morph-el-0
image: morph/l2geth:latest
ports:
- "8845:8545"
Expand All @@ -103,14 +103,14 @@ services:
- "${PWD}/../genesis_geth.json:/genesis.json"
- "${PWD}/static-nodes.json:/db/geth/static-nodes.json"
environment:
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-geth-0:30303
- BOOT_NODES=enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-el-0:30303
entrypoint: # pass the L2 specific flags by overriding the entry-point and adding extra arguments
- "/bin/bash"
- "/entrypoint.sh"

node-0:
depends_on:
morph-geth-0:
morph-el-0:
condition: service_started
image: morph-node:latest
ports:
Expand All @@ -119,8 +119,8 @@ services:
- "26658"
environment:
- EMPTY_BLOCK_DELAY=true
- MORPH_NODE_L2_ETH_RPC=http://morph-geth-0:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-geth-0:8551
- MORPH_NODE_L2_ETH_RPC=http://morph-el-0:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-el-0:8551
- MORPH_NODE_L2_ENGINE_AUTH=jwt-secret.txt
- MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC}
- MORPH_NODE_SYNC_DEPOSIT_CONTRACT_ADDRESS=0x6900000000000000000000000000000000000001
Expand All @@ -134,7 +134,7 @@ services:

node-1:
depends_on:
morph-geth-1:
morph-el-1:
condition: service_started
image: morph-node:latest
ports:
Expand All @@ -143,8 +143,8 @@ services:
- "26658"
environment:
- EMPTY_BLOCK_DELAY=true
- MORPH_NODE_L2_ETH_RPC=http://morph-geth-1:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-geth-1:8551
- MORPH_NODE_L2_ETH_RPC=http://morph-el-1:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-el-1:8551
- MORPH_NODE_L2_ENGINE_AUTH=jwt-secret.txt
- MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC}
- MORPH_NODE_SYNC_DEPOSIT_CONTRACT_ADDRESS=0x6900000000000000000000000000000000000001
Expand All @@ -158,7 +158,7 @@ services:

node-2:
depends_on:
morph-geth-2:
morph-el-2:
condition: service_started
image: morph-node:latest
ports:
Expand All @@ -167,8 +167,8 @@ services:
- "26658"
environment:
- EMPTY_BLOCK_DELAY=true
- MORPH_NODE_L2_ETH_RPC=http://morph-geth-2:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-geth-2:8551
- MORPH_NODE_L2_ETH_RPC=http://morph-el-2:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-el-2:8551
- MORPH_NODE_L2_ENGINE_AUTH=jwt-secret.txt
- MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC}
- MORPH_NODE_SYNC_DEPOSIT_CONTRACT_ADDRESS=0x6900000000000000000000000000000000000001
Expand All @@ -182,17 +182,17 @@ services:

node-3:
depends_on:
morph-geth-3:
morph-el-3:
condition: service_started
image: -node:latest
image: morph-node:latest
ports:
- "26656"
- "26657"
- "26658"
environment:
- EMPTY_BLOCK_DELAY=true
- MORPH_NODE_L2_ETH_RPC=http://morph-geth-3:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-geth-3:8551
- MORPH_NODE_L2_ETH_RPC=http://morph-el-3:8545
- MORPH_NODE_L2_ENGINE_RPC=http://morph-el-3:8551
- MORPH_NODE_L2_ENGINE_AUTH=jwt-secret.txt
- MORPH_NODE_L1_ETH_RPC=${L1_ETH_RPC}
- MORPH_NODE_SYNC_DEPOSIT_CONTRACT_ADDRESS=0x6900000000000000000000000000000000000001
Expand All @@ -202,4 +202,4 @@ services:
command: >
morphnode
--dev-sequencer
--home $NODE_DATA_DIR
--home $NODE_DATA_DIR
2 changes: 1 addition & 1 deletion node/ops-morph/testnet/static-nodes.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-geth-0:30303"]
["enode://58e698ea2dd8a76e0cb185d13c1faabf223b60c89fef988c8b89496571056d6c2922109537bb291cd87f2ec09a23ac37d59bde2c7a4885d07b7b641cadff2921@morph-el-0:30303"]
Loading
Loading