Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gwen917 committed Sep 6, 2023
1 parent b610c85 commit 0d732cc
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 39 deletions.
3 changes: 1 addition & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,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 @@ -284,7 +284,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 @@ -133,7 +133,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 @@ -159,7 +159,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 @@ -426,7 +426,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
1 change: 0 additions & 1 deletion relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func NewRelayer(
responseChan chan message.InboundMessage,
destinationClients map[ids.ID]vms.DestinationClient,
) (*Relayer, vms.Subscriber, error) {

sub := vms.NewSubscriber(logger, sourceSubnetInfo)

subnetID, err := ids.FromString(sourceSubnetInfo.SubnetID)
Expand Down
32 changes: 0 additions & 32 deletions vms/evm/contract_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,12 @@ import (
"encoding/hex"
"testing"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/vms/platformvm/warp"
"github.com/ava-labs/awm-relayer/config"
warpPayload "github.com/ava-labs/subnet-evm/warp/payload"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

// 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")
if err != nil {
return nil
}
destinationChainID, err := ids.FromString("11111111111111111111111111111111LpoYY")
if err != nil {
return nil
}

payload, err := warpPayload.NewAddressedPayload(
common.HexToAddress("27aE10273D17Cd7e80de8580A51f476960626e5f"),
common.Hash(destinationChainID),
common.HexToAddress("1234123412341234123412341234123412341234"),
[]byte{},
)
if err != nil {
return nil
}

unsignedMsg, err := warp.NewUnsignedMessage(0, sourceChainID, payload.Bytes())
if err != nil {
return nil
}
return unsignedMsg
}

func TestUnpack(t *testing.T) {
ctrl := gomock.NewController(t)

Expand Down

0 comments on commit 0d732cc

Please sign in to comment.