diff --git a/.github/workflows/goreleaser.yaml b/.github/workflows/goreleaser.yaml index dfebce9..6e6f440 100644 --- a/.github/workflows/goreleaser.yaml +++ b/.github/workflows/goreleaser.yaml @@ -38,7 +38,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.22' + go-version: '1.23' - uses: actions/setup-node@v3 name: Set up Node with: diff --git a/.github/workflows/vet.yaml b/.github/workflows/vet.yaml index fcee30a..d10c3c4 100644 --- a/.github/workflows/vet.yaml +++ b/.github/workflows/vet.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_version: [ 1.22.x ] + go_version: [ 1.23.x ] steps: - name: Set up Go ${{ matrix.go_version }} uses: actions/setup-go@v3 @@ -24,7 +24,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.59 + version: v1.60 # Optional: working directory, useful for monorepos # working-directory: somedir @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_version: [ 1.22.x ] + go_version: [ 1.23.x ] steps: - name: Set up Go ${{ matrix.go_version }} uses: actions/setup-go@v3 diff --git a/.golangci.yml b/.golangci.yml index a1ccd25..aaccdc9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,7 @@ linters-settings: - performance - style govet: - check-shadowing: true + shadow: true nolintlint: require-explanation: true require-specific: true @@ -25,13 +25,11 @@ linters: - bodyclose - containedctx - decorder - - depguard - dogsled - durationcheck - errcheck - errname - exportloopref - - goconst - gocritic - gocyclo - gofmt diff --git a/go.mod b/go.mod index e5e8c31..ba11fc0 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/ethpandaops/forky -go 1.22.0 - -toolchain go1.23.1 +go 1.23.1 replace github.com/probe-lab/hermes => github.com/ethpandaops/hermes v0.0.0-20240919054858-186de8ab9894 diff --git a/pkg/forky/db/frame_metadata_label.go b/pkg/forky/db/frame_metadata_label.go index 7127abf..031651e 100644 --- a/pkg/forky/db/frame_metadata_label.go +++ b/pkg/forky/db/frame_metadata_label.go @@ -18,8 +18,8 @@ type FrameMetadataLabels []FrameMetadataLabel func (f *FrameMetadataLabels) AsStrings() []string { labels := make([]string, len(*f)) - for i, label := range *f { - labels[i] = label.Name + for i := range *f { + labels[i] = (*f)[i].Name } return labels diff --git a/pkg/forky/db/indexer_test.go b/pkg/forky/db/indexer_test.go index c177e19..1153631 100644 --- a/pkg/forky/db/indexer_test.go +++ b/pkg/forky/db/indexer_test.go @@ -649,6 +649,7 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) { // Check that all nodes are returned expectedNodes := []string{"node0", "node1", "node2", "node3", "node4"} assert.Len(t, nodes, len(expectedNodes)) + for _, node := range expectedNodes { assert.Contains(t, nodes, node) } @@ -682,6 +683,7 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) { filter := &FrameFilter{ Labels: &[]string{"label5"}, } + nodes, err := indexer.ListNodesWithFrames(context.Background(), filter, &PaginationCursor{}) if err != nil { t.Fatal(err) @@ -690,7 +692,6 @@ func TestIndexer_ListNodesWithFrames(t *testing.T) { // Check that only nodes with frames with the "label5" label are returned for _, node := range nodes { frames, err := indexer.ListFrameMetadata(context.Background(), &FrameFilter{ - //nolint:gosec // don't care in this test Node: &node, }, &PaginationCursor{}) if err != nil { diff --git a/pkg/forky/forky_test.go b/pkg/forky/forky_test.go index 19f4c55..ae35633 100644 --- a/pkg/forky/forky_test.go +++ b/pkg/forky/forky_test.go @@ -218,6 +218,7 @@ func TestForkChoiceServer(t *testing.T) { } time.Sleep(5 * time.Second) + err = s.svc.DeleteOldFrames(context.Background()) assert.NoError(t, err) diff --git a/pkg/forky/source/xatu_http.go b/pkg/forky/source/xatu_http.go index 7fb0bb8..4ee0393 100644 --- a/pkg/forky/source/xatu_http.go +++ b/pkg/forky/source/xatu_http.go @@ -291,7 +291,7 @@ func (x *XatuHTTP) handleXatuEvent(ctx context.Context, event *xatu.DecoratedEve func (x *XatuHTTP) handleForkChoiceEvent(ctx context.Context, event *xatu.DecoratedEvent) error { // Create a new frame based on the event - fc := event.GetEthV1ForkChoice() + fc := event.GetEthV1ForkChoiceV2() if fc == nil { return fmt.Errorf("event is not a fork choice event") } @@ -337,7 +337,7 @@ func (x *XatuHTTP) handleForkChoiceReorgEvent(ctx context.Context, event *xatu.D // Create 2 new frames based on the event (one for `before` the reorg and one for `after` the reorg) // Note: `before` can be nil if the reorg happened before the xatu sentry started - fcr := event.GetEthV1ForkChoiceReorg() + fcr := event.GetEthV1ForkChoiceReorgV2() if fcr == nil { return fmt.Errorf("event is not a fork choice reorg event") } @@ -453,7 +453,7 @@ func (x *XatuHTTP) createFrameFromSnapshotAndData(ctx context.Context, } if event.GetEvent().GetName() == xatu.Event_BEACON_API_ETH_V1_DEBUG_FORK_CHOICE_REORG { - data := event.GetEthV1ForkChoiceReorg() + data := event.GetEthV1ForkChoiceReorgV2() prefix := "xatu_reorg_event_" @@ -466,7 +466,7 @@ func (x *XatuHTTP) createFrameFromSnapshotAndData(ctx context.Context, prefix+"old_head_state="+data.GetEvent().GetOldHeadState(), prefix+"new_head_block="+data.GetEvent().GetNewHeadBlock(), prefix+"new_head_state="+data.GetEvent().GetNewHeadState(), - fmt.Sprintf(prefix+"depth=%d", +data.GetEvent().GetDepth()), + fmt.Sprintf(prefix+"depth=%d", +data.GetEvent().GetDepth().GetValue()), "xatu_reorg_frame_timing="+timing, )