Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ permissions:
jobs:
golangci:
name: lint
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/setup-go@v5
with:
cache: false
go-version: '^1.22'
go-version: '^1.25'
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: 'latest'
args: '--timeout=60m'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
# Set variables that will be available to all builds.
env_vars:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
release_version: ${{ steps.release_version.outputs.release_version }}
binary: ${{ steps.binary.outputs.binary }}
Expand All @@ -25,7 +25,7 @@ jobs:

# Create a github release to hold the assets once built.
create_release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: env_vars
outputs:
upload_url: ${{ steps.release_action.outputs.upload_url }}
Expand All @@ -40,7 +40,7 @@ jobs:

# Build and pack the binaries for linux.
build_linux:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: [create_release, env_vars]
steps:
- name: Set up Go
Expand Down
194 changes: 98 additions & 96 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This file is not a configuration example,
# it contains the exhaustive configuration with explanations of the options.

issues:
# Which files to exclude: they will be analyzed, but issues from them won't be reported.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
# "/" will be replaced by current OS file path separator to properly work on Windows.
# Default: []
exclude-files:
- ".*_ssz\\.go$"
version: "2"

# Options for analysis running.
run:
Expand Down Expand Up @@ -69,96 +61,21 @@ run:
# Define the Go version limit.
# Mainly related to generics support since go1.18.
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
# go: '1.20'
# go: '1.19'


# output configuration options
# output:
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
#
# Multiple can be specified by separating them by comma, output can be provided
# for each of them by separating format name and path by colon symbol.
# Output path can be either `stdout`, `stderr` or path to the file to write to.
# Example: "checkstyle:report.json,colored-line-number"
#
# Default: colored-line-number
# format: json

# Print lines of code with issue.
# Default: true
# print-issued-lines: false

# Print linter name in the end of issue text.
# Default: true
# print-linter-name: false

# Make issues output unique by line.
# Default: true
# uniq-by-line: false

# Add a prefix to the output file references.
# Default is no prefix.
# path-prefix: ""

# Sort results by: filepath, line and column.
# sort-results: true


# All available settings of specific linters.
linters-settings:
gosec:
excludes:
# Flags for potentially-unsafe casting of ints, but generates a lot of false positives.
- 'G115'

lll:
line-length: 132

nlreturn:
block-size: 3

revive:
ignore-generated-header: false
severity: error
confidence: 0.8
enable-all-rules: true
rules:
- name: add-constant
disabled: true
- name: cyclomatic
disabled: true
- name: cognitive-complexity
disabled: true
- name: confusing-results
- name: function-length
disabled: true
- name: line-length-limit
arguments: [132]
- name: max-public-structs
disabled: true
- name: package-comments
disabled: true
- name: struct-tag
arguments: ["json,allowempty"]
- name: unhandled-error
arguments:
- "fmt.Fprint"
- "fmt.Fprintf"

stylecheck:
checks: [ "all", "-ST1000" ]

tagliatelle:
case:
# use-field-name: true
rules:
json: snake
yaml: snake
output:
formats:
text:
path: stderr
colors: true
print-issued-lines: true

linters:
# Enable all available linters.
# Default: false
enable-all: true
default: all
# Disable specific linter
# https://golangci-lint.run/usage/linters/#disabled-by-default
disable:
Expand All @@ -169,18 +86,103 @@ linters:
- exhaustive
- exhaustruct
- forcetypeassert
- funcorder
- funlen
- gci
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- godoclint
- iface
- ireturn
- lll
- maintidx
- modernize
- mnd
- musttag
- nestif
- nilnil
- nlreturn
- noinlineerr
- perfsprint
- promlinter
- varnamelen
- wrapcheck
- wsl
exclusions:
paths:
- ".*_ssz\\.go$"
settings:
godot:
scope: all
period: true
capital: false

gosec:
excludes:
- G115 # This generates a lot of false positives, recheck once https://github.com/securego/gosec/issues/1212 is closed

errcheck:
exclude-functions:
- fmt.Fprintf

lll:
line-length: 132

nlreturn:
# Allow two-line blocks without requiring a newline
block-size: 3

tagliatelle:
case:
# use-field-name: true
rules:
json: snake
yaml: snake

goheader:
values:
regexp:
YEARS: '(20\d\d - 20\d\d|20\d\d, 20\d\d|20\d\d)'
template: |-
Copyright © {{ YEARS }} Weald Technology Trading.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

revive:
rules:
- name: package-comments
severity: warning
disabled: true
exclude: [ "" ]

wsl_v5:
disable:
- assign
- branch
- decl
- defer
- expr
- for
- go
- if
- inc-dec
- label
- range
- return
- select
- send
- switch
- type-switch
- append
- assign-exclusive
- assign-expr
- err
- leading-whitespace
- trailing-whitespace
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/wealdtech/comptrollerd

go 1.23.0
go 1.25.0

toolchain go1.24.5
toolchain go1.25.3

