diff --git a/integration/simulation/validate_chain.go b/integration/simulation/validate_chain.go index 85862df836..59335aa420 100644 --- a/integration/simulation/validate_chain.go +++ b/integration/simulation/validate_chain.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "math/big" + "slices" "sort" "strings" "sync" @@ -771,10 +772,8 @@ func assertRelevantLogsOnly(t *testing.T, owner string, receivedLog types.Log) { return } - for _, addr := range userAddrs { - if addr == owner { - return - } + if slices.Contains(userAddrs, owner) { + return } // If we've fallen through to here, it means the log was not relevant. diff --git a/lib/gethfork/node/node.go b/lib/gethfork/node/node.go index 7d06261fc5..7ccf42d575 100644 --- a/lib/gethfork/node/node.go +++ b/lib/gethfork/node/node.go @@ -25,6 +25,7 @@ import ( "os" "path/filepath" "reflect" + "slices" "strings" "sync" @@ -229,12 +230,7 @@ func (n *Node) openEndpoints() error { // containsLifecycle checks if 'lfs' contains 'l'. func containsLifecycle(lfs []Lifecycle, l Lifecycle) bool { - for _, obj := range lfs { - if obj == l { - return true - } - } - return false + return slices.Contains(lfs, l) } // stopServices terminates running services, RPC and p2p networking. diff --git a/lib/gethfork/rpc/http.go b/lib/gethfork/rpc/http.go index 0bab94be5f..df9fc3bc2d 100644 --- a/lib/gethfork/rpc/http.go +++ b/lib/gethfork/rpc/http.go @@ -27,6 +27,7 @@ import ( "mime" "net/http" "net/url" + "slices" "strconv" "sync" "time" @@ -356,10 +357,8 @@ func (s *Server) validateRequest(r *http.Request) (int, error) { } // Check content-type if mt, _, err := mime.ParseMediaType(r.Header.Get("content-type")); err == nil { - for _, accepted := range acceptedContentTypes { - if accepted == mt { - return 0, nil - } + if slices.Contains(acceptedContentTypes, mt) { + return 0, nil } } // Invalid content-type