Skip to content

Commit

Permalink
Update start-mev-boost.sh
Browse files Browse the repository at this point in the history
Addressing rocket-pool/smartnode#601

Adding support for arbitrary additional flags to be passed to the MevBoost script via MevBoostConfig.
  • Loading branch information
SolezOfScience committed Aug 1, 2024
1 parent 20b9be6 commit 09706f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
26 changes: 24 additions & 2 deletions install/scripts/start-mev-boost.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
#!/bin/sh

parse_additional_flags() {
# Initialize an empty string for additional arguments
ADDITIONAL_ARGS=""

# Check if the environment variable MEV_BOOST_ADDITIONAL_FLAGS is not empty
if [ -n "$MEV_BOOST_ADDITIONAL_FLAGS" ]; then
# Split the input string into an array of key-value pairs using comma as the delimiter
IFS=',' read -r -a pairs <<< "$MEV_BOOST_ADDITIONAL_FLAGS"

# Iterate over each key-value pair
for pair in "${pairs[@]}"; do
# Extract the key and value from the current pair
key=$(echo "$pair" | cut -d'=' -f1)
value=$(echo "$pair" | cut -d'=' -f2)

# Append the key-value pair to the ADDITIONAL_ARGS string
ADDITIONAL_ARGS="$ADDITIONAL_ARGS -${key} ${value}"
done
fi
}

# Set up the network-based flag
if [ "$NETWORK" = "mainnet" ]; then
MEV_NETWORK="mainnet"
Expand All @@ -10,5 +31,6 @@ else
exit 1
fi

# Run MEV-boost
exec /app/mev-boost -${MEV_NETWORK} -addr 0.0.0.0:${MEV_BOOST_PORT} -relay-check -relays ${MEV_BOOST_RELAYS}
parse_additional_flags

exec /app/mev-boost -${MEV_NETWORK} -addr 0.0.0.0:${MEV_BOOST_PORT} -relay-check -relays ${MEV_BOOST_RELAYS} ${ADDITIONAL_ARGS}
1 change: 1 addition & 0 deletions install/templates/mev-boost.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- NETWORK={{.Smartnode.Network}}
- MEV_BOOST_PORT={{.MevBoost.Port}}
- MEV_BOOST_RELAYS={{.MevBoost.GetRelayString}}
- MEV_BOOST_ADDITIONAL_FLAGS={{.MevBoost.AdditionalFlags}}
entrypoint: sh
command: "/setup/start-mev-boost.sh"
cap_drop:
Expand Down

0 comments on commit 09706f9

Please sign in to comment.