Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Aug 8, 2023
1 parent ac7dbd1 commit f08924c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 23 deletions.
2 changes: 1 addition & 1 deletion x/challenge/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func EndBlocker(ctx sdk.Context, keeper k.Keeper) {
if !found {
continue
}
if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING && sp.Status != sptypes.STATUS_IN_MAINTENANCE {
if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion x/challenge/keeper/msg_server_submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (k msgServer) Submit(goCtx context.Context, msg *types.MsgSubmit) (*types.M
return nil, types.ErrUnknownBucketObject
}
sp := k.StorageKeeper.MustGetPrimarySPForBucket(ctx, bucketInfo)
if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING && sp.Status != sptypes.STATUS_IN_MAINTENANCE {
if sp.Status != sptypes.STATUS_IN_SERVICE && sp.Status != sptypes.STATUS_GRACEFUL_EXITING {
return nil, types.ErrInvalidSpStatus
}

Expand Down
17 changes: 0 additions & 17 deletions x/sp/keeper/sp.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@ func (k Keeper) GetStorageProviderByGcAddr(ctx sdk.Context, gcAddr sdk.AccAddres
return k.GetStorageProvider(ctx, k.spSequence.DecodeSequence(id))
}

func (k Keeper) GetStorageProviderByTestAddr(ctx sdk.Context, testAddr sdk.AccAddress) (sp *types.StorageProvider, found bool) {
store := ctx.KVStore(k.storeKey)

id := store.Get(types.GetStorageProviderByTestAddrKey(testAddr))
if id == nil {
return sp, false
}

return k.GetStorageProvider(ctx, k.spSequence.DecodeSequence(id))
}

func (k Keeper) SetStorageProvider(ctx sdk.Context, sp *types.StorageProvider) {
store := ctx.KVStore(k.storeKey)
bz := types.MustMarshalStorageProvider(k.cdc, sp)
Expand Down Expand Up @@ -131,12 +120,6 @@ func (k Keeper) SetStorageProviderByGcAddr(ctx sdk.Context, sp *types.StoragePro
store.Set(types.GetStorageProviderByGcAddrKey(gcAddr), k.spSequence.EncodeSequence(sp.Id))
}

func (k Keeper) SetStorageProviderByTestAddr(ctx sdk.Context, sp *types.StorageProvider) {
testAddr := sp.GetTestAccAddress()
store := ctx.KVStore(k.storeKey)
store.Set(types.GetStorageProviderByTestAddrKey(testAddr), k.spSequence.EncodeSequence(sp.Id))
}

func (k Keeper) GetAllStorageProviders(ctx sdk.Context) (sps []types.StorageProvider) {
store := ctx.KVStore(k.storeKey)

Expand Down
4 changes: 0 additions & 4 deletions x/storage/keeper/virtualgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"cosmossdk.io/math"
sptypes "github.com/bnb-chain/greenfield/x/sp/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/prysmaticlabs/prysm/crypto/bls"

Expand Down Expand Up @@ -123,9 +122,6 @@ func (k Keeper) VerifyGVGSecondarySPsBlsSignature(ctx sdk.Context, gvg *vgtypes.
if !found {
panic("should not happen")
}
if secondarySp.Status != sptypes.STATUS_IN_SERVICE {
return sptypes.ErrStorageProviderNotInService
}
spBlsPubKey, err := bls.PublicKeyFromBytes(secondarySp.BlsKey)
if err != nil {
return types.ErrInvalidBlsPubKey.Wrapf("BLS public key converts failed: %v", err)
Expand Down

0 comments on commit f08924c

Please sign in to comment.