Skip to content

Commit

Permalink
fix: zero fee addresses flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 26, 2024
1 parent dd8d982 commit c790bb7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ var (
configFileFlag,
utils.LogDebugFlag,
utils.LogBacktraceAtFlag,
utils.ZeroFeeAddressesFlag,
}, utils.NetworkFlags, utils.DatabaseFlags)

rpcFlags = []cli.Flag{
Expand Down
13 changes: 7 additions & 6 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,9 @@ var (
Category: flags.VMCategory,
}

ZeroFeeAddressesFlag = &cli.StringFlag{
Name: "zeroofeeaddresses",
ZeroFeeAddressesFlag = &cli.StringSliceFlag{
Name: "zero-fee-addresses",
Usage: "Comma separated list of addresses that are allowed to send transactions with zero fees",
Value: "",
Category: flags.VMCategory,
}
// API options.
Expand Down Expand Up @@ -2128,9 +2127,11 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh

vmcfg := vm.Config{EnablePreimageRecording: ctx.Bool(VMEnableDebugFlag.Name)}
if ctx.IsSet(ZeroFeeAddressesFlag.Name) {
addressStrings := strings.Split(ctx.String(ZeroFeeAddressesFlag.Name), ",")
for _, addr := range addressStrings {
vmcfg.ZeroFeeAddresses = append(vmcfg.ZeroFeeAddresses, common.HexToAddress(strings.TrimSpace(addr)))
for _, addr := range ctx.StringSlice(ZeroFeeAddressesFlag.Name) {
vmcfg.ZeroFeeAddresses = append(
vmcfg.ZeroFeeAddresses,
common.HexToAddress(strings.TrimSpace(addr)),
)
}
}
// Disable transaction indexing/unindexing by default.
Expand Down
10 changes: 10 additions & 0 deletions geth-poa/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GETH_DATA_DIR=${GETH_DATA_DIR:-/data}
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata"
GETH_KEYSTORE_DIR="$GETH_DATA_DIR/keystore"
GETH_KEYSTORE_PASSWORD=${GETH_KEYSTORE_PASSWORD:-"primev"}
GETH_ZERO_FEE_ADDRESSES=${GETH_ZERO_FEE_ADDRESSES:-}
CHAIN_ID=$(cat "$GENESIS_L1_PATH" | jq -r .config.chainId)
RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
Expand All @@ -23,6 +24,12 @@ else
LOG_TAGS_OPTION=""
fi

if [ -n "$GETH_ZERO_FEE_ADDRESSES" ]; then
ZERO_FEE_ADDRESSES="--zero-fee-addresses=$GETH_ZERO_FEE_ADDRESSES"
else
ZERO_FEE_ADDRESSES=""
fi

# Generate signer key if needed
if [ "$GETH_NODE_TYPE" = "signer" ]; then
if [ ! -f "$GETH_DATA_DIR/password" ]; then
Expand Down Expand Up @@ -94,6 +101,7 @@ if [ "$GETH_NODE_TYPE" = "bootnode" ]; then
--verbosity="$GETH_VERBOSITY" \
--log.format="$GETH_LOG_FORMAT" \
$LOG_TAGS_OPTION \
$ZERO_FEE_ADDRESSES \
--datadir="$GETH_DATA_DIR" \
--port 30301 \
--http \
Expand Down Expand Up @@ -138,6 +146,7 @@ elif [ "$GETH_NODE_TYPE" = "signer" ]; then
--verbosity="$GETH_VERBOSITY" \
--log.format="$GETH_LOG_FORMAT" \
$LOG_TAGS_OPTION \
$ZERO_FEE_ADDRESSES \
--datadir="$GETH_DATA_DIR" \
--port="$GETH_PORT" \
--syncmode="${GETH_SYNC_MODE}" \
Expand Down Expand Up @@ -190,6 +199,7 @@ elif [ "$GETH_NODE_TYPE" = "member" ]; then
--verbosity="$GETH_VERBOSITY" \
--log.format="$GETH_LOG_FORMAT" \
$LOG_TAGS_OPTION \
$ZERO_FEE_ADDRESSES \
--datadir="$GETH_DATA_DIR" \
--port="$GETH_PORT" \
--syncmode="${GETH_SYNC_MODE}" \
Expand Down

0 comments on commit c790bb7

Please sign in to comment.