Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint issues #394

Merged
merged 90 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
626287a
linter issues fixed
NagaTulasi Jan 27, 2021
dd91b78
lint issues fixed
NagaTulasi Jan 27, 2021
e7f0dea
lint issues fixed
NagaTulasi Jan 28, 2021
3c19cb6
name chain conflict resolved
NagaTulasi Jan 28, 2021
84f3f63
strat modified as start
NagaTulasi Jan 28, 2021
6cee5c9
linter issues fixed
NagaTulasi Jan 28, 2021
cbfcc16
character length issues resolved
NagaTulasi Jan 28, 2021
5fb75ad
character length issues resolved
NagaTulasi Jan 28, 2021
6dd65c6
character length issues resolved
NagaTulasi Jan 28, 2021
3e4d0e1
conflict resolved
NagaTulasi Jan 28, 2021
73d5647
character length issues resolved
NagaTulasi Jan 28, 2021
2f14106
character lengths resolved
NagaTulasi Jan 29, 2021
32665ea
character lengths resolved
NagaTulasi Jan 29, 2021
0e87333
conflict resolved
NagaTulasi Jan 29, 2021
6b94060
character lengths resolved
NagaTulasi Jan 29, 2021
2fcf05a
conflict resolved
NagaTulasi Jan 29, 2021
a30bfb0
conflict resolved
NagaTulasi Jan 29, 2021
51e0659
character lengths resolved
NagaTulasi Jan 29, 2021
0bc9fee
character lengths resolved
NagaTulasi Jan 29, 2021
f44e8f1
conflict resolved
NagaTulasi Jan 29, 2021
8ffe5c1
conflict resolved
NagaTulasi Jan 29, 2021
85b5bfc
conflict resolved
NagaTulasi Jan 29, 2021
ae8b619
conflict resolved
NagaTulasi Jan 29, 2021
ede54d6
length character issuse resolved
NagaTulasi Jan 29, 2021
0f3c49c
conflict resolved
NagaTulasi Jan 29, 2021
d2018c0
reundant return issue resolved
NagaTulasi Jan 29, 2021
bd449e9
error check added to retry.do function
NagaTulasi Jan 29, 2021
021c032
lint issues fixed
NagaTulasi Jan 29, 2021
4a151e8
redundant issue resolved
NagaTulasi Jan 29, 2021
ad827d0
lint issues fixed
NagaTulasi Jan 29, 2021
4cd0b38
lint issues fixed
NagaTulasi Jan 29, 2021
55088cb
lint issues fixed
NagaTulasi Jan 29, 2021
2522a97
composite literal issue resolved
NagaTulasi Jan 29, 2021
689b928
character lenth issue solved
NagaTulasi Jan 29, 2021
e43c84e
Sprint issue resolved
NagaTulasi Jan 29, 2021
4d1a7a5
Sprint issue resolved
NagaTulasi Jan 29, 2021
3a7de6d
start changed to sTrategy
NagaTulasi Feb 1, 2021
020feda
conflict resolved
NagaTulasi Feb 1, 2021
7da3ebd
conflict resolved
NagaTulasi Feb 1, 2021
9ad95ba
conflict resolved
NagaTulasi Feb 1, 2021
d38c64a
conflict resolved
NagaTulasi Feb 1, 2021
a06b83d
conflict resolved
NagaTulasi Feb 1, 2021
6fad575
conflict resolved
NagaTulasi Feb 1, 2021
42014c8
make file changed
NagaTulasi Feb 1, 2021
1245d3f
conflict resolved
NagaTulasi Feb 1, 2021
a46ecb8
conflict resolved
NagaTulasi Feb 1, 2021
53a1a8a
conflict resolved
NagaTulasi Feb 1, 2021
2eba8bb
empty branch issue resolved
NagaTulasi Feb 1, 2021
3c1c1bd
empty branch issue resolved
NagaTulasi Feb 1, 2021
8ad4dc0
empty branch issue resolved
NagaTulasi Feb 1, 2021
4866085
empty branch issue resolved
NagaTulasi Feb 1, 2021
50f2535
empty branch issue resolved
NagaTulasi Feb 1, 2021
3a278c5
interfacer issue resolved
NagaTulasi Feb 1, 2021
cb07b34
go lint issues fixed
NagaTulasi Feb 1, 2021
b31b7a2
go lint issues fixed
NagaTulasi Feb 1, 2021
7db27d0
go lint issues fixed
NagaTulasi Feb 1, 2021
37fb2e4
go lint issues fixed
NagaTulasi Feb 1, 2021
c5ee7a7
comments modified
NagaTulasi Feb 1, 2021
5cfbd4e
comments modified
NagaTulasi Feb 1, 2021
703a9d6
comments modified
NagaTulasi Feb 1, 2021
32b99c1
comments modified
NagaTulasi Feb 1, 2021
1676467
comments added
NagaTulasi Feb 1, 2021
3e8d183
comments added
NagaTulasi Feb 1, 2021
e4913f4
comments added
NagaTulasi Feb 1, 2021
2d17b4a
comments deleted
NagaTulasi Feb 1, 2021
991b0e9
comments deleted
NagaTulasi Feb 1, 2021
695664d
comments deleted
NagaTulasi Feb 1, 2021
39bc53c
issues fixed
NagaTulasi Feb 1, 2021
ce57844
issues fixed
NagaTulasi Feb 1, 2021
8f8df6a
length issue resolved
NagaTulasi Feb 2, 2021
4f1fdfc
updated
NagaTulasi Feb 2, 2021
d51b558
lint issues fixed
NagaTulasi Feb 2, 2021
9265ef4
conflict resolved
NagaTulasi Feb 2, 2021
69c7310
conflict resolved
NagaTulasi Feb 2, 2021
0b825f9
conflict resolved
NagaTulasi Feb 2, 2021
25d53f5
conflict resolved
NagaTulasi Feb 2, 2021
7eefe93
issues fixed
NagaTulasi Feb 2, 2021
0afe8bd
conflict resolved
NagaTulasi Feb 2, 2021
a26cc65
issues fixed
NagaTulasi Feb 2, 2021
277affe
conflicts resolved
NagaTulasi Feb 2, 2021
d5325a7
issues fixed
NagaTulasi Feb 2, 2021
9757543
issues fixed
NagaTulasi Feb 2, 2021
817acf5
issues fixed
NagaTulasi Feb 2, 2021
ec539e3
issues fixed
NagaTulasi Feb 2, 2021
bd24dae
issue resolved
NagaTulasi Feb 2, 2021
91b5578
issue resolved
NagaTulasi Feb 2, 2021
83db4bb
conflicts resolved
NagaTulasi Feb 2, 2021
9f116c9
sTrategy changed to strategyType
NagaTulasi Feb 2, 2021
df5148f
Merge branch 'master' of https://github.com/cosmos/relayer into tulas…
NagaTulasi Feb 2, 2021
3790396
Changes done
NagaTulasi Feb 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clib/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var clibPort = 0
var replies = map[int]chan goReturn{}
var lastReply = 0

