浏览代码

wormchain: Fix formatting and add to lint.sh

Chirantan Ekbote 3 年之前
父节点
当前提交
d577b931a4
共有 30 个文件被更改,包括 81 次插入55 次删除
  1. 5 5
      scripts/lint.sh
  2. 2 1
      wormhole_chain/app/export.go
  3. 4 2
      wormhole_chain/build/data/priv_validator_state.json
  4. 2 3
      wormhole_chain/x/tokenbridge/types/asset.go
  5. 2 1
      wormhole_chain/x/tokenbridge/types/chain_registration.pb.go
  6. 2 1
      wormhole_chain/x/tokenbridge/types/coin_meta_rollback_protection.pb.go
  7. 3 2
      wormhole_chain/x/tokenbridge/types/config.pb.go
  8. 2 1
      wormhole_chain/x/tokenbridge/types/events.pb.go
  9. 3 2
      wormhole_chain/x/tokenbridge/types/genesis.pb.go
  10. 4 3
      wormhole_chain/x/tokenbridge/types/query.pb.go
  11. 2 1
      wormhole_chain/x/tokenbridge/types/replay_protection.pb.go
  12. 4 3
      wormhole_chain/x/tokenbridge/types/tx.pb.go
  13. 1 0
      wormhole_chain/x/wormhole/client/cli/query_guardian_validator.go
  14. 1 0
      wormhole_chain/x/wormhole/client/cli/tx_governance.go
  15. 2 2
      wormhole_chain/x/wormhole/keeper/guardian_set.go
  16. 3 2
      wormhole_chain/x/wormhole/keeper/vaa_test.go
  17. 3 2
      wormhole_chain/x/wormhole/types/config.pb.go
  18. 2 1
      wormhole_chain/x/wormhole/types/consensus_guardian_set_index.pb.go
  19. 2 1
      wormhole_chain/x/wormhole/types/events.pb.go
  20. 5 5
      wormhole_chain/x/wormhole/types/genesis.go
  21. 3 2
      wormhole_chain/x/wormhole/types/genesis.pb.go
  22. 3 2
      wormhole_chain/x/wormhole/types/governance.pb.go
  23. 2 1
      wormhole_chain/x/wormhole/types/guardian_key.pb.go
  24. 3 2
      wormhole_chain/x/wormhole/types/guardian_set.pb.go
  25. 2 1
      wormhole_chain/x/wormhole/types/guardian_set_test.go
  26. 2 1
      wormhole_chain/x/wormhole/types/guardian_validator.pb.go
  27. 4 3
      wormhole_chain/x/wormhole/types/query.pb.go
  28. 2 1
      wormhole_chain/x/wormhole/types/replay_protection.pb.go
  29. 2 1
      wormhole_chain/x/wormhole/types/sequence_counter.pb.go
  30. 4 3
      wormhole_chain/x/wormhole/types/tx.pb.go

+ 5 - 5
scripts/lint.sh

