Skip to content

Commit

Permalink
fix: cherry-pick fill ContractInfo result's Updated field (#89) (#93)
Browse files Browse the repository at this point in the history
* fix: fill ContractInfo result's Updated field (#89)

* fix: fill Updated in queryContractInfo result

Signed-off-by: 170210 <[email protected]>

* chore: add this PR to CHANGELOG

Signed-off-by: 170210 <[email protected]>

---------

Signed-off-by: 170210 <[email protected]>

* chore: fix CHANGELOG

Signed-off-by: 170210 <[email protected]>

---------

Signed-off-by: 170210 <[email protected]>
  • Loading branch information
170210 authored Aug 22, 2023
1 parent c581a5f commit 0d82921
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Bug Fixes
* [\#85](https://github.com/Finschia/wasmd/pull/85) cherry-pick fill ContractHistory querier result's Updated field (#62)
* [\#52](https://github.com/Finschia/wasmd/pull/52) fix cli_test error of wasmplus and add cli_test ci
* [\#93](https://github.com/Finschia/wasmd/pull/93) cherry-pick fill ContractInfo querier result's Updated field (#89)

### Breaking Changes

Expand Down
4 changes: 3 additions & 1 deletion x/wasm/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func (s *IntegrationTestSuite) TestGetCmdGetContractInfo() {

codeID, err := strconv.ParseUint(s.codeID, 10, 64)
s.Require().NoError(err)
s.Require().True(s.setupHeight > 0)
codeUpdateHeight := uint64(s.setupHeight)

testCases := map[string]struct {
args []string
Expand All @@ -158,7 +160,7 @@ func (s *IntegrationTestSuite) TestGetCmdGetContractInfo() {
Creator: val.Address.String(),
Admin: val.Address.String(),
Label: "TestContract",
Created: nil,
Created: &types.AbsoluteTxPosition{BlockHeight: codeUpdateHeight, TxIndex: 0},
IBCPortID: "",
Extension: nil,
},
Expand Down
2 changes: 0 additions & 2 deletions x/wasm/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ func queryContractInfo(ctx sdk.Context, addr sdk.AccAddress, keeper types.ViewKe
if info == nil {
return nil, types.ErrNotFound
}
// redact the Created field (just used for sorting, not part of public API)
info.Created = nil
return &types.QueryContractInfoResponse{
Address: addr.String(),
ContractInfo: *info,
Expand Down
12 changes: 4 additions & 8 deletions x/wasm/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,20 +619,16 @@ func TestQueryContractInfo(t *testing.T) {
src: &types.QueryContractInfoRequest{Address: contractAddr.String()},
stored: types.ContractInfoFixture(),
expRsp: &types.QueryContractInfoResponse{
Address: contractAddr.String(),
ContractInfo: types.ContractInfoFixture(func(info *types.ContractInfo) {
info.Created = nil // not returned on queries
}),
Address: contractAddr.String(),
ContractInfo: types.ContractInfoFixture(),
},
},
"with extension": {
src: &types.QueryContractInfoRequest{Address: contractAddr.String()},
stored: types.ContractInfoFixture(myExtension),
expRsp: &types.QueryContractInfoResponse{
Address: contractAddr.String(),
ContractInfo: types.ContractInfoFixture(myExtension, func(info *types.ContractInfo) {
info.Created = nil // not returned on queries
}),
Address: contractAddr.String(),
ContractInfo: types.ContractInfoFixture(myExtension),
},
},
"not found": {
Expand Down

0 comments on commit 0d82921

Please sign in to comment.