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

fix: String representation of escrow address (backport #238) #243

Merged
merged 1 commit into from
Nov 28, 2023
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
5 changes: 4 additions & 1 deletion proto/sdk/auction/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
// params defines the parameters of the module.
// Params defines the parameters of the module.
Params params = 1 [ (gogoproto.nullable) = false ];
// EscrowAddressString is the string representation of the escrow address stored
// in params.
string escrow_address_string = 2;
}
3 changes: 2 additions & 1 deletion x/auction/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ func (q QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*ty
return nil, err
}

return &types.QueryParamsResponse{Params: params}, nil
escrowAddress := sdk.AccAddress(params.EscrowAccountAddress)
return &types.QueryParamsResponse{Params: params, EscrowAddressString: escrowAddress.String()}, nil
}
21 changes: 21 additions & 0 deletions x/auction/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package keeper_test

import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/skip-mev/block-sdk/x/auction/types"
)

func (s *KeeperTestSuite) TestQueryParams() {
s.Run("can query module params", func() {
params, err := s.auctionkeeper.GetParams(s.ctx)
s.Require().NoError(err)

escrowAddress := sdk.AccAddress(params.EscrowAccountAddress)

res, err := s.queryServer.Params(s.ctx, &types.QueryParamsRequest{})
s.Require().NoError(err)
s.Require().Equal(params, res.Params)
s.Require().Equal(escrowAddress.String(), res.EscrowAddressString)
})
}
5 changes: 4 additions & 1 deletion x/auction/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ type KeeperTestSuite struct {
stakingKeeper *mocks.StakingKeeper
encCfg testutils.EncodingConfig
ctx sdk.Context
msgServer types.MsgServer
key *storetypes.KVStoreKey
authorityAccount sdk.AccAddress

msgServer types.MsgServer
queryServer types.QueryServer
}

func TestKeeperTestSuite(t *testing.T) {
Expand Down Expand Up @@ -61,4 +63,5 @@ func (s *KeeperTestSuite) SetupTest() {
s.Require().NoError(err)

s.msgServer = keeper.NewMsgServerImpl(s.auctionkeeper)
s.queryServer = keeper.NewQueryServer(s.auctionkeeper)
}
98 changes: 77 additions & 21 deletions x/auction/types/query.pb.go

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

Loading