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

chore(api!): mark MsgModuleQuerySafe requests field as non-nullable #6598

Merged
merged 17 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (apps/27-interchain-accounts) [\#6433](https://github.com/cosmos/ibc-go/pull/6433) Use UNORDERED as the default ordering for new ICA channels.
* (apps/transfer) [\#6440](https://github.com/cosmos/ibc-go/pull/6440) Remove `GetPrefixedDenom`.
* (apps/transfer) [\#6508](https://github.com/cosmos/ibc-go/pull/6508) Remove the `DenomTrace` type.
* (apps/27-interchain-accounts) [\#6598](https://github.com/cosmos/ibc-go/pull/6598) Mark the `requests` repeated field of `MsgModuleQuerySafe` non-nullable.
* (23-commmitment) [\#6633](https://github.com/cosmos/ibc-go/pull/6633) MerklePath has been changed to use `repeated bytes` in favour of `repeated strings`.

### State Machine Breaking
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/02-apps/02-interchain-accounts/05-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ balanceQuery := banktypes.NewQueryBalanceRequest("cosmos1...", "uatom")
queryBz, err := balanceQuery.Marshal()

// signer of message must be the interchain account on the host
queryMsg := icahosttypes.NewMsgModuleQuerySafe("cosmos2...", []*icahosttypes.QueryRequest{
queryMsg := icahosttypes.NewMsgModuleQuerySafe("cosmos2...", []icahosttypes.QueryRequest{
{
Path: "/cosmos.bank.v1beta1.Query/Balance",
Data: queryBz,
Expand Down
10 changes: 10 additions & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ func (k Keeper) RegisterInterchainAccount(
) error {
```

The `requests` repeated field of `MsgModuleQuerySafe` has been marked non-nullable, and therefore the signature of the constructor function `NewMsgModuleQuerySafe` has been updated:

```diff
func NewMsgModuleQuerySafe(
signer string,
- requests []*QueryRequest,
+ requests []QueryRequest,
) *MsgModuleQuerySafe {
```

## Relayers

- Renaming of event attribute keys in [#5603](https://github.com/cosmos/ibc-go/pull/5603).
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *InterchainAccountsQueryTestSuite) TestInterchainAccountsQuery() {
queryBz, err := balanceQuery.Marshal()
s.Require().NoError(err)

queryMsg := icahosttypes.NewMsgModuleQuerySafe(hostAccount, []*icahosttypes.QueryRequest{
queryMsg := icahosttypes.NewMsgModuleQuerySafe(hostAccount, []icahosttypes.QueryRequest{
{
Path: "/cosmos.bank.v1beta1.Query/Balance",
Data: queryBz,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (suite *KeeperTestSuite) TestModuleQuerySafe() {
Data: balanceQueryBz,
}

msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq})
msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []types.QueryRequest{queryReq})

balance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)

Expand Down Expand Up @@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestModuleQuerySafe() {
Data: paramsQueryBz,
}

msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq, &paramsQueryReq})
msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []types.QueryRequest{queryReq, paramsQueryReq})

balance := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), sdk.DefaultBondDenom)

Expand Down Expand Up @@ -102,7 +102,7 @@ func (suite *KeeperTestSuite) TestModuleQuerySafe() {
Data: paramsQueryBz,
}

msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq, &paramsQueryReq})
msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []types.QueryRequest{queryReq, paramsQueryReq})
},
ibcerrors.ErrInvalidRequest,
},
Expand All @@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) TestModuleQuerySafe() {
Data: balanceQueryBz,
}

msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []*types.QueryRequest{&queryReq})
msg = types.NewMsgModuleQuerySafe(suite.chainA.GetSimApp().ICAHostKeeper.GetAuthority(), []types.QueryRequest{queryReq})
},
ibcerrors.ErrInvalidRequest,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (suite *KeeperTestSuite) TestOnRecvPacket() {
queryBz, err := balanceQuery.Marshal()
suite.Require().NoError(err)

msg := types.NewMsgModuleQuerySafe(interchainAccountAddr, []*types.QueryRequest{
msg := types.NewMsgModuleQuerySafe(interchainAccountAddr, []types.QueryRequest{
{
Path: "/cosmos.bank.v1beta1.Query/Balance",
Data: queryBz,
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/host/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (msg MsgUpdateParams) ValidateBasic() error {
}

// NewMsgModuleQuerySafe creates a new MsgModuleQuerySafe instance
func NewMsgModuleQuerySafe(signer string, requests []*QueryRequest) *MsgModuleQuerySafe {
func NewMsgModuleQuerySafe(signer string, requests []QueryRequest) *MsgModuleQuerySafe {
return &MsgModuleQuerySafe{
Signer: signer,
Requests: requests,
Expand Down
10 changes: 5 additions & 5 deletions modules/apps/27-interchain-accounts/host/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestMsgUpdateParamsGetSigners(t *testing.T) {
}

func TestMsgModuleQuerySafeValidateBasic(t *testing.T) {
queryRequest := &types.QueryRequest{
queryRequest := types.QueryRequest{
Path: "/cosmos.bank.v1beta1.Query/Balance",
Data: []byte{},
}
Expand All @@ -89,17 +89,17 @@ func TestMsgModuleQuerySafeValidateBasic(t *testing.T) {
}{
{
"success: valid signer address",
types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []*types.QueryRequest{queryRequest}),
types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []types.QueryRequest{queryRequest}),
nil,
},
{
"failure: invalid signer address",
types.NewMsgModuleQuerySafe("signer", []*types.QueryRequest{queryRequest}),
types.NewMsgModuleQuerySafe("signer", []types.QueryRequest{queryRequest}),
ibcerrors.ErrInvalidAddress,
},
{
"failure: empty query requests",
types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []*types.QueryRequest{}),
types.NewMsgModuleQuerySafe(sdk.AccAddress(ibctesting.TestAccAddress).String(), []types.QueryRequest{}),
ibcerrors.ErrInvalidRequest,
},
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestMsgModuleQuerySafeGetSigners(t *testing.T) {
tc := tc

t.Run(tc.name, func(t *testing.T) {
msg := types.NewMsgModuleQuerySafe(tc.address.String(), []*types.QueryRequest{})
msg := types.NewMsgModuleQuerySafe(tc.address.String(), []types.QueryRequest{})
encodingCfg := moduletestutil.MakeTestEncodingConfig(ica.AppModuleBasic{})
signers, _, err := encodingCfg.Codec.GetMsgV1Signers(msg)
if tc.expPass {
Expand Down
60 changes: 30 additions & 30 deletions modules/apps/27-interchain-accounts/host/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ message MsgModuleQuerySafe {
string signer = 1;

// requests defines the module safe queries to execute.
repeated QueryRequest requests = 2;
repeated QueryRequest requests = 2 [(gogoproto.nullable) = false];
}

// MsgModuleQuerySafeResponse defines the response for Msg/ModuleQuerySafe
Expand Down
Loading