Skip to content

Commit

Permalink
fix: String representation of escrow address (#238)
Browse files Browse the repository at this point in the history
* greedy approach to lane verification

* docs

* base lane testing

* mev lane testing nits

* abci top level testing done

* network spamming in E2E

* string rep of escrow address

* nit

* removing logs from testing

* query test

(cherry picked from commit 736b2d3)
  • Loading branch information
davidterpay authored and mergify[bot] committed Nov 27, 2023
1 parent 04af740 commit aeebe61
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 24 deletions.
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() {

Check failure on line 10 in x/auction/keeper/grpc_query_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.Run undefined (type *KeeperTestSuite has no field or method Run) (typecheck)
params, err := s.auctionkeeper.GetParams(s.ctx)
s.Require().NoError(err)

Check failure on line 12 in x/auction/keeper/grpc_query_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.Require undefined (type *KeeperTestSuite has no field or method Require) (typecheck)

escrowAddress := sdk.AccAddress(params.EscrowAccountAddress)

res, err := s.queryServer.Params(s.ctx, &types.QueryParamsRequest{})
s.Require().NoError(err)

Check failure on line 17 in x/auction/keeper/grpc_query_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.Require undefined (type *KeeperTestSuite has no field or method Require) (typecheck)
s.Require().Equal(params, res.Params)

Check failure on line 18 in x/auction/keeper/grpc_query_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.Require undefined (type *KeeperTestSuite has no field or method Require) (typecheck)
s.Require().Equal(escrowAddress.String(), res.EscrowAddressString)

Check failure on line 19 in x/auction/keeper/grpc_query_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

s.Require undefined (type *KeeperTestSuite has no field or method Require) (typecheck)
})
}
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.

0 comments on commit aeebe61

Please sign in to comment.