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

refactor: Implementing sigs.k8s.io YAML to remove .proto yaml annotations #9780

Merged
merged 42 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c1de062
Implementing sigs.k8s.io YAML fork
lukerhoads Jul 27, 2021
47c4f27
Removed unnecessary YAML annotations from moduleAccountPretty
lukerhoads Jul 27, 2021
7b15587
Removed unecessary YAML annotations from vestingAccountYAML
lukerhoads Jul 27, 2021
ebf6215
Merge branch 'cosmos:master' into lukerhoads/remote-yaml-annotations
lukerhoads Jul 27, 2021
0c75cad
Replaced usage of yaml.v2 with new one
lukerhoads Jul 30, 2021
d30726f
Merge branch 'master' into lukerhoads/remote-yaml-annotations
lukerhoads Jul 30, 2021
985390d
Fully removed usage of gopkg yaml
lukerhoads Jul 30, 2021
c902d70
Removed all protobuf moretag annotations
lukerhoads Jul 30, 2021
3a33260
Merge branch 'master' into lukerhoads/remote-yaml-annotations
lukerhoads Aug 1, 2021
5dd48e3
Resolve unused problem
lukerhoads Aug 1, 2021
9f4a035
Merge branch 'cosmos:master' into lukerhoads/remote-yaml-annotations
lukerhoads Aug 3, 2021
5f7839d
Merged master
lukerhoads Aug 9, 2021
ba76ca3
Regenned proto files
lukerhoads Aug 9, 2021
5bd7cb7
Updated CHANGELOG
lukerhoads Aug 9, 2021
9879240
Merge branch 'lukerhoads/remote-yaml-annotations' of https://github.c…
lukerhoads Aug 9, 2021
916c732
Reverted formatting changes
lukerhoads Aug 9, 2021
739a6eb
Regenerated proto files
lukerhoads Aug 9, 2021
f97a9b3
Merged master
lukerhoads Aug 9, 2021
5a15c04
Merged and resolved conflict
lukerhoads Aug 9, 2021
c70a939
Fixed newline formatting for changelog
lukerhoads Aug 9, 2021
8b30a16
Merged master
lukerhoads Sep 1, 2021
65578ae
Removed old yaml dep in go.mod
lukerhoads Sep 1, 2021
8fe0f1f
Fixed most tests
lukerhoads Sep 2, 2021
66468aa
Merge branch 'cosmos:master' into lukerhoads/remote-yaml-annotations
lukerhoads Sep 3, 2021
60f5061
Fixed other straightforward testing errors
lukerhoads Sep 3, 2021
4d288c9
Merge master
lukerhoads Sep 15, 2021
3b0d402
Removed last yaml tags, modified param test cases
lukerhoads Sep 15, 2021
91a91cb
Changed tests to directly call StdSignature marshalYAML as sigs.k8s.i…
lukerhoads Sep 16, 2021
fcec039
Fixed no new var build error
lukerhoads Sep 16, 2021
fbfe8f0
Added CLI breaking change in CHANGELOG
lukerhoads Sep 17, 2021
631d648
Merged master
lukerhoads Sep 17, 2021
bca0f70
Fix build error in bank types
lukerhoads Sep 17, 2021
4814390
Update CHANGELOG.md
amaury1093 Sep 17, 2021
75e97ee
go mod tidy
lukerhoads Sep 17, 2021
425c522
Merge branch 'lukerhoads/remote-yaml-annotations' of https://github.c…
lukerhoads Sep 17, 2021
3e83faa
Revert "go mod tidy"
lukerhoads Sep 17, 2021
9cc5706
Fix merge conflicts
lukerhoads Sep 18, 2021
0ace588
Fix param unit tests
lukerhoads Sep 18, 2021
64bd40c
Merge branch 'master' into lukerhoads/remote-yaml-annotations
lukerhoads Sep 23, 2021
d572a72
Resolve merge conflicts
lukerhoads Sep 23, 2021
a1d5263
Go mod tidy
lukerhoads Sep 24, 2021
a20180d
Merge branch 'master' into lukerhoads/remote-yaml-annotations
amaury1093 Sep 24, 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
2 changes: 1 addition & 1 deletion client/keys/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/bech32"
Expand Down
2 changes: 1 addition & 1 deletion client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"path/filepath"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

cryptokeyring "github.com/cosmos/cosmos-sdk/crypto/keyring"
)
Expand Down
13 changes: 2 additions & 11 deletions codec/yaml.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package codec

import (
"encoding/json"

"github.com/gogo/protobuf/proto"
"gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"
)

// MarshalYAML marshals toPrint using JSONCodec to leverage specialized MarshalJSON methods
Expand All @@ -18,12 +16,5 @@ func MarshalYAML(cdc JSONCodec, toPrint proto.Message) ([]byte, error) {
return nil, err
}

// generate YAML by decoding JSON and re-encoding to YAML
var j interface{}
err = json.Unmarshal(bz, &j)
if err != nil {
return nil, err
}

return yaml.Marshal(j)
return yaml.JSONToYAML(bz)
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ require (
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
nhooyr.io/websocket v1.8.6 // indirect
sigs.k8s.io/yaml v1.2.0
)

replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1240,4 +1240,6 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
2 changes: 1 addition & 1 deletion server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/tendermint/tendermint/p2p"
pvm "github.com/tendermint/tendermint/privval"
tversion "github.com/tendermint/tendermint/version"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/client"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
Expand Down
7 changes: 4 additions & 3 deletions types/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/hashicorp/golang-lru/simplelru"
yaml "gopkg.in/yaml.v2"
sigsyaml "sigs.k8s.io/yaml"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/internal/conv"
Expand Down Expand Up @@ -237,7 +238,7 @@ func (aa *AccAddress) UnmarshalJSON(data []byte) error {
// UnmarshalYAML unmarshals from JSON assuming Bech32 encoding.
func (aa *AccAddress) UnmarshalYAML(data []byte) error {
var s string
err := yaml.Unmarshal(data, &s)
err := sigsyaml.Unmarshal(data, &s)
if err != nil {
return err
}
Expand Down Expand Up @@ -387,7 +388,7 @@ func (va *ValAddress) UnmarshalJSON(data []byte) error {
func (va *ValAddress) UnmarshalYAML(data []byte) error {
var s string

err := yaml.Unmarshal(data, &s)
err := sigsyaml.Unmarshal(data, &s)
if err != nil {
return err
}
Expand Down Expand Up @@ -542,7 +543,7 @@ func (ca *ConsAddress) UnmarshalJSON(data []byte) error {
func (ca *ConsAddress) UnmarshalYAML(data []byte) error {
var s string

err := yaml.Unmarshal(data, &s)
err := sigsyaml.Unmarshal(data, &s)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/gogo/protobuf/proto"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

abci "github.com/tendermint/tendermint/abci/types"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
Expand Down
2 changes: 1 addition & 1 deletion version/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/spf13/cobra"
"github.com/tendermint/tendermint/libs/cli"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"
)

const flagLong = "long"
Expand Down
2 changes: 1 addition & 1 deletion x/auth/migrations/legacytx/stdsig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/testutil/testdata"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
Expand Down
14 changes: 7 additions & 7 deletions x/auth/types/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/gogo/protobuf/proto"
"github.com/tendermint/tendermint/crypto"
"gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
Expand Down Expand Up @@ -237,12 +237,12 @@ func (ma ModuleAccount) Validate() error {
}

type moduleAccountPretty struct {
Address sdk.AccAddress `json:"address" yaml:"address"`
PubKey string `json:"public_key" yaml:"public_key"`
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
Sequence uint64 `json:"sequence" yaml:"sequence"`
Name string `json:"name" yaml:"name"`
Permissions []string `json:"permissions" yaml:"permissions"`
Address sdk.AccAddress `json:"address"`
PubKey string `json:"public_key"`
AccountNumber uint64 `json:"account_number"`
Sequence uint64 `json:"sequence"`
Name string `json:"name"`
Permissions []string `json:"permissions"`
}

func (ma ModuleAccount) String() string {
Expand Down
2 changes: 1 addition & 1 deletion x/auth/types/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/require"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
Expand Down
2 changes: 1 addition & 1 deletion x/auth/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"fmt"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/auth/vesting/types/period.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"
)

// Periods stores all vesting periods passed as part of a PeriodicVestingAccount
Expand Down
22 changes: 11 additions & 11 deletions x/auth/vesting/types/vesting_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -162,18 +162,18 @@ func (bva BaseVestingAccount) Validate() error {
}

type vestingAccountYAML struct {
ruhatch marked this conversation as resolved.
Show resolved Hide resolved
Address sdk.AccAddress `json:"address" yaml:"address"`
PubKey string `json:"public_key" yaml:"public_key"`
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
Sequence uint64 `json:"sequence" yaml:"sequence"`
OriginalVesting sdk.Coins `json:"original_vesting" yaml:"original_vesting"`
DelegatedFree sdk.Coins `json:"delegated_free" yaml:"delegated_free"`
DelegatedVesting sdk.Coins `json:"delegated_vesting" yaml:"delegated_vesting"`
EndTime int64 `json:"end_time" yaml:"end_time"`
Address sdk.AccAddress `json:"address"`
PubKey string `json:"public_key"`
AccountNumber uint64 `json:"account_number"`
Sequence uint64 `json:"sequence"`
OriginalVesting sdk.Coins `json:"original_vesting"`
DelegatedFree sdk.Coins `json:"delegated_free"`
DelegatedVesting sdk.Coins `json:"delegated_vesting"`
EndTime int64 `json:"end_time"`

// custom fields based on concrete vesting type which can be omitted
StartTime int64 `json:"start_time,omitempty" yaml:"start_time,omitempty"`
VestingPeriods Periods `json:"vesting_periods,omitempty" yaml:"vesting_periods,omitempty"`
StartTime int64 `json:"start_time,omitempty"`
VestingPeriods Periods `json:"vesting_periods,omitempty"`
}

func (bva BaseVestingAccount) String() string {
Expand Down
2 changes: 1 addition & 1 deletion x/bank/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"fmt"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down
2 changes: 1 addition & 1 deletion x/capability/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"sort"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion x/distribution/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"fmt"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"fmt"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"fmt"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/gogo/protobuf/proto"

Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/gogo/protobuf/proto"
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/tally.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package types

import (
yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/mint/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
Expand Down
2 changes: 1 addition & 1 deletion x/params/types/proposal/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"strings"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/staking/migrations/v040/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/commission.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package types
import (
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

sdk "github.com/cosmos/cosmos-sdk/types"
)
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

yaml "gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down