//nolint:golint
//export RunClib
func RunClib(nodePort C.int, toNode C.sendFunc, clibArgs []*C.char) C.int {
if relayer.SendToController == nil {
Expand Down Expand Up @@ -75,6 +76,7 @@ func RunClib(nodePort C.int, toNode C.sendFunc, clibArgs []*C.char) C.int {
return C.int(clibPort)
}

//nolint:golint
//export ReplyToClib
func ReplyToClib(replyPort C.int, isError C.int, str C.Body) C.int {
goStr := C.GoString(str)
Expand All @@ -92,6 +94,7 @@ func ReplyToClib(replyPort C.int, isError C.int, str C.Body) C.int {
return C.int(0)
}

//nolint:golint
//export SendToClib
func SendToClib(port C.int, str C.Body) C.Body {
goStr := C.GoString(str)
Expand Down
5 changes: 4 additions & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 Jack Zampolin [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -32,7 +33,9 @@ import (
)

const (
ORDERED = "ORDERED"
// ORDERED is exported channel type constant
ORDERED = "ORDERED"
// UNORDERED is exported channel type constant
UNORDERED = "UNORDERED"
defaultOrder = ORDERED
defaultVersion = "ics20-1"
Expand Down
5 changes: 3 additions & 2 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var (
flagSkip = "skip"
flagStrategy = "strategy"
flagTimeout = "timeout"
flagConfig = "config"
flagJSON = "json"
flagYAML = "yaml"
flagFile = "file"
Expand Down Expand Up @@ -198,7 +197,9 @@ func versionFlag(cmd *cobra.Command) *cobra.Command {
}

func forceFlag(cmd *cobra.Command) *cobra.Command {
cmd.Flags().BoolP(flagForce, "f", false, "option to force non-standard behavior such as initialization of light client from configured chain or generation of new path") //nolint:lll
cmd.Flags().BoolP(flagForce, "f", false,
"option to force non-standard behavior such as initialization of light client from"+
"configured chain or generation of new path")
if err := viper.BindPFlag(flagForce, cmd.Flags().Lookup(flagForce)); err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/keys.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 Jack Zampolin [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -133,7 +134,6 @@ $ %s k r ibc-1 faucet-key "[mnemonic-words]"`, appName, appName)),
}

coinType, _ := cmd.Flags().GetUint32(flagCoinType)

info, err := chain.Keybase.NewAccount(keyName, args[2], "", hd.CreateHDPath(coinType, 0, 0).String(), hd.Secp256k1)
if err != nil {
return err
Expand Down
8 changes: 5 additions & 3 deletions cmd/light.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 Jack Zampolin <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -86,7 +87,8 @@ $ %s l i ibc-2 --force`, appName, appName, appName)),
if err != nil {
return err
}
fmt.Printf("successfully created light client for %s by trusting endpoint %s...\n", chain.ChainID, chain.RPCAddr)
fmt.Printf("successfully created light client for %s by trusting endpoint %s...\n",
chain.ChainID, chain.RPCAddr)
case height > 0 && len(hash) > 0: // height and hash are given
_, err = chain.LightClientWithTrust(db, chain.TrustOptions(height, hash))
if err != nil {
Expand Down Expand Up @@ -127,8 +129,8 @@ $ %s l u ibc-1`, appName, appName)),
if err != nil {
return err
}

fmt.Printf("Updated light client for %s from height %d -> height %d\n", args[0], bh.Header.Height, ah.Header.Height)
fmt.Printf("Updated light client for %s from height %d -> height %d\n",
args[0], bh.Header.Height, ah.Header.Height)
return nil
},
}
Expand Down
8 changes: 5 additions & 3 deletions cmd/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ $ %s pth gen ibc-0 ibc-1 demo-path --unordered false --version ics20-2`, appName
dstClients, err = c[dst].QueryClients(0, 1000)
return err
})
if eg.Wait(); err != nil {
if err := eg.Wait(); err != nil {
return err
}

Expand Down Expand Up @@ -284,7 +284,8 @@ $ %s pth gen ibc-0 ibc-1 demo-path --unordered false --version ics20-2`, appName
dstOrder := dstChan.Ordering == path.Dst.GetOrder()
srcVersion := srcChan.Version == path.Src.Version
dstVersion := dstChan.Version == path.Dst.Version
if !(dstCpForSrc && srcCpForDst && srcOpen && dstOpen && srcPort && dstPort && srcOrder && dstOrder && srcVersion && dstVersion) {
if !(dstCpForSrc && srcCpForDst && srcOpen && dstOpen && srcPort && dstPort &&
srcOrder && dstOrder && srcVersion && dstVersion) {
path.GenSrcChanID()
path.GenDstChanID()
}
Expand Down Expand Up @@ -369,7 +370,8 @@ $ %s pth l`, appName, appName, appName)),
return err
}
stat := pth.QueryPathStatus(chains[pth.Src.ChainID], chains[pth.Dst.ChainID]).Status
printPath(i, k, pth, checkmark(stat.Chains), checkmark(stat.Clients), checkmark(stat.Connection), checkmark(stat.Channel))
printPath(i, k, pth, checkmark(stat.Chains), checkmark(stat.Clients),
checkmark(stat.Connection), checkmark(stat.Channel))
i++
}
return nil
Expand Down
13 changes: 8 additions & 5 deletions cmd/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ func chanInit() *cobra.Command {
Short: "chan-init",
Args: cobra.ExactArgs(11),
Example: strings.TrimSpace(fmt.Sprintf(`
$ %s tx raw chan-init ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered`, appName)),
$ %s tx raw chan-init ibc-0 ibc-1 ibczeroclient ibconeclient
ibcconn1 ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered`, appName)),
RunE: func(cmd *cobra.Command, args []string) error {
src, dst := args[0], args[1]
chains, err := config.Chains.Gets(args[0], args[1])
Expand Down Expand Up @@ -541,9 +542,10 @@ func createChannelStepCmd() *cobra.Command {
Short: "create the next step in creating a channel between chains with the passed identifiers",
Args: cobra.ExactArgs(11),
Example: strings.TrimSpace(fmt.Sprintf(`
$ %s transact raw chan-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered
$ %s tx raw channel-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered
`, appName, appName)),
$ %s transact raw chan-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1
ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered
$ %s tx raw channel-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1
ibcconn2 ibcchan1 ibcchan2 transfer transfer ordered`, appName, appName)),
RunE: func(cmd *cobra.Command, args []string) error {
src, dst := args[0], args[1]
chains, err := config.Chains.Gets(src, dst)
Expand Down Expand Up @@ -654,7 +656,8 @@ func closeChannelStepCmd() *cobra.Command {
Short: "create the next step in closing a channel between chains with the passed identifiers",
Args: cobra.ExactArgs(10),
Example: strings.TrimSpace(fmt.Sprintf(`
$ %s tx raw close-channel-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1 ibcconn2 ibcchan1 ibcchan2 transfer transfer`, appName)),
$ %s tx raw close-channel-step ibc-0 ibc-1 ibczeroclient ibconeclient ibcconn1
ibcconn2 ibcchan1 ibcchan2 transfer transfer`, appName)),
RunE: func(cmd *cobra.Command, args []string) error {
src, dst := args[0], args[1]
chains, err := config.Chains.Gets(src, dst)
Expand Down
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 Jack Zampolin [email protected]

Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,6 +26,7 @@ import (
"github.com/spf13/viper"
)

// MB is a megabyte
const (
MB = 1048576 // in bytes
)
Expand Down
1 change: 1 addition & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 Jack Zampolin <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
16 changes: 8 additions & 8 deletions cmd/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ import (

// GetStrategyWithOptions sets strategy specific fields.
func GetStrategyWithOptions(cmd *cobra.Command, strategy relayer.Strategy) (relayer.Strategy, error) {
switch strat := strategy.(type) {
switch strategyType := strategy.(type) {
case *relayer.NaiveStrategy:
maxTxSize, err := cmd.Flags().GetString(flagMaxTxSize)
if err != nil {
return strat, err
return strategyType, err
}

txSize, err := strconv.ParseUint(maxTxSize, 10, 64)
if err != nil {
return strat, err
return strategyType, err
}

// set max size of messages in a relay transaction
strat.MaxTxSize = txSize * MB // in MB
strategyType.MaxTxSize = txSize * MB // in MB

maxMsgLength, err := cmd.Flags().GetString(flagMaxMsgLength)
if err != nil {
return strat, err
return strategyType, err
}

msgLen, err := strconv.ParseUint(maxMsgLength, 10, 64)
if err != nil {
return strat, err
return strategyType, err
}

// set max length messages in relay transaction
strat.MaxMsgLength = msgLen
strategyType.MaxMsgLength = msgLen

return strat, nil
return strategyType, nil
default:
return strategy, nil
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/testnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ $ %s tst req ibc-0`, appName, appName, appName)),
if err != nil {
return err
}

body, err := json.Marshal(relayer.FaucetRequest{Address: info.GetAddress().String(), ChainID: chain.ChainID})
body, err := json.Marshal(relayer.FaucetRequest{Address: info.GetAddress().String(),
ChainID: chain.ChainID})
if err != nil {
return err
}
Expand Down
12 changes: 8 additions & 4 deletions cmd/tx.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Package cmd includes relayer commands
Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -348,7 +349,9 @@ $ %s tx pth demo-path`, appName, appName, appName, appName, appName)),
// create clients if they aren't already created
modified, err := c[src].CreateClients(c[dst])
if modified {
overWriteConfig(cmd, config)
if err := overWriteConfig(cmd, config); err != nil {
return err
}
}

if err != nil {
Expand Down Expand Up @@ -497,9 +500,10 @@ $ %s tx acks demo-path -l 3 -s 6`, appName, appName)),

func upgradeChainCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "upgrade-chain [path-name] [chain-id] [new-unbonding-period] [deposit] [path/to/upgradePlan.json]",
Short: "upgrade a chain by providing the chain-id of the chain being upgraded, the new unbonding period, the proposal deposit and the json file of the upgrade plan without the upgrade client state ",
Args: cobra.ExactArgs(5),
Use: "upgrade-chain [path-name] [chain-id] [new-unbonding-period] [deposit] [path/to/upgradePlan.json]",
Short: "upgrade a chain by providing the chain-id of the chain being upgraded, the new unbonding period," +
"the proposal deposit and the json file of the upgrade plan without the upgrade client state",
Args: cobra.ExactArgs(5),
RunE: func(cmd *cobra.Command, args []string) error {
c, src, dst, err := config.ChainsFromPath(args[0])
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions cmd/xfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ %s tx xfer ibc-0 ibc-1 100000stake cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39
$ %s tx xfer ibc-0 ibc-1 100000stake raw:non-bech32-address --path demo
$ %s tx txf ibc-0 ibc-1 100000stake cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk --path demo
$ %s tx raw send ibc-0 ibc-1 100000stake cosmos1skjwj5whet0lpe65qaq4rpq03hjxlwd9nf39lk --path demo -c 5
`, appName, appName, appName, appName)),
`, appName, appName, appName, appName, appName)),
RunE: func(cmd *cobra.Command, args []string) error {
src, dst := args[0], args[1]
c, err := config.Chains.Gets(src, dst)
Expand Down Expand Up @@ -124,7 +124,8 @@ func setPathsFromArgs(src, dst *relayer.Chain, name string) (*relayer.Path, erro
return path, err
}
case name == "" && len(paths) > 1:
return nil, fmt.Errorf("more than one path between %s and %s exists, pass in path name", src.ChainID, dst.ChainID)
return nil, fmt.Errorf("more than one path between %s and %s exists, pass in path name",
src.ChainID, dst.ChainID)
case name == "" && len(paths) == 1:
for _, v := range paths {
path = v
Expand Down
17 changes: 14 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ require (
github.com/cosmos/cosmos-sdk v0.41.0
github.com/cosmos/go-bip39 v1.0.0
github.com/gogo/protobuf v1.3.3
github.com/google/go-cmp v0.5.4 // indirect
github.com/gorilla/mux v1.8.0
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.9.0 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/moby/term v0.0.0-20201101162038-25d840ce174a // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/onsi/gomega v1.10.4 // indirect
github.com/ory/dockertest/v3 v3.6.2
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/spf13/afero v1.5.1 // indirect
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.3
github.com/tendermint/tm-db v0.6.3
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 // indirect
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/text v0.3.5 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
Expand Down
Loading