require (
github.com/attestantio/go-eth2-client v0.27.1
Expand All @@ -16,7 +16,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.20.5
github.com/rs/zerolog v1.33.0
github.com/sasha-s/go-deadlock v0.3.5
github.com/sasha-s/go-deadlock v0.3.6
github.com/shopspring/decimal v1.4.0
github.com/spf13/pflag v1.0.6
github.com/spf13/viper v1.19.0
Expand Down Expand Up @@ -73,7 +73,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/petermattis/goid v0.0.0-20250121172306-05bcfb9a85dc // indirect
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe // indirect
github.com/pk910/dynamic-ssz v0.0.5 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xl
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/petermattis/goid v0.0.0-20250121172306-05bcfb9a85dc h1:Xz/LkK9AJRY5QTkA1uE1faB8yeqRFjeKgwDtI13ogcY=
github.com/petermattis/goid v0.0.0-20250121172306-05bcfb9a85dc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe h1:vHpqOnPlnkba8iSxU4j/CvDSS9J4+F4473esQsYLGoE=
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/pk910/dynamic-ssz v0.0.5 h1:VP9heGYUwzlpyhk28P2nCAzhvGsePJOOOO5vQMDh2qQ=
github.com/pk910/dynamic-ssz v0.0.5/go.mod h1:b6CrLaB2X7pYA+OSEEbkgXDEcRnjLOZIxZTsMuO/Y9c=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down Expand Up @@ -364,6 +366,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU=
github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U=
github.com/sasha-s/go-deadlock v0.3.6 h1:TR7sfOnZ7x00tWPfD397Peodt57KzMDo+9Ae9rMiUmw=
github.com/sasha-s/go-deadlock v0.3.6/go.mod h1:CUqNyyvMxTyjFqDT7MRg9mb4Dv/btmGTqSR+rky/UXo=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
Expand Down
3 changes: 1 addition & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import (
)

// ReleaseVersion is the release version for the code.
var ReleaseVersion = "0.4.5"
var ReleaseVersion = "0.5.0"

func main() {
os.Exit(main2())
Expand Down Expand Up @@ -405,7 +405,6 @@ func startBids(
func runCommands(_ context.Context) {
if viper.GetBool("version") {
fmt.Fprintf(os.Stdout, "%s\n", ReleaseVersion)
//nolint:revive
os.Exit(0)
}
}
1 change: 0 additions & 1 deletion metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func setRelease(_ context.Context, version string) {
releaseMetric.WithLabelValues(version).Set(1)
}

//nolint:revive
func setReady(_ context.Context, ready bool) {
if readyMetric == nil {
return
Expand Down
2 changes: 1 addition & 1 deletion services/blockpayments/standard/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ func (s *Service) checkUnderpaidBid(ctx context.Context,
return nil
}

//nolint:revive
func (s *Service) calcBuilderRewards(ctx context.Context,
block *execdb.Block,
txs []*execdb.Transaction,
Expand Down Expand Up @@ -511,6 +510,7 @@ func (s *Service) deliveredBidOfSlot(ctx context.Context,
deliveredBid := deliveredBids[0]

if e := log.Trace(); e.Enabled() {
//nolint:musttag
rawJSON, err := json.Marshal(deliveredBid)
if err == nil {
e.RawJSON("delivered_bid", rawJSON).Msg("Obtained delivered bid")
Expand Down
1 change: 0 additions & 1 deletion services/blockpayments/standard/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) {
if err := s.onReplaySlot(ctx, phase0.Slot(parameters.replaySlot)); err != nil {
return nil, err
}
//nolint:revive
os.Exit(0)
}

Expand Down
4 changes: 0 additions & 4 deletions services/comptrollerdb/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ type BlockPaymentFilter struct {
// ToSlot is the latest slot to which to fetch results.
// If nil then there is no latest slot.
ToSlot *uint32

// FeeRecipients are the fee recipients of the rewards.
// If nil then there is no fee recipient filter.
// FeeRecipients [][]byte
}

// ValidatorRegistrationFilter defines a filter for fetching validator registrations.
Expand Down
1 change: 0 additions & 1 deletion services/comptrollerdb/postgresql/alternatebids.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ FROM t_alternate_bids`)
queryVals = append(queryVals, filter.BestRelays)
_, _ = queryBuilder.WriteString(fmt.Sprintf(`
%s f_best_relay = ANY($%d)`, wherestr, len(queryVals)))
// wherestr = " AND"
}

switch filter.Order {
Expand Down
1 change: 0 additions & 1 deletion services/comptrollerdb/postgresql/deliveredbids.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ FROM t_delivered_bids`)
queryVals = append(queryVals, filter.BlockHashes)
_, _ = queryBuilder.WriteString(fmt.Sprintf(`
%s f_block_hash = ANY($%d)`, wherestr, len(queryVals)))
// wherestr = " AND"
}

switch filter.Order {
Expand Down
Loading