Skip to content

Commit

Permalink
update hex address format
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd committed Oct 31, 2024
1 parent ff21910 commit 8b3468f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions precompiles/avs/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"

errorsmod "cosmossdk.io/errors"

Expand Down Expand Up @@ -66,7 +67,7 @@ func (p Precompile) GetOptedInOperatorAccAddrs(
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 0, "string", addr)
}

list, err := p.avsKeeper.GetOperatorKeeper().GetOptedInOperatorListByAVS(ctx, addr.String())
list, err := p.avsKeeper.GetOperatorKeeper().GetOptedInOperatorListByAVS(ctx, strings.ToLower(addr.String()))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -115,7 +116,7 @@ func (p Precompile) GetOperatorOptedUSDValue(
if !ok {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 1, "string", operatorAddr)
}
amount, err := p.avsKeeper.GetOperatorKeeper().GetOperatorOptedUSDValue(ctx, avsAddr.String(), operatorAddr)
amount, err := p.avsKeeper.GetOperatorKeeper().GetOperatorOptedUSDValue(ctx, strings.ToLower(avsAddr.String()), operatorAddr)
if err != nil {
if errors.Is(err, avstype.ErrNoKeyInTheStore) {
return method.Outputs.Pack(common.Big0)
Expand Down
4 changes: 4 additions & 0 deletions precompiles/avs/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ func (p Precompile) OperatorSubmitTask(
}
resultParams.TaskResponse = taskResponse

if len(taskResponse) == 0 {
resultParams.TaskResponse = nil
}

blsSignature, ok := args[3].([]byte)
if !ok {
return nil, fmt.Errorf(exocmn.ErrContractInputParaOrType, 3, "[]byte", blsSignature)
Expand Down
7 changes: 4 additions & 3 deletions x/operator/keeper/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"fmt"
"strings"

errorsmod "cosmossdk.io/errors"

Expand Down Expand Up @@ -106,7 +107,7 @@ func (k *Keeper) HandleOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string,
return errorsmod.Wrap(err, "HandleOptedInfo: error occurred when parse acc address from Bech32")
}
store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo)
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, avsAddr)
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, strings.ToLower(avsAddr))
// get info from the store
value := store.Get(infoKey)
if value == nil {
Expand All @@ -130,7 +131,7 @@ func (k *Keeper) SetOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string, inf
if err != nil {
return assetstype.ErrInvalidOperatorAddr
}
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, avsAddr)
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, strings.ToLower(avsAddr))

bz := k.cdc.MustMarshal(info)
store.Set(infoKey, bz)
Expand All @@ -143,7 +144,7 @@ func (k *Keeper) GetOptedInfo(ctx sdk.Context, operatorAddr, avsAddr string) (in
return nil, errorsmod.Wrap(err, "GetOptedInfo: error occurred when parse acc address from Bech32")
}
store := prefix.NewStore(ctx.KVStore(k.storeKey), operatortypes.KeyPrefixOperatorOptedAVSInfo)
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, avsAddr)
infoKey := assetstype.GetJoinedStoreKey(operatorAddr, strings.ToLower(avsAddr))
value := store.Get(infoKey)
if value == nil {
return nil, errorsmod.Wrap(operatortypes.ErrNoKeyInTheStore, fmt.Sprintf("GetOptedInfo: operator is %s, avs address is %s", opAccAddr, avsAddr))
Expand Down

0 comments on commit 8b3468f

Please sign in to comment.