Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTrustyDev committed Sep 26, 2024
1 parent 2c3db77 commit 3d4f498
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions x/dymns/keeper/generic_reverse_lookup_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package keeper_test

import (
"crypto/rand"
"fmt"
"math/rand"
"math/big"
"sort"
"testing"

Expand Down Expand Up @@ -287,12 +288,16 @@ func Benchmark_GenericAddReverseLookupRecord(b *testing.B) {
codec := s.cdc

const elementsCount = 1_000_000
upperRand := new(big.Int).Exp(big.NewInt(10), big.NewInt(20), nil)

{

// prepare existing data
existingData := make([]string, elementsCount)
for e := 1; e <= elementsCount; e++ {
v := fmt.Sprintf("test%d", rand.Uint64())
bi, err := rand.Int(rand.Reader, upperRand)
require.NoError(b, err)
v := fmt.Sprintf("test%s", bi)
existingData = append(existingData, v)
}
bz := codec.MustMarshal(&dymnstypes.ReverseLookupDymNames{
Expand All @@ -303,8 +308,10 @@ func Benchmark_GenericAddReverseLookupRecord(b *testing.B) {

for r := 1; r <= b.N; r++ {
// add new element to force the most hardcore computation
v := fmt.Sprintf("test%d", rand.Uint64())
err := func() error {
bi, err := rand.Int(rand.Reader, upperRand)
require.NoError(b, err)
v := fmt.Sprintf("test%s", bi)
err = func() error {
b.StartTimer()
defer b.StopTimer()
return s.dymNsKeeper.GenericAddReverseLookupRecord(
Expand Down Expand Up @@ -342,12 +349,15 @@ func Benchmark_GenericRemoveReverseLookupRecord(b *testing.B) {
codec := s.cdc

const elementsCount = 1_000_000
upperRand := new(big.Int).Exp(big.NewInt(10), big.NewInt(20), nil)

{
// prepare existing data
existingData := make([]string, elementsCount)
for e := 1; e <= elementsCount; e++ {
v := fmt.Sprintf("test%d", rand.Uint64())
bi, err := rand.Int(rand.Reader, upperRand)
require.NoError(b, err)
v := fmt.Sprintf("test%s", bi)
existingData = append(existingData, v)
}
bz := codec.MustMarshal(&dymnstypes.ReverseLookupDymNames{
Expand Down

0 comments on commit 3d4f498

Please sign in to comment.