@@ -43,7 +43,7 @@ format(){
     fi
 
     # Use -exec because of pitfall #1 in http://mywiki.wooledge.org/BashPitfalls
-    GOFMT_OUTPUT="$(find "./sdk" "./node" "./event_database" -type f -name '*.go' -not -path './node/pkg/proto/*' -print0 | xargs -r -0 goimports $GOIMPORTS_ARGS 2>&1)"
+    GOFMT_OUTPUT="$(find "./sdk" "./node" "./event_database" "./wormhole_chain" -type f -name '*.go' -not -path './node/pkg/proto/*' -print0 | xargs -r -0 goimports $GOIMPORTS_ARGS 2>&1)"
 
     if [ -n "$GOFMT_OUTPUT" ]; then
         if [ "$GITHUB_ACTION" == "true" ]; then
@@ -107,7 +107,7 @@ done
 shift $((OPTIND - 1))
 
 if [ "$#" -ne "1" ]; then
-    echo "Need to specify COMMAND." >&2 
+    echo "Need to specify COMMAND." >&2
     print_help
     exit 1
 fi
@@ -115,15 +115,15 @@ fi
 COMMAND="$1"
 
 if [[ ! " ${VALID_COMMANDS[*]} " == *" $COMMAND "* ]]; then
-    echo "Invalid command $COMMAND." >&2 
+    echo "Invalid command $COMMAND." >&2
     print_help
     exit 1
 fi
 
 # run this script recursively inside docker, if requested
 if [ "$DOCKER" == "true" ]; then
-    # The easy thing to do here would be to use a bind mount to share the code with the container. 
-    # But this doesn't work in scenarios where we are in a container already. 
+    # The easy thing to do here would be to use a bind mount to share the code with the container.
+    # But this doesn't work in scenarios where we are in a container already.
     # But it's easy so we just won't support that case for now.
     # If we wanted to support it, my idea would be to `docker run`, `docker cp`, `docker exec`, `docker rm`.
 

+ 2 - 1
wormhole_chain/app/export.go

@@ -50,7 +50,8 @@ func (app *App) ExportAppStateAndValidators(
 
 // prepare for fresh start at zero height
 // NOTE zero height genesis is a temporary feature which will be deprecated
-//      in favour of export at a block height
+//
+//	in favour of export at a block height
 func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
 	applyAllowedAddrs := false
 

+ 4 - 2
wormhole_chain/build/data/priv_validator_state.json

@@ -1,5 +1,7 @@
 {
-  "height": "0",
+  "height": "7",
   "round": 0,
-  "step": 0
+  "step": 3,
+  "signature": "t5IKJ4vt040h9AYTDotLzOIWPIcPyJGttV6F17UDKnZwgqAtQRZpI1KdihUiK/ETx/TuGcjQbRZfUY5RTky5Aw==",
+  "signbytes": "71080211070000000000000022480A207FCFF07D9D1F96B2D2BF33205CFDA6F5F23E4CE6EB8F083241B17702DCAB725D122408011220EEE1DC12493E08AF12B7EC70E55641D2E60FF2EAF14EFE1D57BF6BDCF870997A2A0B089289C7980610FDF6CA52320D776F726D686F6C65636861696E"
 }

+ 2 - 3
wormhole_chain/x/tokenbridge/types/asset.go

@@ -75,15 +75,14 @@ func IsWORMToken(tokenChain uint16, tokenAddress [32]byte) bool {
 //
 // For most tokens, this looks something like
 //
-//		"wh/00001/165809739240a0ac03b98440fe8985548e3aa683cd0d4d9df5b5659669faa300"
+//	"wh/00001/165809739240a0ac03b98440fe8985548e3aa683cd0d4d9df5b5659669faa300"
 //
 // where the string "wh" is followed by the token chain (fixed 5 characters)
 // in decimal, followed by the token address in hex (fixed 64 character).
 //
 // For the special case of the wormhole token it returns
 //
-// 		"uworm"
-//
+//	"uworm"
 func GetWrappedCoinIdentifier(tokenChain uint16, tokenAddress [32]byte) string {
 	if IsWORMToken(tokenChain, tokenAddress) {
 		return "uworm"

+ 2 - 1
wormhole_chain/x/tokenbridge/types/chain_registration.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/tokenbridge/types/coin_meta_rollback_protection.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 3 - 2
wormhole_chain/x/tokenbridge/types/config.pb.go

@@ -5,11 +5,12 @@ package types
 
 import (
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/tokenbridge/types/events.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 3 - 2
wormhole_chain/x/tokenbridge/types/genesis.pb.go

@@ -5,11 +5,12 @@ package types
 
 import (
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 4 - 3
wormhole_chain/x/tokenbridge/types/query.pb.go

@@ -6,6 +6,10 @@ package types
 import (
 	context "context"
 	fmt "fmt"
+	io "io"
+	math "math"
+	math_bits "math/bits"
+
 	query "github.com/cosmos/cosmos-sdk/types/query"
 	_ "github.com/gogo/protobuf/gogoproto"
 	grpc1 "github.com/gogo/protobuf/grpc"
@@ -14,9 +18,6 @@ import (
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
-	io "io"
-	math "math"
-	math_bits "math/bits"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/tokenbridge/types/replay_protection.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 4 - 3
wormhole_chain/x/tokenbridge/types/tx.pb.go

@@ -6,6 +6,10 @@ package types
 import (
 	context "context"
 	fmt "fmt"
+	io "io"
+	math "math"
+	math_bits "math/bits"
+
 	types "github.com/cosmos/cosmos-sdk/types"
 	_ "github.com/gogo/protobuf/gogoproto"
 	grpc1 "github.com/gogo/protobuf/grpc"
@@ -13,9 +17,6 @@ import (
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
-	io "io"
-	math "math"
-	math_bits "math/bits"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 1 - 0
wormhole_chain/x/wormhole/client/cli/query_guardian_validator.go

@@ -4,6 +4,7 @@ import (
 	"context"
 
 	"encoding/hex"
+
 	"github.com/certusone/wormhole-chain/x/wormhole/types"
 	"github.com/cosmos/cosmos-sdk/client"
 	"github.com/cosmos/cosmos-sdk/client/flags"

+ 1 - 0
wormhole_chain/x/wormhole/client/cli/tx_governance.go

@@ -2,6 +2,7 @@ package cli
 
 import (
 	"encoding/hex"
+
 	"github.com/certusone/wormhole-chain/x/wormhole/types"
 	"github.com/cosmos/cosmos-sdk/client"
 	"github.com/cosmos/cosmos-sdk/client/tx"

+ 2 - 2
wormhole_chain/x/wormhole/keeper/guardian_set.go

@@ -28,9 +28,9 @@ func (k Keeper) UpdateGuardianSet(ctx sdk.Context, newGuardianSet types.Guardian
 		return types.ErrGuardianSetNotSequential
 	}
 
-        if newGuardianSet.ExpirationTime != 0 {
+	if newGuardianSet.ExpirationTime != 0 {
 		return types.ErrNewGuardianSetHasExpiry
-        }
+	}
 
 	// Create new set
 	_, err := k.AppendGuardianSet(ctx, newGuardianSet)

+ 3 - 2
wormhole_chain/x/wormhole/keeper/vaa_test.go

@@ -4,14 +4,15 @@ import (
 	"crypto/ecdsa"
 	"crypto/rand"
 	"fmt"
+	"testing"
+	"time"
+
 	keepertest "github.com/certusone/wormhole-chain/testutil/keeper"
 	"github.com/certusone/wormhole-chain/x/wormhole/keeper"
 	"github.com/certusone/wormhole-chain/x/wormhole/types"
 	"github.com/certusone/wormhole/node/pkg/vaa"
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/stretchr/testify/assert"
-	"testing"
-	"time"
 )
 
 func TestCalculateQuorum(t *testing.T) {

+ 3 - 2
wormhole_chain/x/wormhole/types/config.pb.go

@@ -5,11 +5,12 @@ package types
 
 import (
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/consensus_guardian_set_index.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/events.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 5 - 5
wormhole_chain/x/wormhole/types/genesis.go

@@ -10,14 +10,14 @@ const DefaultIndex uint64 = 1
 // DefaultGenesis returns the default Capability genesis state
 func DefaultGenesis() *GenesisState {
 	return &GenesisState{
-		GuardianSetList:           []GuardianSet{},
-		Config:                    nil,
-		ReplayProtectionList:      []ReplayProtection{},
-		SequenceCounterList:       []SequenceCounter{},
+		GuardianSetList:      []GuardianSet{},
+		Config:               nil,
+		ReplayProtectionList: []ReplayProtection{},
+		SequenceCounterList:  []SequenceCounter{},
 		ConsensusGuardianSetIndex: &ConsensusGuardianSetIndex{
 			Index: 0,
 		},
-		GuardianValidatorList:     []GuardianValidator{},
+		GuardianValidatorList: []GuardianValidator{},
 		// this line is used by starport scaffolding # genesis/types/default
 	}
 }

+ 3 - 2
wormhole_chain/x/wormhole/types/genesis.pb.go

@@ -5,11 +5,12 @@ package types
 
 import (
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 3 - 2
wormhole_chain/x/wormhole/types/governance.pb.go

@@ -6,11 +6,12 @@ package types
 import (
 	bytes "bytes"
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/guardian_key.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 3 - 2
wormhole_chain/x/wormhole/types/guardian_set.pb.go

@@ -6,11 +6,12 @@ package types
 import (
 	bytes "bytes"
 	fmt "fmt"
-	_ "github.com/gogo/protobuf/gogoproto"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	_ "github.com/gogo/protobuf/gogoproto"
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/guardian_set_test.go

@@ -3,10 +3,11 @@ package types
 import (
 	"crypto/ecdsa"
 	"crypto/rand"
+	"testing"
+
 	"github.com/ethereum/go-ethereum/common"
 	"github.com/ethereum/go-ethereum/crypto"
 	"github.com/stretchr/testify/assert"
-	"testing"
 )
 
 func TestKeysAsAddresses(t *testing.T) {

+ 2 - 1
wormhole_chain/x/wormhole/types/guardian_validator.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 4 - 3
wormhole_chain/x/wormhole/types/query.pb.go

@@ -6,6 +6,10 @@ package types
 import (
 	context "context"
 	fmt "fmt"
+	io "io"
+	math "math"
+	math_bits "math/bits"
+
 	query "github.com/cosmos/cosmos-sdk/types/query"
 	_ "github.com/gogo/protobuf/gogoproto"
 	grpc1 "github.com/gogo/protobuf/grpc"
@@ -14,9 +18,6 @@ import (
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
-	io "io"
-	math "math"
-	math_bits "math/bits"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/replay_protection.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 2 - 1
wormhole_chain/x/wormhole/types/sequence_counter.pb.go

@@ -5,10 +5,11 @@ package types
 
 import (
 	fmt "fmt"
-	proto "github.com/gogo/protobuf/proto"
 	io "io"
 	math "math"
 	math_bits "math/bits"
+
+	proto "github.com/gogo/protobuf/proto"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.

+ 4 - 3
wormhole_chain/x/wormhole/types/tx.pb.go

@@ -6,14 +6,15 @@ package types
 import (
 	context "context"
 	fmt "fmt"
+	io "io"
+	math "math"
+	math_bits "math/bits"
+
 	grpc1 "github.com/gogo/protobuf/grpc"
 	proto "github.com/gogo/protobuf/proto"
 	grpc "google.golang.org/grpc"
 	codes "google.golang.org/grpc/codes"
 	status "google.golang.org/grpc/status"
-	io "io"
-	math "math"
-	math_bits "math/bits"
 )
 
 // Reference imports to suppress errors if they are not otherwise used.