-
Notifications
You must be signed in to change notification settings - Fork 70
feat(devnet): optimize Docker builds, enable MPT mode, bump go-ethereum #925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| prover/ | ||
| .git/ | ||
| contracts/node_modules/ | ||
| ops/reth-cross-test/ | ||
| ops/publicnode/ | ||
| docs/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM --platform=linux/amd64 ubuntu:20.04 as chain-genesis | ||
| FROM --platform=linux/amd64 ubuntu:22.04 as chain-genesis | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chain🌐 Web query: `For these images, what is the default USER in image metadata?
💡 Result: The default USER in the Docker image metadata for both images is "root". For gcr.io/prysmaticlabs/prysm/beacon-chain:v4.2.1, the image configuration explicitly states "User": "root" (from metadata of similar v4.1.1 image, as v4.2.1 uses the same Bazel-built distroless-like structure without a non-root USER instruction). For ethereum/client-go:v1.14.11, the Dockerfile is based on alpine:latest with no USER instruction, so it defaults to root (standard for Alpine-based Go static binaries). Citations:
Add explicit non-root USER directive to comply with DS-0002 Both inherited base images ( 🧰 Tools🪛 Trivy (0.69.3)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||
| RUN apt-get update && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && apt-get install build-essential curl wget git make pkg-config -y | ||
| RUN curl -o prysmctl -fLO https://github.com/prysmaticlabs/prysm/releases/download/v4.2.1/prysmctl-v4.2.1-linux-amd64 | ||
| RUN chmod +x prysmctl | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| FROM rust:1.70 as builder | ||
| FROM rust:1.88-slim as builder | ||
|
|
||
| RUN apt-get -qq update && apt-get -qq install -y --no-install-recommends \ | ||
| pkg-config libssl-dev && rm -rf /var/lib/apt/lists/* | ||
|
Comment on lines
+1
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the runtime image as non-root Line 11-14 keeps the container default user as root, which weakens container isolation. Please add a non-root user in the 🔧 Proposed fix FROM ubuntu:22.04 as app
+RUN useradd --system --create-home --uid 10001 morph && \
+ mkdir -p /app && chown -R morph:morph /app
COPY --from=builder /gas-oracle/app/target/release/app /
+USER morph
CMD ["./app"]🧰 Tools🪛 Trivy (0.69.3)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||
|
|
||
| COPY ./gas-oracle /gas-oracle | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,10 +75,11 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro | |
| EmeraldTime: emeraldTime, | ||
| TerminalTotalDifficulty: big.NewInt(0), | ||
| Morph: params.MorphConfig{ | ||
| UseZktrie: true, | ||
| UseZktrie: false, | ||
| MaxTxPayloadBytesPerBlock: &maxTxPayloadBytesPerBlock, | ||
| FeeVaultAddress: &sequencerFeeVaultReceipt, | ||
| }, | ||
| JadeForkTime: new(uint64), | ||
| } | ||
|
|
||
| gasLimit := config.L2GenesisBlockGasLimit | ||
|
|
@@ -88,6 +89,8 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro | |
| var baseFee *big.Int | ||
| if config.L2GenesisBlockBaseFeePerGas != nil { | ||
| baseFee = config.L2GenesisBlockBaseFeePerGas.ToInt() | ||
| } else { | ||
| baseFee = big.NewInt(1_000_000) | ||
| } | ||
|
Comment on lines
89
to
94
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if there's documentation or other references for expected L2 base fee defaults
rg -n -C3 'BaseFee|baseFee|base_fee' --type go ops/l2-genesis/
# Check if any deploy configs explicitly set L2GenesisBlockBaseFeePerGas
fd -e json -e yaml | xargs rg -l 'L2GenesisBlockBaseFeePerGas' 2>/dev/null | head -5 | xargs -I{} sh -c 'echo "=== {} ===" && cat {}'Repository: morph-l2/morph Length of output: 8973 🏁 Script executed: # Search for deploy config files and see what base fee values they use
fd -e json -e toml -e yaml | xargs rg -l 'l2GenesisBlockBaseFeePerGas|L2GenesisBlockBaseFeePerGas' 2>/dev/null
# Check for any comments or documentation about this field
rg -B5 -A5 'L2GenesisBlockBaseFeePerGas' ops/l2-genesis/morph-chain-ops/genesis/config.go
# Look at the actual usage in NewL2StorageConfig to understand the purpose
rg -B10 -A10 'l1BaseFee' ops/l2-genesis/morph-chain-ops/genesis/config.goRepository: morph-l2/morph Length of output: 1555 🏁 Script executed: # Read the test deploy config to see what base fee value is used
cat ops/l2-genesis/morph-chain-ops/genesis/testdata/test-deploy-config-full.json | jq '.l2GenesisBlockBaseFeePerGas // "NOT_SET"'
# Check if there are other deploy config examples
fd -type f \( -name '*deploy*' -o -name '*config*' \) -path '*/testdata/*' | head -10
# Look for any comments in genesis.go about why this default was chosen
head -100 ops/l2-genesis/morph-chain-ops/genesis/genesis.go | tail -50Repository: morph-l2/morph Length of output: 1846 🏁 Script executed: # Verify the hex to decimal conversion
python3 << 'EOF'
test_value = 0x3b9aca00
print(f"Test config value: 0x3b9aca00 = {test_value} wei = {test_value / 1e9} gwei")
default_value = 1_000_000
print(f"Code default: {default_value} wei = {default_value / 1e9} gwei")
print(f"Ratio: {test_value / default_value}x difference")
EOF
# Search for other deploy config examples
find ops/l2-genesis -name '*.json' | head -20
# Check if there are comments or related issues about this
rg -B3 -A3 '1_000_000|1000000' ops/l2-genesis/morph-chain-ops/genesis/Repository: morph-l2/morph Length of output: 5035 🏁 Script executed: # Extract base fee values from all deploy configs
for config in ops/l2-genesis/deploy-config/*.json; do
echo "=== $(basename $config) ==="
jq '.l2GenesisBlockBaseFeePerGas // "NOT_SET"' "$config"
done
# Also check git blame for the 1_000_000 line to understand when it was added
cd ops/l2-genesis/morph-chain-ops/genesis && git log -p --all -S '1_000_000' -- genesis.go | head -80Repository: morph-l2/morph Length of output: 322 🏁 Script executed: # Look for any comments or context around this change in genesis.go
rg -B10 'baseFee = big.NewInt' ops/l2-genesis/morph-chain-ops/genesis/genesis.go
# Search for any comments or documentation about base fee defaults
rg -i 'base.*fee.*default|default.*base.*fee' ops/l2-genesis/
# Check git log more carefully (with different approach)
git -C ops/l2-genesis log --oneline --all -- morph-chain-ops/genesis/genesis.go | head -20Repository: morph-l2/morph Length of output: 777 🏁 Script executed: # Final check: look at the actual definition of this value and nearby code patterns
rg -B5 -A5 'defaultL2GasLimit' ops/l2-genesis/morph-chain-ops/genesis/genesis.go
# Check if there are any test failures or expectations about base fee
rg 'baseFee.*1_000_000|1_000_000.*baseFee' ops/l2-genesis/Repository: morph-l2/morph Length of output: 812 Fix the base fee default: should be 1,000,000,000 wei (1 gwei), not 1,000,000 wei (0.001 gwei). The default Change line 93 from 🤖 Prompt for AI Agents |
||
|
|
||
| difficulty := config.L2GenesisBlockDifficulty | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 112
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 854
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 2271
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 5562
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 125
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 1708
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 686
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 291
🏁 Script executed:
Repository: morph-l2/morph
Length of output: 4323
The .dockerignore change breaks ops/publicnode/ builds.
Excluding
ops/publicnode/from .dockerignore will prevent Docker from locatingops/publicnode/Dockerfile.geth-ncccandops/publicnode/Dockerfile.node, which are actively referenced byops/publicnode/docker-compose.ymlwithcontext: ../... Whenmake run-holesky-nodeexecutesdocker-compose up, the build will fail because the dockerfile paths are no longer available in the build context. Either removeops/publicnode/from .dockerignore or update the docker-compose references to use absolute paths or alternative contexts.🤖 Prompt for AI Agents