diff --git a/cmd/exocored/init.go b/cmd/exocored/init.go index 65b374c0b..c0be6c652 100644 --- a/cmd/exocored/init.go +++ b/cmd/exocored/init.go @@ -6,7 +6,6 @@ import ( "fmt" "os" "path/filepath" - "strings" "time" "github.com/pkg/errors" @@ -81,13 +80,7 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { config.P2P.MaxNumInboundPeers = 240 config.P2P.MaxNumOutboundPeers = 30 - // Set default seeds - seeds := []string{ - "40f4fac63da8b1ce8f850b0fa0f79b2699d2ce72@seed.evmos.jerrychong.com:26656", // jerrychong - "e3e11fca4ecf4035a751f3fea90e3a821e274487@bd-evmos-mainnet-seed-node-01.bdnodes.net:26656", // blockdaemon - "fc86e7e75c5d2e4699535e1b1bec98ae55b16826@bd-evmos-mainnet-seed-node-02.bdnodes.net:26656", // blockdaemon - } - config.P2P.Seeds = strings.Join(seeds, ",") + // TODO: hardcode any seeds here config.Mempool.Size = 10000 config.StateSync.TrustPeriod = 112 * time.Hour diff --git a/x/delegation/keeper/delegation_state.go b/x/delegation/keeper/delegation_state.go index d563b73d8..d407f3c37 100644 --- a/x/delegation/keeper/delegation_state.go +++ b/x/delegation/keeper/delegation_state.go @@ -252,6 +252,12 @@ func (k *Keeper) DeleteStakersListForOperator(ctx sdk.Context, operator, assetID return nil } +func (k Keeper) HasStakerList(ctx sdk.Context, operator, assetID string) bool { + store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixStakersByOperator) + Key := assetstype.GetJoinedStoreKey(operator, assetID) + return store.Has(Key) +} + func (k Keeper) GetStakersByOperator(ctx sdk.Context, operator, assetID string) (delegationtype.StakerList, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixStakersByOperator) Key := assetstype.GetJoinedStoreKey(operator, assetID) diff --git a/x/operator/keeper/slash.go b/x/operator/keeper/slash.go index 89cfc6594..f2c17abef 100644 --- a/x/operator/keeper/slash.go +++ b/x/operator/keeper/slash.go @@ -117,7 +117,8 @@ func (k *Keeper) SlashAssets(ctx sdk.Context, parameter *types.SlashInputInfo) ( // all shares need to be cleared if the asset amount is slashed to zero, // otherwise there will be a problem in updating the shares when handling // the new delegations. - if remainingAmount.IsZero() { + if remainingAmount.IsZero() && + k.delegationKeeper.HasStakerList(ctx, parameter.Operator.String(), assetID) { // clear the share of other stakers stakerList, err := k.delegationKeeper.GetStakersByOperator(ctx, parameter.Operator.String(), assetID) if err != nil { diff --git a/x/operator/types/expected_keepers.go b/x/operator/types/expected_keepers.go index f17ff26dc..90044ccd1 100644 --- a/x/operator/types/expected_keepers.go +++ b/x/operator/types/expected_keepers.go @@ -33,6 +33,7 @@ type DelegationKeeper interface { IterateUndelegationsByOperator( ctx sdk.Context, operator string, heightFilter *uint64, isUpdate bool, opFunc func(undelegation *delegationtype.UndelegationRecord) error) error + HasStakerList(ctx sdk.Context, operator, assetID string) bool GetStakersByOperator( ctx sdk.Context, operator, assetID string, ) (delegationtype.StakerList, error)