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

Make JSONMarshaler methods require proto.Message #7054

Merged
merged 27 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
97c59de
Make JSONMarshaler require proto.Message
blushi Aug 13, 2020
8f43ba6
Use &msg with MarshalJSON
blushi Aug 13, 2020
b6dd69b
Use *LegacyAmino in queriers instead of JSONMarshaler
blushi Aug 13, 2020
3af5055
Revert ABCIMessageLogs String() and coins tests
blushi Aug 13, 2020
282cc28
Use LegacyAmino in client/debug and fix subspace tests
blushi Aug 13, 2020
f572cd3
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 13, 2020
3f68d9a
Use LegacyAmino in all legacy queriers and adapt simulation
blushi Aug 14, 2020
8ed3b64
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 14, 2020
2d452d4
Make AminoCodec implement Marshaler and some godoc fixes
blushi Aug 14, 2020
fa96cfe
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ma…
aaronc Aug 17, 2020
28db5ea
Test fixes
aaronc Aug 17, 2020
2b65f5a
Remove unrelevant comment
blushi Aug 19, 2020
48103b9
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 19, 2020
b4da972
Use TxConfig.TxJSONEncoder
blushi Aug 19, 2020
ecc133a
Use encoding/json in genutil cli migrate/validate genesis cmds
blushi Aug 19, 2020
7e6d09d
Address simulation related comments
blushi Aug 19, 2020
abfdd22
Use JSONMarshaler in cli tests
blushi Aug 19, 2020
a3e394e
Use proto.Message as respType in cli tests
blushi Aug 20, 2020
e5f88e1
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 20, 2020
7665df4
Use tmjson for tm GenesisDoc
blushi Aug 24, 2020
8ab0066
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 24, 2020
12754cd
Update types/module/simulation.go
blushi Aug 25, 2020
17ea317
Update types/module/module_test.go
blushi Aug 25, 2020
4121810
Add godoc comments
blushi Aug 26, 2020
4aa1d08
Remove unused InsertKeyJSON
blushi Aug 26, 2020
5060ae3
Merge branch 'master' into marie/6982-json-marshaler-proto
blushi Aug 26, 2020
0cff5ca
Fix tests
blushi Aug 26, 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
10 changes: 7 additions & 3 deletions x/bank/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ func (s *IntegrationTestSuite) TestGetBalancesCmd() {
},
{
"total account balance of a bogus denom",
[]string{val.Address.String(), fmt.Sprintf("--%s=foobar", cli.FlagDenom), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
[]string{
val.Address.String(),
fmt.Sprintf("--%s=foobar", cli.FlagDenom),
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
&sdk.Coin{},
sdk.NewCoin("foobar", sdk.ZeroInt()),
Expand All @@ -108,7 +112,7 @@ func (s *IntegrationTestSuite) TestGetBalancesCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(val.ClientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType))
s.Require().NoError(val.ClientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)))
blushi marked this conversation as resolved.
Show resolved Hide resolved
s.Require().Equal(tc.expected.String(), tc.respType.String())
}
})
Expand Down Expand Up @@ -284,8 +288,8 @@ func (s *IntegrationTestSuite) TestNewSendTxCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(bz.Bytes(), tc.respType), bz.String())

s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(bz.Bytes(), tc.respType.(proto.Message)), bz.String())
txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
}
Expand Down
3 changes: 2 additions & 1 deletion x/crisis/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -95,7 +96,7 @@ func (s *IntegrationTestSuite) TestNewMsgVerifyInvariantTxCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
Expand Down
11 changes: 6 additions & 5 deletions x/distribution/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"
"time"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"
tmcli "github.com/tendermint/tendermint/libs/cli"

Expand Down Expand Up @@ -509,7 +510,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawRewardsCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(bz, tc.respType), string(bz))
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(bz, tc.respType.(proto.Message)), string(bz))

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
Expand Down Expand Up @@ -562,7 +563,7 @@ func (s *IntegrationTestSuite) TestNewWithdrawAllRewardsCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
Expand Down Expand Up @@ -617,7 +618,7 @@ func (s *IntegrationTestSuite) TestNewSetWithdrawAddrCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
Expand Down Expand Up @@ -672,7 +673,7 @@ func (s *IntegrationTestSuite) TestNewFundCommunityPoolCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code)
Expand Down Expand Up @@ -758,7 +759,7 @@ func (s *IntegrationTestSuite) TestGetCmdSubmitProposal() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
Expand Down
3 changes: 2 additions & 1 deletion x/gov/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"testing"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"

"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -140,7 +141,7 @@ func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())
txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
}
Expand Down
3 changes: 2 additions & 1 deletion x/slashing/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"testing"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"
tmcli "github.com/tendermint/tendermint/libs/cli"

Expand Down Expand Up @@ -174,7 +175,7 @@ func (s *IntegrationTestSuite) TestNewUnjailTxCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err)
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
Expand Down
4 changes: 3 additions & 1 deletion x/staking/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"fmt"
"testing"

"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/suite"

"github.com/tendermint/tendermint/crypto/ed25519"

"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -163,7 +165,7 @@ func (s *IntegrationTestSuite) TestNewCreateValidatorCmd() {
s.Require().Error(err)
} else {
s.Require().NoError(err, out.String())
s.Require().NoError(clientCtx.LegacyAmino.UnmarshalJSON(out.Bytes(), tc.respType), out.String())
s.Require().NoError(clientCtx.JSONMarshaler.UnmarshalJSON(out.Bytes(), tc.respType.(proto.Message)), out.String())

txResp := tc.respType.(*sdk.TxResponse)
s.Require().Equal(tc.expectedCode, txResp.Code, out.String())
Expand Down