diff --git a/.golangci.yml b/.golangci.yml index 9356cb7d..b94397e5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -106,6 +106,10 @@ output: # All available settings of specific linters. linters-settings: + gosec: + excludes: + - G115 # This generates a lot of false positives. + lll: line-length: 132 @@ -162,6 +166,7 @@ linters: - execinquery - exhaustive - exhaustruct + - exportloopref - forcetypeassert - funlen - gci diff --git a/api/v1/forkchoice.go b/api/v1/forkchoice.go index d890b4a9..0de7e006 100644 --- a/api/v1/forkchoice.go +++ b/api/v1/forkchoice.go @@ -147,7 +147,7 @@ func (d *ForkChoiceNodeValidity) UnmarshalJSON(input []byte) error { // String returns a string representation of the ForkChoiceNodeValidity. func (d ForkChoiceNodeValidity) String() string { - if int(d) >= len(ForkChoiceNodeValidityStrings) { + if uint64(d) >= uint64(len(ForkChoiceNodeValidityStrings)) { return "unknown" } diff --git a/http/events_internal_test.go b/http/events_internal_test.go index 683460ba..f00e7c95 100644 --- a/http/events_internal_test.go +++ b/http/events_internal_test.go @@ -147,7 +147,7 @@ func TestEventHandler(t *testing.T) { name: "BLSToExecutionChangeGood", message: &sse.Event{ Event: []byte("bls_to_execution_change"), - Data: []byte(`{"validator_index":"63401","from_bls_pubkey":"0xa46ed2574770ec1942d577ef89e0bf7b0d601349dab791740dead3fb5a6e2624cf62b9e58de1074c49f44b986eb39002","to_execution_address":"0xd641D2Cc74C7b6A641861260d07D67eB67bc7403"}`), + Data: []byte(`{"message":{"validator_index":"63401","from_bls_pubkey":"0xa46ed2574770ec1942d577ef89e0bf7b0d601349dab791740dead3fb5a6e2624cf62b9e58de1074c49f44b986eb39002","to_execution_address":"0xd641D2Cc74C7b6A641861260d07D67eB67bc7403"},"signature":"0xb9ce6f10137a8bc73cd5545e5d6c7c61bc1294b853e71e5eb090a7a773d7773c4d7732f4244e9891cd5c1f7a5fbc951c0b368a8bd7dc44b1598a6d1bdb4476f9f364ef521c366e55565792810f0cb8bf8cc20134f32ed8dde54507f622402d6e"}`), }, handler: handler, handled: true, diff --git a/http/spec.go b/http/spec.go index e3162068..a2a2f5cd 100644 --- a/http/spec.go +++ b/http/spec.go @@ -121,8 +121,8 @@ func (s *Service) Spec(ctx context.Context, // Handle durations. if strings.HasPrefix(k, "SECONDS_PER_") || k == "GENESIS_DELAY" { - intVal, err := strconv.ParseUint(v, 10, 64) - if err == nil && intVal != 0 { + intVal, err := strconv.ParseInt(v, 10, 64) + if err == nil && intVal >= 0 { config[k] = time.Duration(intVal) * time.Second continue diff --git a/spec/builderversion.go b/spec/builderversion.go index c6871432..17a6cc41 100644 --- a/spec/builderversion.go +++ b/spec/builderversion.go @@ -50,7 +50,7 @@ func (d *BuilderVersion) UnmarshalJSON(input []byte) error { // String returns a string representation of the struct. func (d BuilderVersion) String() string { - if int(d) >= len(responseBuilderVersionStrings) { + if uint64(d) >= uint64(len(responseBuilderVersionStrings)) { return "unknown" } diff --git a/spec/dataversion.go b/spec/dataversion.go index ef09d06e..45dbcb82 100644 --- a/spec/dataversion.go +++ b/spec/dataversion.go @@ -73,7 +73,7 @@ func (d *DataVersion) UnmarshalJSON(input []byte) error { // String returns a string representation of the struct. func (d DataVersion) String() string { - if int(d) >= len(dataVersionStrings) { + if uint64(d) >= uint64(len(dataVersionStrings)) { return "unknown" }