diff --git a/cli/main.go b/cli/main.go index 1c0c2180..7de6f5ac 100644 --- a/cli/main.go +++ b/cli/main.go @@ -27,7 +27,7 @@ var ( defaultListenAddr = getEnv("BOOST_LISTEN_ADDR", "localhost:18550") defaultRelayCheck = os.Getenv("RELAY_STARTUP_CHECK") != "" defaultGenesisForkVersion = getEnv("GENESIS_FORK_VERSION", "") - defaultRelayMinBidEth = getEnvFloat64("RELAY_MIN_BID", 0.001) + defaultRelayMinBidEth = getEnvFloat64("MIN_BID_ETH", 0.001) defaultDisableLogVersion = os.Getenv("DISABLE_LOG_VERSION") == "1" // disables adding the version to every log entry // mev-boost relay request timeouts (see also https://github.com/flashbots/mev-boost/issues/287) diff --git a/cli/main_test.go b/cli/main_test.go new file mode 100644 index 00000000..bdc242d8 --- /dev/null +++ b/cli/main_test.go @@ -0,0 +1,16 @@ +package cli + +import ( + "testing" + + "github.com/flashbots/go-boost-utils/types" + "github.com/stretchr/testify/require" +) + +func TestFloatEthTo256Wei(t *testing.T) { + // test with valid input + i := 0.000000000000012345 + u256, err := floatEthTo256Wei(i) + require.Equal(t, types.IntToU256(12345), *u256) + require.NoError(t, err) +} diff --git a/server/service.go b/server/service.go index df1e3383..8dd30613 100644 --- a/server/service.go +++ b/server/service.go @@ -361,7 +361,13 @@ func (m *BoostService) handleGetHeader(w http.ResponseWriter, req *http.Request) return } + if responsePayload.Data.Message.Value.Cmp(&m.relayMinBid) == -1 { + log.Debug("ignoring bid below min-bid value") + return + } + log.Debug("bid received") + // Skip if value (fee) is lower than the minimum bid mu.Lock() defer mu.Unlock() @@ -369,11 +375,6 @@ func (m *BoostService) handleGetHeader(w http.ResponseWriter, req *http.Request) // Remember which relays delivered which bids (multiple relays might deliver the top bid) relays[BlockHashHex(blockHash)] = append(relays[BlockHashHex(blockHash)], relay) - // Skip if value (fee) is lower than the minimum bid - if responsePayload.Data.Message.Value.Cmp(&m.relayMinBid) == -1 { - return - } - // Compare the bid with already known top bid (if any) if result.response.Data != nil { valueDiff := responsePayload.Data.Message.Value.Cmp(&result.response.Data.Message.Value)