Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion types/mempool/sender_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"math/rand" // #nosec // math/rand is used for random selection and seeded from crypto/rand
"slices"
"sync"

"github.com/huandu/skiplist"
Expand Down Expand Up @@ -307,5 +308,5 @@ func (i *senderNonceMempoolIterator) Tx() sdk.Tx {
}

func removeAtIndex[T any](slice []T, index int) []T {
return append(slice[:index], slice[index+1:]...)
return slices.Delete(slice, index, index+1)
}
5 changes: 3 additions & 2 deletions x/staking/types/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"encoding/json"
"slices"
"strings"
"time"

Expand Down Expand Up @@ -159,7 +160,7 @@ func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time

// RemoveEntry - remove entry at index i to the unbonding delegation
func (ubd *UnbondingDelegation) RemoveEntry(i int64) {
ubd.Entries = append(ubd.Entries[:i], ubd.Entries[i+1:]...)
ubd.Entries = slices.Delete(ubd.Entries, int(i), int(i+1))
}

// return the unbonding delegation
Expand Down Expand Up @@ -251,7 +252,7 @@ func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balan

// RemoveEntry - remove entry at index i to the unbonding delegation
func (red *Redelegation) RemoveEntry(i int64) {
red.Entries = append(red.Entries[:i], red.Entries[i+1:]...)
red.Entries = slices.Delete(red.Entries, int(i), int(i+1))
}

// MustMarshalRED returns the Redelegation bytes. Panics if fails.
Expand Down
Loading