Skip to content

Commit

Permalink
fix parse error 2
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinssgh committed Oct 10, 2023
1 parent 35505a8 commit 24b3f84
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 133 deletions.
4 changes: 2 additions & 2 deletions proto/observer/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ message QueryAllBlameRecordsResponse {
}

message QueryBlameByChainAndNonceRequest {
uint32 chain_id = 1;
uint64 nonce = 2;
int64 chain_id = 1;
int64 nonce = 2;
}

message QueryBlameByChainAndNonceResponse {
Expand Down
9 changes: 5 additions & 4 deletions x/observer/client/cli/query_blame.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/observer/types"
"strconv"
)

func CmdBlameByIdentifier() *cobra.Command {
Expand Down Expand Up @@ -87,16 +88,16 @@ func CmdGetBlameByChainAndNonce() *cobra.Command {

queryClient := types.NewQueryClient(clientCtx)

chain, err := strconv.ParseUint(chainId, 10, 32)
chain, err := strconv.ParseInt(chainId, 10, 64)
if err != nil {
return err
}
nonceInt, err := strconv.ParseUint(nonce, 10, 64)
nonceInt, err := strconv.ParseInt(nonce, 10, 64)
if err != nil {
return err
}
params := &types.QueryBlameByChainAndNonceRequest{
ChainId: uint32(chain),
ChainId: chain,
Nonce: nonceInt,
}

Expand Down
3 changes: 2 additions & 1 deletion x/observer/keeper/blame.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"context"
"fmt"

"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/zeta-chain/zetacore/x/observer/types"
Expand Down Expand Up @@ -40,7 +41,7 @@ func (k Keeper) GetAllBlame(ctx sdk.Context) (BlameRecords []*types.Blame, found
return
}

func (k Keeper) GetBlameByChainAndNonce(ctx sdk.Context, chainID uint32, nonce uint64) (BlameRecords []*types.Blame, found bool) {
func (k Keeper) GetBlameByChainAndNonce(ctx sdk.Context, chainID int64, nonce int64) (BlameRecords []*types.Blame, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlameKey))
blamePrefix := fmt.Sprintf("%d-%d", chainID, nonce)
iterator := sdk.KVStorePrefixIterator(store, []byte(blamePrefix))
Expand Down
7 changes: 4 additions & 3 deletions x/observer/keeper/blame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package keeper

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/zeta-chain/zetacore/x/observer/types"
"testing"
)

func TestKeeper_BlameByIdentifier(t *testing.T) {
Expand All @@ -29,8 +30,8 @@ func TestKeeper_BlameByIdentifier(t *testing.T) {

func TestKeeper_BlameByChainAndNonce(t *testing.T) {
keeper, ctx := SetupKeeper(t)
var chainId uint32 = 97
var nonce uint64 = 101
var chainId int64 = 97
var nonce int64 = 101
digest := "85f5e10431f69bc2a14046a13aabaefc660103b6de7a84f75c4b96181d03f0b5"

index := fmt.Sprintf("%d-%d-%s-%d", chainId, nonce, digest, 123)
Expand Down
Loading

0 comments on commit 24b3f84

Please sign in to comment.