flashbots / flashbots/mev-boost
bug: JSON log format breaks on registerValidator due to *http.Request field containing func() type
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 292
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
### Description
When running mev-boost with JSON logging (`-json` flag), the following error is printed to stderr on every `registerValidator` call:
```
Failed to obtain reader, failed to marshal fields to JSON, json: unsupported type: func() (io.ReadCloser, error)
```
### Root Cause
In `server/register_validator.go:50-52`, the full `*http.Request` struct is passed as a logrus field:
```go
log.WithFields(logrus.Fields{
"request": req,
}).Debug("sending the registerValidator request")
```
`*http.Request` contains the field `GetBody func() (io.ReadCloser, error)`, which Go's `encoding/json` cannot marshal. When logrus's `JSONFormatter` calls `json.Marshal()` on the log fields, it fails with:
```
json: unsupported type: func() (io.ReadCloser, error)
```
Logrus (v1.9.3, used by mev-boost) catches this in `entry.write()` and prints the error to stderr. The log entry is then **silently dropped**.
This works fine with the text formatter (which uses `fmt.Sprintf("%v", req)`), but breaks with `-json`.
### Affected Versions
Confirmed in **v1.11** and **v1.12** (same code present in both).
Contributor guide
Assessment
This issue has not been assessed yet.