Skip to content

Commit

Permalink
Merge branch 'main' into catch-up-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Sep 13, 2023
2 parents e30a4ac + 4ff11bf commit 1e9891d
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.

name: Run Golang Linter

on:
push:
branches:
- '*'

jobs:
golangci:
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: awm-relayer

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.7'
check-latest: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51
working-directory: ./awm-relayer
args: --timeout 10m
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Needed for multi-platform builds
- name: Set up QEMU
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: awm-relayer

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: awm-relayer

Expand Down
29 changes: 29 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures github.com/golangci/golangci-lint.

run:
timeout: 3m
tests: true
# skip auto-generated files.
skip-files:
- ".*mock.*"

issues:
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

linters:
disable-all: true
enable:
- goconst
- goimports
- gosimple
- govet
- ineffassign
- misspell
- unconvert
- unused
- whitespace

linters-settings:
gofmt:
simplify: true
3 changes: 1 addition & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ func TestGetRelayerAccountPrivateKey_set_pk_with_global_env(t *testing.T) {
},
envSetter: func() {
// Overwrite the PK for the first subnet using an env var
varName := fmt.Sprintf("%s", accountPrivateKeyEnvVarName)
t.Setenv(varName, testPk2)
t.Setenv(accountPrivateKeyEnvVarName, testPk2)
},
expectedOverwritten: true,
resultVerifier: func(c Config) bool {
Expand Down
1 change: 0 additions & 1 deletion main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ func initMetrics() (prometheus.Gatherer, prometheus.Registerer, error) {
registry := prometheus.NewRegistry()
if err := gatherer.Register("app", registry); err != nil {
return nil, nil, err

}
return gatherer, registry, nil
}
1 change: 0 additions & 1 deletion peers/external_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (h *RelayerExternalHandler) HandleInbound(_ context.Context, inboundMessage

h.responseChans[chainID] <- inboundMessage
}(inboundMessage, chainID)

} else {
inboundMessage.OnFinishedHandling()
}
Expand Down
3 changes: 1 addition & 2 deletions relayer/message_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (r *messageRelayer) createSignedMessage(requestID uint32) (*warp.Message, e
// If new peers are connected, AppRequests may fail while the handshake is in progress.
// In that case, AppRequests to those nodes will be retried in the next iteration of the retry loop.
nodeIDs := set.NewSet[ids.NodeID](len(nodeValidatorIndexMap))
for node, _ := range nodeValidatorIndexMap {
for node := range nodeValidatorIndexMap {
nodeIDs.Add(node)
}

Expand Down Expand Up @@ -424,7 +424,6 @@ func (r *messageRelayer) getCurrentCanonicalValidatorSet() ([]*warp.Validator, u
func (r *messageRelayer) isValidSignatureResponse(
response message.InboundMessage,
pubKey *bls.PublicKey) (blsSignatureBuf, bool) {

// If the handler returned an error response, count the response and continue
if response.Op() == message.AppRequestFailedOp {
r.logger.Debug(
Expand Down
9 changes: 9 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.

set -o errexit
set -o nounset
set -o pipefail

golangci-lint run --path-prefix=. --timeout 3m
1 change: 1 addition & 0 deletions vms/evm/contract_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"go.uber.org/mock/gomock"
)

// nolint: unused
// Used to create a valid unsigned message for testing. Should not be used directly in tests.
func createUnsignedMessage() *warp.UnsignedMessage {
sourceChainID, err := ids.FromString("yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp")
Expand Down

0 comments on commit 1e9891d

Please sign in to comment.