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

Update x/gov to use Any #6147

Merged
merged 52 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ce24456
Update x/gov to use Any
aaronc May 5, 2020
df49ab4
Fixes
aaronc May 5, 2020
51240fa
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 6, 2020
3e5a787
Remove MsgSubmitProposalLegacy
aaronc May 6, 2020
5264182
Update CHANGELOG.md
aaronc May 6, 2020
b2ca3a4
Add RegisterInterfaces for x/distribution, x/params, & x/upgrade
aaronc May 6, 2020
8dcfffb
Fix query JSON issue
aaronc May 7, 2020
42092cf
Fix gov tests
aaronc May 8, 2020
8ea6a44
Revert custom Any Equals
aaronc May 8, 2020
06056b3
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 8, 2020
7531d14
Re-remove types
aaronc May 8, 2020
ba6b151
Rename receivers
aaronc May 8, 2020
eab723e
Fix imports in gov
sahith-narahari May 11, 2020
3777926
Sort imports
sahith-narahari May 11, 2020
426c04f
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
sahith-narahari May 11, 2020
bf05676
Make amino JSON signing work with Any
aaronc May 14, 2020
a4a35df
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 14, 2020
519e1b9
Run proto-gen
aaronc May 14, 2020
84b4f63
Create full amino wrapper
aaronc May 14, 2020
5b2700c
Fix errors
aaronc May 14, 2020
06c2d03
Fixes
aaronc May 14, 2020
ad482e4
Fix tests
aaronc May 14, 2020
0ff09a4
Test fixes
aaronc May 14, 2020
7b632fa
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 14, 2020
33b04ff
Fix tests
aaronc May 14, 2020
72a89a1
Linting
aaronc May 14, 2020
f6fa2ba
Update ADR 019 and CHANGELOG
aaronc May 15, 2020
f3dbd90
Updated ADR 019
aaronc May 15, 2020
8a53536
Extract Marshal/UnmarshalProposal
aaronc May 15, 2020
5d63dd6
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 15, 2020
e5c90d2
fix error
aaronc May 15, 2020
ccf589a
lint
aaronc May 15, 2020
ba93a7e
linting
aaronc May 15, 2020
065f051
linting
aaronc May 15, 2020
3915704
Update client/keys/parse.go
aaronc May 15, 2020
83bfba7
linting
aaronc May 15, 2020
4836ffb
Merge branch 'master' into aaronc/x-gov-proto-any
alexanderbez May 16, 2020
fa169dc
Update docs/architecture/adr-019-protobuf-state-encoding.md
aaronc May 18, 2020
50d4b36
Update docs/architecture/adr-019-protobuf-state-encoding.md
aaronc May 18, 2020
34141d8
Address review feedback
aaronc May 18, 2020
63561a8
Add godocs
aaronc May 18, 2020
600ac6a
Merge branch 'master' into aaronc/x-gov-proto-any
aaronc May 18, 2020
22d8af7
Fix errors
aaronc May 18, 2020
5d289e1
Merge remote-tracking branch 'origin/aaronc/x-gov-proto-any' into aar…
aaronc May 18, 2020
a005332
fix errors
aaronc May 18, 2020
c1bad36
revert file
aaronc May 18, 2020
b58c42a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into aaronc/x-g…
aaronc May 19, 2020
c09e298
Address review feedback
aaronc May 19, 2020
0e159e7
Address review feedback
aaronc May 19, 2020
5ed861d
Stacktrace debug flag
aaronc May 19, 2020
2e14d48
Fix tests
aaronc May 19, 2020
72ead83
Address review feedback
aaronc May 19, 2020
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
Prev Previous commit
Next Next commit
Linting
  • Loading branch information
aaronc committed May 14, 2020
commit 72a89a1f3bc977b9b96e7686d783286c46dbe965
4 changes: 0 additions & 4 deletions client/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ func (ctx CLIContext) WithMarshaler(m codec.Marshaler) CLIContext {
// TODO: Deprecated (remove).
func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext {
ctx.Codec = cdc
// Marshaler is set here for backwards compatibility with amino-only code
if ctx.Marshaler == nil {
ctx.Marshaler = codec.NewAminoCodec(cdc)
}
return ctx
}

Expand Down
3 changes: 2 additions & 1 deletion codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ func init() {
Cdc = cdc.Seal()
}

// Codec defines a type alias for an Amino codec.
// Codec defines a wrapper for an Amino codec that properly handles protobuf
// types with Any's
type Codec struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be deprecated in the future in favor of AminoCodec? are there any difference between the 2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the ADR updates in this PR I noted that we would rename this to LegacyAmino. It is more or less deprecated. The difference between the two is that Marshaler expects types that implement ProtoMarshaler (i.e. generated by protoc). So any code using Marshaler is more or less ensured to be proto compatible. This legacy Codec is pure amino.

Amino *amino.Codec
}
Expand Down
2 changes: 1 addition & 1 deletion codec/amino_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type AminoCodec struct {
var _ Marshaler = &AminoCodec{}

func NewAminoCodec(Codec *Codec) *AminoCodec {
return &AminoCodec{Codec}
return &AminoCodec{Codec: Codec}
}

func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) {
Expand Down
3 changes: 1 addition & 2 deletions types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import (
"math"
"strings"

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

yaml "gopkg.in/yaml.v2"

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

ctypes "github.com/tendermint/tendermint/rpc/core/types"
)
Expand Down
3 changes: 1 addition & 2 deletions x/auth/client/cli/broadcast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"path/filepath"
"testing"

"github.com/cosmos/cosmos-sdk/codec"

"github.com/spf13/viper"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/tests"
)

Expand Down
2 changes: 1 addition & 1 deletion x/bank/keeper/invariants.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant {
// TotalSupply checks that the total supply reflects all the coins held in accounts
func TotalSupply(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
var expectedTotal sdk.Coins = []sdk.Coin{}
expectedTotal := []sdk.Coin{}
supply := k.GetSupply(ctx)

k.IterateAllBalances(ctx, func(_ sdk.AccAddress, balance sdk.Coin) bool {
Expand Down
2 changes: 1 addition & 1 deletion x/gov/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
}

// RegisterProposalTypeCodec registers an external proposal content type defined
// in another module for the internal ModuleCdc. This allows the MsgSubmitProposalLegacy
// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal
// to be correctly Amino encoded and decoded.
//
// NOTE: This should only be used for applications that are still using a concrete
Expand Down
1 change: 0 additions & 1 deletion x/gov/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"

"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/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var _ MsgSubmitProposalI = &MsgSubmitProposal{}
var _ types.UnpackInterfacesMessage = MsgSubmitProposal{}

// MsgSubmitProposalI defines the specific interface a concrete message must
// implement in order to process governance proposals. The concrete MsgSubmitProposalLegacy
// implement in order to process governance proposals. The concrete MsgSubmitProposal
// must be defined at the application-level.
type MsgSubmitProposalI interface {
sdk.Msg
Expand Down