Skip to content

Commit

Permalink
test other option
Browse files Browse the repository at this point in the history
  • Loading branch information
quasisamurai committed Mar 21, 2023
1 parent cbf4097 commit 999d7d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wasmbinding/bindings/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type RegisteredQuery struct {
// The local chain last block height when the query result was updated.
LastSubmittedResultLocalHeight uint64 `json:"last_submitted_result_local_height"`
// The remote chain last block height when the query result was updated.
LastSubmittedResultRemoteHeight *ibcclienttypes.Height `json:"last_submitted_result_remote_height"`
LastSubmittedResultRemoteHeight *ibcclienttypes.Height `json:"last_submitted_result_remote_height,omitempty"`
// Amount of coins deposited for the query.
Deposit sdktypes.Coins `json:"deposit"`
// Timeout before query becomes available for everybody to remove.
Expand Down
10 changes: 5 additions & 5 deletions x/interchainqueries/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ func (k Keeper) SaveQuery(ctx sdk.Context, query *types.RegisteredQuery) error {
// to avoid nil in neutron, null in json and rust marshalling errors, here we initialize it with "default" values
// where at lesat one of params is not equal 0 because github.com/cosmos/cosmos-sdk/codec/types skips true default values
// e.g. ibcclienttypes.NewHeight(0, 0) will be transformed into nil because of codec
emptyHeight := ibcclienttypes.NewHeight(0, 1)
if query.LastSubmittedResultRemoteHeight == nil {
query.LastSubmittedResultRemoteHeight = &emptyHeight
}
//emptyHeight := ibcclienttypes.NewHeight(0, 1)
//if query.LastSubmittedResultRemoteHeight == nil {
// query.LastSubmittedResultRemoteHeight = &emptyHeight
//}

bz, err := k.cdc.Marshal(query)
if err != nil {
Expand Down Expand Up @@ -299,7 +299,7 @@ func (k Keeper) updateLastLocalHeight(ctx sdk.Context, query *types.RegisteredQu

// checkLastRemoteHeight checks whether the given height is greater than the query's remote height
func (k Keeper) checkLastRemoteHeight(_ sdk.Context, query types.RegisteredQuery, height ibcclienttypes.Height) error {
if query.LastSubmittedResultRemoteHeight.GTE(height) {
if query.LastSubmittedResultRemoteHeight != nil && query.LastSubmittedResultRemoteHeight.GTE(height) {
return fmt.Errorf("result's remote height %d is less than or equal to last result's remote height %d", height, query.LastSubmittedResultRemoteHeight)
}
return nil
Expand Down

0 comments on commit 999d7d8

Please sign in to comment.