From 4c6b8516d346829ed92c7306bdb21b3aaf0e8c48 Mon Sep 17 00:00:00 2001 From: bournezjc Date: Wed, 16 Oct 2024 19:38:00 +0800 Subject: [PATCH] test fix --- .github/workflows/publish.yml | 3 ++- finalitygadget/finalitygadget.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bb7137b..7819982 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,7 @@ on: branches: - 'chore/ci-publish-docker' - 'main' + - 'bourne/gosec-followup' tags: - '*' @@ -17,7 +18,7 @@ jobs: run-unit-tests: true run-check-mock-gen: true run-gosec: true - gosec-args: "-exclude=G115,G112,G104 -exclude-generated -exclude-dir=testutil ./..." + gosec-args: "-exclude-generated -exclude-dir=testutil ./..." docker_pipeline: needs: ["lint_test"] diff --git a/finalitygadget/finalitygadget.go b/finalitygadget/finalitygadget.go index 7d7032a..a351306 100644 --- a/finalitygadget/finalitygadget.go +++ b/finalitygadget/finalitygadget.go @@ -501,6 +501,10 @@ func (fg *FinalityGadget) handleBlock(ctx context.Context, latestFinalizedHeight case <-ctx.Done(): return nil default: + // Safely convert uint64 to int64 + if height > math.MaxInt64 { + return fmt.Errorf("block height %d exceeds maximum int64 value", height) + } block, err := fg.queryBlockByHeight(int64(height)) if err != nil { return fmt.Errorf("error getting block at height %d: %w", height, err)