Skip to content

Commit

Permalink
Fix lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Sep 28, 2023
1 parent 2f2409a commit fdede2b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ on:

jobs:
lint:
name: Run Go Lint
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.21.x
go-version: 1.20.x

- name: Checkout code
uses: actions/checkout@v3

- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.1
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49

- name: Run golangci-lint
run: golangci-lint run --timeout 10m --verbose
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout 10m --verbose
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run:
- tests

service:
golangci-lint-version: 1.42.1
golangci-lint-version: 1.49

linters:
disable-all: true
Expand Down
3 changes: 2 additions & 1 deletion store/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"github.com/umbracle/ethgo/abi"
)

var StateSyncEventABI = abi.MustNewEvent("event StateSynced(uint256 indexed id, address indexed sender, address indexed receiver, bytes data)")
var StateSyncEventABI = abi.MustNewEvent("event StateSynced(uint256 indexed id, " +
"address indexed sender, address indexed receiver, bytes data)")

func CreateTestLogForStateSyncEvent(t *testing.T, blockNumber, logIndex uint64) *ethgo.Log {
t.Helper()
Expand Down
6 changes: 5 additions & 1 deletion tracker/tracker_block_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ func TestTrackerBlockContainer_AddBlockAndLastCachedBlock(t *testing.T) {
tbc := NewTrackerBlockContainer(0)

for i := uint64(1); i <= uint64(numOfBlocks); i++ {
require.NoError(t, tbc.AddBlock(&ethgo.Block{Number: i, Hash: ethgo.Hash{byte(i)}, ParentHash: ethgo.Hash{byte(i - 1)}}))
require.NoError(t, tbc.AddBlock(&ethgo.Block{
Number: i,
Hash: ethgo.Hash{byte(i)},
ParentHash: ethgo.Hash{byte(i - 1)},
}))
require.Equal(t, i, tbc.LastCachedBlock())
}

Expand Down
3 changes: 2 additions & 1 deletion tracker/tracker_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func FuzzGetNewState(f *testing.F) {

providerMock := new(mockProvider)
for blockNum := data.LastProcessed + 1; blockNum <= data.Number; blockNum++ {
providerMock.On("GetBlockByNumber", ethgo.BlockNumber(blockNum), false).Return(&ethgo.Block{Number: blockNum}, nil).Once()
providerMock.On("GetBlockByNumber", ethgo.BlockNumber(blockNum), false).Return(
&ethgo.Block{Number: blockNum}, nil).Once()
}

logs := []*ethgo.Log{
Expand Down
6 changes: 4 additions & 2 deletions tracker/tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,8 @@ func TestEventTracker_TrackBlock(t *testing.T) {
// just mock the call, it will use the provider.logs map to handle proper returns
blockProviderMock.On("GetLogs", mock.Anything).Return(nil, nil).Times(len(logs))
// just mock the call, it will use the provider.blocks map to handle proper returns
blockProviderMock.On("GetBlockByNumber", mock.Anything, mock.Anything).Return(nil, nil).Times(int(numOfMissedBlocks + numOfCachedBlocks))
blockProviderMock.On("GetBlockByNumber", mock.Anything, mock.Anything).Return(nil, nil).Times(
int(numOfMissedBlocks + numOfCachedBlocks))

tracker, err := NewEventTracker(createTestTrackerConfig(t, numBlockConfirmations, batchSize, 0))
require.NoError(t, err)
Expand Down Expand Up @@ -582,7 +583,8 @@ func TestEventTracker_TrackBlock(t *testing.T) {
})
}

func createTestTrackerConfig(t *testing.T, numBlockConfirmations, batchSize, maxBacklogSize uint64) *EventTrackerConfig {
func createTestTrackerConfig(t *testing.T,
numBlockConfirmations, batchSize, maxBacklogSize uint64) *EventTrackerConfig {
t.Helper()

return &EventTrackerConfig{
Expand Down

0 comments on commit fdede2b

Please sign in to comment.