feat(aztec): rootless docker, hardening, feedback improvements#139
feat(aztec): rootless docker, hardening, feedback improvements#139coincashew merged 1 commit intomainfrom
Conversation
WalkthroughAdds a public initializeNetwork() to ethpillar.sh to centralize endpoint and Aztec .env remote-RPC handling and calls it during startup; converts many sudo docker/docker compose invocations to non-sudo; introduces rootless Docker install flow; updates Aztec compose example with explicit ports, resource/security, and logging. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User
participant Script as ethpillar.sh
participant Init as initializeNetwork()
participant Env as /opt/ethpillar/aztec/.env
participant Cfg as getNetworkConfig
participant Net as getNetwork
User->>Script: start
Script->>Init: initializeNetwork()
Init->>Init: set default CL/REST & EL host/ports
alt Aztec .env present
Init->>Env: read ETHEREUM_HOSTS, L1_CONSENSUS_HOST_URLS
Env-->>Init: values
Init->>Init: select first RPC(s), export endpoints
end
Init->>Cfg: getNetworkConfig()
Cfg-->>Init: config
Init->>Net: getNetwork()
Net-->>Init: network info
Init->>Script: export API_BN_ENDPOINT & EL_RPC_ENDPOINT
Script->>User: continue startup / show menu
sequenceDiagram
autonumber
participant User
participant Installer as helpers/install_docker.sh
participant Systemd as systemd
User->>Installer: run install_docker.sh
alt Running as non-root
Installer->>Installer: install rootless extras & uidmap
Installer->>Installer: run dockerd-rootless-setuptool.sh
Installer->>Systemd: enable user lingering & per-user docker.service (best-effort)
Systemd-->>Installer: user service status
Installer-->>User: set DOCKER_HOST in ~/.profile / ~/.bashrc
else Running as root
Installer->>Systemd: systemctl enable --now docker
Systemd-->>Installer: service active
Installer-->>User: system docker enabled
end
Installer-->>User: installation complete (mode-specific instructions)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧬 Code graph analysis (2)plugins/aztec/menu.sh (1)
plugins/aztec/plugin_aztec.sh (1)
🔇 Additional comments (13)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/aztec/plugin_aztec.sh (1)
262-267: Uninstall path mixes root and rootless dockersudo docker rm/rmi will miss containers/images owned by the rootless daemon. Prefer plain docker (same daemon used by compose) for consistency.
Updated removeAll (outside changed hunk):
removeAll() { if whiptail --title "Uninstall $APP_NAME" --defaultno --yesno "Are you sure you want to remove $APP_NAME" 9 78; then cd "$PLUGIN_INSTALL_PATH" 2>/dev/null && docker compose down || true docker rm -f "$APP_NAME" 2>/dev/null || true TAG=$(grep "DOCKER_TAG" "$PLUGIN_INSTALL_PATH/.env" | sed "s/^DOCKER_TAG=\(.*\)/\1/") docker rmi -f "$DOCKER_IMAGE:$TAG" 2>/dev/null || true if [[ -f "$PLUGIN_INSTALL_PATH/.cast_installed_by_plugin" && -f /usr/local/bin/cast ]]; then sudo rm /usr/local/bin/cast fi sudo rm -rf "$PLUGIN_INSTALL_PATH" whiptail --title "Uninstall finished" --msgbox "You have uninstalled $APP_NAME." 8 78 fi }
🧹 Nitpick comments (2)
plugins/aztec/docker-compose.yml.example (1)
21-22: NET_BIND_SERVICE is unnecessary hereAll exposed ports are >1024, so NET_BIND_SERVICE is not needed. Dropping it reduces config noise.
Apply this diff:
- cap_add: # Add only required capabilities - - NET_BIND_SERVICE # Needed for binding to ports + # No cap_add needed for high portsplugins/aztec/plugin_aztec.sh (1)
140-161: URL validation only checks the first entry in comma‑separated listsSubsequent URLs aren’t validated. Split on commas and validate each to catch bad entries early.
Example:
validate_list() { IFS=',' read -ra items <<<"$1" for u in "${items[@]}"; do [[ "$u" =~ ^https?:// ]] || return 1; done }Use validate_list for ETH_RPC and BEACON_RPC.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ethpillar.sh(5 hunks)helpers/install_docker.sh(1 hunks)plugins/aztec/docker-compose.yml.example(2 hunks)plugins/aztec/menu.sh(5 hunks)plugins/aztec/plugin_aztec.sh(4 hunks)view_logs.sh(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
helpers/install_docker.sh (1)
plugins/aztec/plugin_aztec.sh (1)
install(109-258)
ethpillar.sh (1)
functions.sh (2)
getNetworkConfig(21-26)getNetwork(192-218)
plugins/aztec/plugin_aztec.sh (1)
plugins/aztec/menu.sh (1)
info(15-17)
plugins/aztec/menu.sh (1)
plugins/aztec/plugin_aztec.sh (2)
error(33-36)info(29-31)
🔇 Additional comments (15)
ethpillar.sh (5)
37-65: initializeNetwork(): solid centralization of endpointsGood guard for Aztec remote RPCs and CSV handling; exports are scoped and only override when both URLs exist.
Please confirm .env always contains L1_CONSENSUS_HOST_URLS and ETHEREUM_HOSTS (unquoted, no spaces), as grep/sed assume that shape.
227-228: Non‑sudo logs for Aztec (remote RPC path)Matches rootless posture; good.
1576-1578: Exiting after Aztec install: confirm intentexit 0 stops EthPillar immediately after installing Aztec. If the intent was to return to menu, consider returning instead.
1640-1641: Calling initializeNetwork before menuRight placement to prep BACKTITLE and helpers.
83-84: Non‑sudo docker compose invocationVerification ran
docker compose versionin the sandbox and failed: "/bin/bash: line 3: docker: command not found". Cannot confirm Docker Compose plugin availability — ensure Docker + the Compose plugin are installed on target hosts/CI, or add runtime detection/fallback in ethpillar.sh (lines 83–84).test -d /opt/ethpillar/"${_DIRNAME[i]}" && cd "/opt/ethpillar/${_DIRNAME[i]}" && docker compose "$1" doneview_logs.sh (2)
56-56: Switched to non‑sudo docker compose logs (remote RPC path)LGTM.
70-70: Switched to non‑sudo docker compose logs (local RPC path)LGTM.
plugins/aztec/menu.sh (5)
160-168: Rootless detection: helpful UXClear signal to the user about daemon mode. Good addition.
232-239: Container start time formattingRobust fallback to N/A; concise status block.
406-406: Non‑sudo docker compose logsAligns with rootless path; good.
418-422: Non‑sudo stop/restartConsistent with the rest of the PR.
428-429: Pull then write current_versionConsider pulling with --quiet to avoid noisy UI; logic looks fine.
plugins/aztec/plugin_aztec.sh (3)
63-66: docker install wrapper is fine; group add is optional for rootlessAdding the user to the docker group isn’t needed for rootless, but harmless. No action required.
If you want to skip the group add when rootless is detected: check docker info | grep -q rootless.
236-240: Chown to current userGood to ensure non‑sudo compose can manage files.
294-304: Post‑install re‑login prompt for dockerNice UX. Complements rootless setup.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
helpers/install_docker.sh (2)
43-48: Ensure non-root usage works when installed as root (docker group).If the script runs as root, later non-sudo docker calls will fail for the regular user unless they’re in the docker group.
Apply this diff:
if [ "$(id -u)" -eq 0 ]; then echo "🚦 Enabling and starting Docker service..." sudo systemctl enable --now docker + # Allow current login user to use docker without sudo (effective after re-login) + if id -nG "${SUDO_USER:-$USER}" | grep -qw docker; then + : + else + sudo usermod -aG docker "${SUDO_USER:-$USER}" || true + echo "ℹ️ Added ${SUDO_USER:-$USER} to docker group. Please log out/in for group changes to take effect." + fi else
29-41: Optional: surface DOCKER_HOST guidance for rootless.Some environments won’t auto-detect the rootless socket. Consider exporting DOCKER_HOST in the user’s shell profile after setup.
Apply this diff:
dockerd-rootless-setuptool.sh install # enable user service (best-effort) and allow running after logout sudo loginctl enable-linger "$USER" || true - systemctl --user enable docker || true - systemctl --user restart docker || true + systemctl --user enable docker || true + systemctl --user restart docker || true + # Hint for non-interactive/CI shells where autodetect may fail + SOCK="unix:///run/user/$(id -u)/docker.sock" + if ! grep -q 'DOCKER_HOST=' "$HOME/.profile" 2>/dev/null; then + echo "export DOCKER_HOST=${SOCK}" >> "$HOME/.profile" + fiethpillar.sh (2)
37-65: Add sane defaults and slightly harden .env parsing.Avoid “http://:” when env is unset and be resilient to spaces. Also quote vars.
Apply this diff:
initializeNetwork(){ - # Consensus client or beacon node HTTP Endpoint - export API_BN_ENDPOINT="http://${CL_IP_ADDRESS}:${CL_REST_PORT}" - - # Execution layer RPC API - export EL_RPC_ENDPOINT="http://${EL_IP_ADDRESS}:${EL_RPC_PORT}" + # Defaults if not provided + : "${CL_IP_ADDRESS:=127.0.0.1}" + : "${CL_REST_PORT:=5052}" + : "${EL_IP_ADDRESS:=127.0.0.1}" + : "${EL_RPC_PORT:=8545}" + # Consensus client or beacon node HTTP Endpoint + export API_BN_ENDPOINT="http://${CL_IP_ADDRESS}:${CL_REST_PORT}" + # Execution layer RPC API + export EL_RPC_ENDPOINT="http://${EL_IP_ADDRESS}:${EL_RPC_PORT}" # Handle Aztec remote RPC nodes if [[ -d /opt/ethpillar/aztec ]] && [[ ! -f /etc/systemd/system/consensus.service ]]; then # Load RPC URLs from .env if [[ -f /opt/ethpillar/aztec/.env ]]; then - consensus_beacon_rpc=$(grep ^L1_CONSENSUS_HOST_URLS /opt/ethpillar/aztec/.env | sed 's/L1_CONSENSUS_HOST_URLS=//g') - execution_l1_rpc=$(grep ^ETHEREUM_HOSTS /opt/ethpillar/aztec/.env | sed 's/ETHEREUM_HOSTS=//g') + consensus_beacon_rpc=$(sed -n 's/^L1_CONSENSUS_HOST_URLS=\(.*\)/\1/p' /opt/ethpillar/aztec/.env | tr -d '[:space:]') + execution_l1_rpc=$(sed -n 's/^ETHEREUM_HOSTS=\(.*\)/\1/p' /opt/ethpillar/aztec/.env | tr -d '[:space:]') fi # If there's a list of comma separated rpc nodes, use the first node consensus_beacon_rpc=${consensus_beacon_rpc%%,*} execution_l1_rpc=${execution_l1_rpc%%,*} - if [[ -n "$consensus_beacon_rpc" && -n "$execution_l1_rpc" ]]; then - export API_BN_ENDPOINT="$consensus_beacon_rpc" - export EL_RPC_ENDPOINT="$execution_l1_rpc" + if [[ -n "$consensus_beacon_rpc" && -n "$execution_l1_rpc" ]]; then + export API_BN_ENDPOINT="$consensus_beacon_rpc" + export EL_RPC_ENDPOINT="$execution_l1_rpc" fi fi # Initialize network variables getNetworkConfig getNetwork }
227-228: Compose logs flags: avoid ambiguous short-option bundling.Use separate flags for clarity/compatibility.
Apply this diff:
- cd /opt/ethpillar/aztec && docker compose logs -fn 233 + cd /opt/ethpillar/aztec && docker compose logs -f -n 233
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ethpillar.sh(5 hunks)helpers/install_docker.sh(1 hunks)plugins/aztec/docker-compose.yml.example(2 hunks)plugins/aztec/menu.sh(6 hunks)plugins/aztec/plugin_aztec.sh(4 hunks)view_logs.sh(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- view_logs.sh
- plugins/aztec/menu.sh
- plugins/aztec/plugin_aztec.sh
- plugins/aztec/docker-compose.yml.example
🧰 Additional context used
🧬 Code graph analysis (2)
ethpillar.sh (1)
functions.sh (2)
getNetworkConfig(21-26)getNetwork(192-218)
helpers/install_docker.sh (1)
plugins/aztec/plugin_aztec.sh (1)
install(109-258)
🔇 Additional comments (4)
helpers/install_docker.sh (2)
29-41: Great: rootless/system daemon split implemented as discussed previously.The UID-branching, safe socket removal, linger, and user-service handling address the earlier conflict. Nice fix.
39-40: Don’t use sudo with systemctl --user.User units should be managed without sudo; sudo can target the root user session (or fail if none).
Apply this diff:
- sudo systemctl --user enable docker || true - sudo systemctl --user restart docker || true + systemctl --user enable docker || true + systemctl --user restart docker || trueethpillar.sh (2)
83-84: Non‑sudo docker compose in plugin ops: good alignment with rootless.If system (rootful) Docker is used, ensure the invoking user is in the docker group; otherwise these commands will fail. See suggested group addition in helpers/install_docker.sh.
1640-1641: initializeNetwork before menu: LGTM.This keeps NETWORK/API_BN_ENDPOINT/EL_RPC_ENDPOINT consistent for the UI.
|
@coderabbitai generate docstrings |
✅ Actions performedDocstrings generation started. |
Docstrings generation was requested by @coincashew. * #139 (comment) The following files were modified: * `ethpillar.sh` * `plugins/aztec/menu.sh` * `plugins/aztec/plugin_aztec.sh`
|
Note Generated docstrings for this pull request at #140 |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
plugins/aztec/plugin_aztec.sh (3)
204-212: Secret leakage: .env with private key is likely world‑readableAfter sed injects the private key/address, .env inherits default perms (often 0644). This exposes secrets to other users.
Apply this diff to restrict permissions immediately after writes:
[[ -n $PRIVATE_KEY ]] && sudo sed -i "s/^VALIDATOR_PRIVATE_KEYS.*$/VALIDATOR_PRIVATE_KEYS=${PRIVATE_KEY}/" $PLUGIN_INSTALL_PATH/.env || error "Unable to set VALIDATOR_PRIVATE_KEYS" [[ -n $ADDRESS ]] && sudo sed -i "s/^VALIDATOR_ADDRESS.*$/VALIDATOR_ADDRESS=${ADDRESS}/" $PLUGIN_INSTALL_PATH/.env || error "Unable to set VALIDATOR_ADDRESS" # COINBASE is block reward recipient. On mainnet, use a unique hardware wallet secured ETH address. [[ -n $ADDRESS ]] && sudo sed -i "s/^COINBASE.*$/COINBASE=${ADDRESS}/" $PLUGIN_INSTALL_PATH/.env || error "Unable to set COINBASE" +sudo chmod 600 "$PLUGIN_INSTALL_PATH/.env" || error "Unable to chmod .env to 600"
262-268: Inconsistent with rootless: avoid sudo docker hereElsewhere you moved to non‑sudo docker. Using sudo targets the system daemon and can fail under rootless.
Apply this diff:
- sudo docker rm -f $APP_NAME 2>/dev/null || true + docker rm -f $APP_NAME 2>/dev/null || true @@ - sudo docker rmi -f $DOCKER_IMAGE:"$TAG" + docker rmi -f $DOCKER_IMAGE:"$TAG" || true
353-359: UsePRIVATE_KEYenvironment variable instead of passing the key on the CLI
Aztec CLI supports settingPRIVATE_KEYfor the--private-keyflag to avoid leaking secrets (npm.io). Remove the--private-keyargument and export or inline the env var:# Export the private key in your environment export PRIVATE_KEY="$VALIDATOR_PRIVATE_KEYS" aztec add-l1-validator \ --staking-asset-handler 0xF739D03e98e23A7B65940848aBA8921fF3bAc4b2 \ --l1-rpc-urls "$ETHEREUM_HOSTS" \ --l1-chain-id 11155111 \ --attester "$VALIDATOR_ADDRESS" \ --proposer-eoa "$VALIDATOR_ADDRESS"
🧹 Nitpick comments (5)
plugins/aztec/docker-compose.yml.example (1)
16-17: Drop unnecessary NET_BIND_SERVICE capabilityYou’re only using high ports (>1024). NET_BIND_SERVICE isn’t needed and can be removed to keep the container least‑privileged.
Apply this diff:
- cap_add: # Add only required capabilities - - NET_BIND_SERVICE # Needed for binding to ports + # No capabilities needed for ports >1024 + # cap_add: []plugins/aztec/menu.sh (2)
166-171: More robust rootless detectiondocker info output varies; match formatted info to reduce false negatives.
Apply this diff:
- if docker info 2>&1 | grep -q "rootless"; then + if docker info --format '{{json .SecurityOptions}}' 2>/dev/null | grep -qi rootless; then echo -e "${g} ✅ ROOTLESS Docker mode is active${nc}" else echo -e "${r} ⚠️ Container is running as root. Re-install Docker with non-root user.${nc}" fi
435-436: Avoid double pull + ensure atomic updateUse up with --pull=always and recreate to minimize race conditions and avoid pulling twice.
Apply this diff:
- if docker compose pull; then echo "$TAG" | sudo tee $PLUGIN_INSTALL_PATH/current_version; fi - startCommand + if docker compose up -d --pull=always --no-deps aztec-node; then + echo "$TAG" | sudo tee $PLUGIN_INSTALL_PATH/current_version + fiplugins/aztec/plugin_aztec.sh (2)
62-67: Adding user to docker group is unnecessary in rootless modeNot harmful, but it’s redundant and can confuse users about which daemon they’re talking to.
Apply this diff:
function install_docker() { bash -c "$SOURCE_DIR/../../helpers/install_docker.sh" - info "Adding current user to docker group..." - sudo usermod -aG docker "$USER" + # Rootless path does not require docker group membership }
288-293: Nit: stray parenthesis in usage textMinor typo.
Apply this diff:
-About $APP_NAME) +About $APP_NAME
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ethpillar.sh(7 hunks)helpers/install_docker.sh(1 hunks)plugins/aztec/docker-compose.yml.example(2 hunks)plugins/aztec/menu.sh(6 hunks)plugins/aztec/plugin_aztec.sh(6 hunks)view_logs.sh(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- view_logs.sh
- ethpillar.sh
🧰 Additional context used
🧬 Code graph analysis (2)
plugins/aztec/menu.sh (1)
plugins/aztec/plugin_aztec.sh (1)
error(33-36)
plugins/aztec/plugin_aztec.sh (1)
plugins/aztec/menu.sh (1)
info(15-17)
🔇 Additional comments (3)
plugins/aztec/menu.sh (1)
214-219: LGTM: corrected expected-port arithmeticThe include_tcp flag derived from tcp_json fixes the earlier miscount. Good.
helpers/install_docker.sh (1)
39-40: Don’t use sudo with systemctl --user; it targets root’s user managerThis manages the wrong user session and often fails silently. Use the caller’s user manager.
Apply this diff:
- sudo systemctl --user enable docker || true - sudo systemctl --user restart docker || true + systemctl --user enable docker || true + systemctl --user restart docker || trueplugins/aztec/docker-compose.yml.example (1)
7-9: Confirm resource limits are enforced under rootlessAutomated check failed (runner missing docker/systemctl). Run on the host and paste outputs.
File: plugins/aztec/docker-compose.yml.example Lines: 7-9
cpus: "4.0" # Limit to 4 CPU cores mem_limit: 16g # Limit to 16GB RAM mem_reservation: 8g # Reserve 8GB RAMRun on host:
docker info | sed -nE 's/.*Cgroup Version: (.*)/Cgroup:\1/p; s/.*rootless.*/&/p' systemctl --user show --property=Delegate | sed 's/^/User slice /'Expect to see "Cgroup: v2" and systemd --user Delegate=yes; without cgroup v2 + delegation, rootless Docker may ignore these CPU/memory limits.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
plugins/aztec/plugin_aztec.sh (2)
232-235: Open the configured P2P_PORT in UFW, not a hardcoded 40400Respect user overrides in .env.
-info "🔧 Configuring UFW firewall" -sudo ufw allow 40400 comment 'Allow aztec node p2p port' || error "Unable to configure ufw" +info "🔧 Configuring UFW firewall" +P2P_PORT_CFG=$(grep -m1 -E '^\s*P2P_PORT\s*=' "$PLUGIN_INSTALL_PATH"/.env | sed -E 's/^\s*P2P_PORT\s*=\s*([0-9]+).*/\1/') +P2P_PORT_CFG=${P2P_PORT_CFG:-40400} +sudo ufw allow "${P2P_PORT_CFG}" comment 'Allow aztec node p2p port' || error "Unable to configure ufw"
262-267: Uninstall may fail in rootless setups due to sudo docker usageAlign with rootless by dropping sudo.
- cd $PLUGIN_INSTALL_PATH 2>/dev/null && docker compose down || true - sudo docker rm -f $APP_NAME 2>/dev/null || true + cd $PLUGIN_INSTALL_PATH 2>/dev/null && docker compose down || true + docker rm -f $APP_NAME 2>/dev/null || true @@ - sudo docker rmi -f $DOCKER_IMAGE:"$TAG" + docker rmi -f $DOCKER_IMAGE:"$TAG"plugins/aztec/menu.sh (1)
19-21: error() must exit to preserve control‑flow guaranteesMany callers use
|| errorexpecting termination. Add exit 1.-function error { - echo -e "${r}${bold}ERROR: $1${nc}" -} +function error { + echo -e "${r}${bold}ERROR: $1${nc}" + exit 1 +}
🧹 Nitpick comments (4)
ethpillar.sh (2)
49-63: Harden .env parsing and quote expansions in initializeNetworkCurrent grep/sed will break on spaces, quotes, or inline comments. Use anchored keys, trim whitespace/quotes, and quote vars on export.
Apply:
- if [[ -f /opt/ethpillar/aztec/.env ]]; then - consensus_beacon_rpc=$(grep ^L1_CONSENSUS_HOST_URLS /opt/ethpillar/aztec/.env | sed 's/L1_CONSENSUS_HOST_URLS=//g') - execution_l1_rpc=$(grep ^ETHEREUM_HOSTS /opt/ethpillar/aztec/.env | sed 's/ETHEREUM_HOSTS=//g') - fi + if [[ -f /opt/ethpillar/aztec/.env ]]; then + consensus_beacon_rpc=$(grep -m1 -E '^\s*L1_CONSENSUS_HOST_URLS\s*=' /opt/ethpillar/aztec/.env | sed -E 's/^\s*L1_CONSENSUS_HOST_URLS\s*=\s*"?([^"#]+).*/\1/' | tr -d " ") + execution_l1_rpc=$(grep -m1 -E '^\s*ETHEREUM_HOSTS\s*=' /opt/ethpillar/aztec/.env | sed -E 's/^\s*ETHEREUM_HOSTS\s*=\s*"?([^"#]+).*/\1/' | tr -d " ") + fi @@ - consensus_beacon_rpc=${consensus_beacon_rpc%%,*} - execution_l1_rpc=${execution_l1_rpc%%,*} + consensus_beacon_rpc="${consensus_beacon_rpc%%,*}" + execution_l1_rpc="${execution_l1_rpc%%,*}" @@ - if [[ -n "$consensus_beacon_rpc" && -n "$execution_l1_rpc" ]]; then - export API_BN_ENDPOINT="$consensus_beacon_rpc" - export EL_RPC_ENDPOINT="$execution_l1_rpc" + if [[ -n "$consensus_beacon_rpc" && -n "$execution_l1_rpc" ]]; then + export API_BN_ENDPOINT="$consensus_beacon_rpc" + export EL_RPC_ENDPOINT="$execution_l1_rpc" fi
87-87: Avoid changing the parent shell’s CWD in testAndPluginCommandcd persists and may break subsequent relative paths. Use a subshell.
- test -d /opt/ethpillar/"${_DIRNAME[i]}" && cd "/opt/ethpillar/${_DIRNAME[i]}" && docker compose "$1" + test -d /opt/ethpillar/"${_DIRNAME[i]}" && ( cd "/opt/ethpillar/${_DIRNAME[i]}" && docker compose "$1" )plugins/aztec/docker-compose.yml.example (1)
6-17: Resource limits and hardening look good; cap_add likely unnecessaryNET_BIND_SERVICE isn’t needed for ports >1024 (8080/40400). Consider dropping to minimize surface.
- cap_add: # Add only required capabilities - - NET_BIND_SERVICE # Needed for binding to ports + # cap_add not required for ports >1024; keep minimal privileges + # cap_add: + # - NET_BIND_SERVICEplugins/aztec/menu.sh (1)
41-44: Make startCommand independent of CWDPass compose file explicitly to avoid relying on prior cd.
- docker compose --env-file "$PLUGIN_INSTALL_PATH"/.env up -d || error "Error starting command" + docker compose -f "$PLUGIN_INSTALL_PATH"/docker-compose.yml --env-file "$PLUGIN_INSTALL_PATH"/.env up -d || error "Error starting command"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ethpillar.sh(5 hunks)helpers/install_docker.sh(1 hunks)plugins/aztec/docker-compose.yml.example(2 hunks)plugins/aztec/menu.sh(6 hunks)plugins/aztec/plugin_aztec.sh(4 hunks)view_logs.sh(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- helpers/install_docker.sh
- view_logs.sh
🧰 Additional context used
🧬 Code graph analysis (3)
ethpillar.sh (1)
functions.sh (2)
getNetworkConfig(21-26)getNetwork(192-218)
plugins/aztec/plugin_aztec.sh (1)
plugins/aztec/menu.sh (1)
info(15-17)
plugins/aztec/menu.sh (1)
plugins/aztec/plugin_aztec.sh (2)
error(33-36)info(29-31)
🔇 Additional comments (12)
ethpillar.sh (2)
1644-1644: initializeNetwork placement is goodNetwork/env priming before menuMain looks correct.
1579-1582: Do not terminate the entire TUI after Aztec install; return instead of exit- runScript plugins/aztec/plugin_aztec.sh -i - exit 0 + runScript plugins/aztec/plugin_aztec.sh -i + return 0plugins/aztec/docker-compose.yml.example (2)
32-42: Port mapping syntax OK; confirm host_ip support on target Compose versionhost_ip in long syntax requires a sufficiently recent docker compose. If compatibility is a concern, use short syntax "127.0.0.1:${PORT}:${PORT}".
45-50: Logging options LGTMReasonable rotation and compression settings.
plugins/aztec/plugin_aztec.sh (5)
63-66: Rootless‑friendly Docker installRemoving sudo for installer invocation is consistent with rootless flow; usermod is correctly sudo’d.
140-161: Input validation loops for remote RPCs are solidGood UX; trims whitespace and enforces http(s) scheme.
212-215: Remote RPC write‑back LGTM.env updates for ETHEREUM_HOSTS and L1_CONSENSUS_HOST_URLS are correct.
236-240: Ownership handoff to current user is a good additionPrevents permission issues with rootless Docker.
294-303: Docker readiness + relog prompt LGTMNice UX for rootless enablement.
plugins/aztec/menu.sh (3)
158-169: Rootless Docker check is helpfulClear guidance for users; good addition.
209-215: Expected-port calculation fix looks correctNumeric include flag derived from tcp_json resolves prior bug.
422-426: Non‑sudo compose stop/restart LGTMConsistent with rootless flow.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/aztec/menu.sh (1)
19-21: error() must terminateMany call sites use
|| error "...". Withoutexit 1, failures won’t abort and flow continues in a bad state.Apply this diff:
function error { echo -e "${r}${bold}ERROR: $1${nc}" + exit 1 }
🧹 Nitpick comments (5)
ethpillar.sh (2)
37-69: Centralizing endpoint init is good; sanitize .env-derived URLsinitializeNetwork is a nice consolidation. Minor: when grepping Aztec .env, values may be quoted; strip any surrounding quotes to avoid literal quotes in endpoints.
Apply this diff:
- consensus_beacon_rpc=$(grep ^L1_CONSENSUS_HOST_URLS /opt/ethpillar/aztec/.env | sed 's/L1_CONSENSUS_HOST_URLS=//g') - execution_l1_rpc=$(grep ^ETHEREUM_HOSTS /opt/ethpillar/aztec/.env | sed 's/ETHEREUM_HOSTS=//g') + consensus_beacon_rpc=$(grep ^L1_CONSENSUS_HOST_URLS /opt/ethpillar/aztec/.env | sed 's/^L1_CONSENSUS_HOST_URLS=//; s/^"//; s/"$//') + execution_l1_rpc=$(grep ^ETHEREUM_HOSTS /opt/ethpillar/aztec/.env | sed 's/^ETHEREUM_HOSTS=//; s/^"//; s/"$//')
87-88: Avoid changing the caller’s CWD; run docker compose in a subshellcd inside this helper mutates global CWD and can break later file-relative paths.
Apply this diff:
- test -d /opt/ethpillar/"${_DIRNAME[i]}" && cd "/opt/ethpillar/${_DIRNAME[i]}" && docker compose "$1" + test -d /opt/ethpillar/"${_DIRNAME[i]}" && ( cd "/opt/ethpillar/${_DIRNAME[i]}" && docker compose "$1" )plugins/aztec/plugin_aztec.sh (1)
140-161: Validate each comma-separated RPC URLCurrent check only validates the first URL. Split on commas and ensure every entry starts with http(s)://; give actionable error.
Apply this diff:
- while true; do + while true; do ETH_RPC=$(whiptail --title "Ethereum RPC URL(s) (ETHEREUM_HOSTS)" --inputbox "🔗 Enter one or more URLs, comma-separated (e.g. https://sepolia.rpc.url,http://192.168.1.123:8545):" 9 78 --ok-button "Submit" 3>&1 1>&2 2>&3) if [ -z "$ETH_RPC" ]; then exit; fi #pressed cancel # sanitize: strip spaces ETH_RPC=$(echo "$ETH_RPC" | tr -d '[:space:]') - if [[ "$ETH_RPC" =~ ^https?:// ]]; then + invalid=0 + IFS=',' read -r -a arr <<< "$ETH_RPC" + for u in "${arr[@]}"; do + [[ "$u" =~ ^https?:// ]] || invalid=1 + done + if [[ $invalid -eq 0 ]]; then break else whiptail --title "Error" --msgbox "ETHEREUM_HOSTS must be one or more http(s):// URLs, comma-separated" 8 78 fi done - while true; do + while true; do BEACON_RPC=$(whiptail --title "Beacon RPC URL(s) (L1_CONSENSUS_HOST_URLS)" --inputbox "🔗 Enter one or more URLs, comma-separated (e.g. https://beacon.rpc.url,http://192.168.1.123:5052):" 9 78 --ok-button "Submit" 3>&1 1>&2 2>&3) if [ -z "$BEACON_RPC" ]; then exit; fi #pressed cancel # sanitize: strip spaces BEACON_RPC=$(echo "$BEACON_RPC" | tr -d '[:space:]') - if [[ "$BEACON_RPC" =~ ^https?:// ]]; then + invalid=0 + IFS=',' read -r -a arr <<< "$BEACON_RPC" + for u in "${arr[@]}"; do + [[ "$u" =~ ^https?:// ]] || invalid=1 + done + if [[ $invalid -eq 0 ]]; then break else - whiptail --title "Error" --msgbox "L1_CONSENSUS_HOST_URLS must start with http(s)://" 8 78 + whiptail --title "Error" --msgbox "L1_CONSENSUS_HOST_URLS must be one or more http(s):// URLs, comma-separated" 8 78 fi doneplugins/aztec/menu.sh (2)
143-152: Peer ID/peer count scraping is OK; consider a slightly longer windowUsing
-n 100may miss recent lines on quiet nodes. Optional: increase to 300 for resiliency.Apply this diff:
- peercount=$(docker logs aztec-sequencer -n 100 2>&1 | grep 'peer_manager' | tail -n1 | sed "s/.*Connected to \([0-9]*\).*/\1/") + peercount=$(docker logs aztec-sequencer -n 300 2>&1 | grep 'peer_manager' | tail -n1 | sed "s/.*Connected to \([0-9]*\).*/\1/")
177-191: Minor nit: stray tcp_check_ok toggled in UDP looptcp_check_ok is set true on UDP success and not used later; drop it or rename to udp_check_ok to avoid confusion.
Apply this diff:
- tcp_check_ok=false + # tcp_json presence decides TCP; no separate flag needed tcp_json=$(curl -s --connect-timeout 3 --max-time 5 --fail "${checker_url}${tcp_ports}") || true @@ - if nc -z -u localhost "$port" &>/dev/null; then + if nc -z -u localhost "$port" &>/dev/null; then ((udp_open_ports++)) open_udp_ports+=("$port") - tcp_check_ok=true fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
ethpillar.sh(5 hunks)helpers/install_docker.sh(1 hunks)plugins/aztec/docker-compose.yml.example(2 hunks)plugins/aztec/menu.sh(6 hunks)plugins/aztec/plugin_aztec.sh(4 hunks)view_logs.sh(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- plugins/aztec/docker-compose.yml.example
- view_logs.sh
🧰 Additional context used
🧬 Code graph analysis (3)
ethpillar.sh (1)
functions.sh (2)
getNetworkConfig(21-26)getNetwork(192-218)
plugins/aztec/plugin_aztec.sh (1)
plugins/aztec/menu.sh (1)
info(15-17)
plugins/aztec/menu.sh (1)
plugins/aztec/plugin_aztec.sh (1)
error(33-36)
🔇 Additional comments (9)
ethpillar.sh (3)
231-232: Don’t change CWD when tailing Aztec logsRun the log tail in a subshell to avoid CWD side effects.
Apply this diff:
- cd /opt/ethpillar/aztec && docker compose logs -f --tail=233 + ( cd /opt/ethpillar/aztec && docker compose logs -f --tail=233 )
1644-1645: LGTM: initializeNetwork() invoked at startupGood placement after setNodeMode; prepares endpoints before menus.
1581-1581: Avoid exiting the entire TUI after Aztec installexit 0 tears down EthPillar and skips patches/checks/menus. Return to caller instead.
Apply this diff:
- exit 0 + return 0plugins/aztec/plugin_aztec.sh (2)
62-66: LGTM: delegating to helpers/install_docker.shCalling the central installer keeps Docker logic in one place.
236-238: Good: fix ownership at end of installChowning the install path avoids permission friction for subsequent non-root operations.
plugins/aztec/menu.sh (3)
160-168: LGTM: compose ps uses project file and aligns with rootless flowNon-sudo compose matches the broader rootless migration.
209-216: LGTM: corrected expected-ports arithmeticThe include_tcp flag based on tcp_json fixes prior miscounts.
410-433: Logs, stop/restart, pull: non-sudo compose is correctThese changes align with rootless Docker. Pull writeback to current_version is fine.
helpers/install_docker.sh (1)
39-40: Do not use sudo with systemctl --usersystemctl --user must run as the target user, not via sudo. Using sudo targets root’s user session and often fails, especially without a login session/DBus.
Apply this diff:
- sudo systemctl --user enable docker || true - sudo systemctl --user restart docker || true + systemctl --user enable docker || true + systemctl --user restart docker || true
Summary by CodeRabbit
New Features
Bug Fixes