Skip to content

Commit

Permalink
Merge branch 'ExocoreNetwork:develop' into fix/audit-issuses
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd authored Sep 30, 2024
2 parents f1429fc + dd6a144 commit e967b7e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
9 changes: 1 addition & 8 deletions cmd/exocored/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions x/delegation/keeper/delegation_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion x/operator/keeper/slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions x/operator/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e967b7e

Please sign in to comment.