Skip to content

Commit

Permalink
Tidy-ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Aug 24, 2024
1 parent d9f7691 commit 50179b8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -162,6 +166,7 @@ linters:
- execinquery
- exhaustive
- exhaustruct
- exportloopref
- forcetypeassert
- funlen
- gci
Expand Down
2 changes: 1 addition & 1 deletion api/v1/forkchoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion http/events_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions http/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/builderversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down
2 changes: 1 addition & 1 deletion spec/dataversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand Down

0 comments on commit 50179b8

Please sign in to comment.