Skip to content

Commit

Permalink
remove spam from config
Browse files Browse the repository at this point in the history
  • Loading branch information
samliok committed Oct 11, 2024
1 parent e318824 commit 3e9bc00
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions cli/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (h *Handler) BuildSpammer(sh throughput.SpamHelper, defaults bool) (*throug
}

if defaults {
sc := throughput.DefaultSpamConfig(uris, key)
sc := throughput.NewDefaultConfig(uris, key)
return throughput.NewSpammer(sc, sh)
}
// Collect parameters
Expand Down Expand Up @@ -81,7 +81,7 @@ func (h *Handler) BuildSpammer(sh throughput.SpamHelper, defaults bool) (*throug
return nil, err
}

sc := throughput.NewSpamConfig(
sc := throughput.NewConfig(
uris,
key,
sZipf,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var _ = ginkgo.Describe("[HyperSDK Spam Workloads]", func() {
err := spamHelper.CreateClient(uris[0])
require.NoError(err)

spamConfig := throughput.DefaultSpamConfig(uris, key)
spamConfig := throughput.NewDefaultConfig(uris, key)
spammer, err := throughput.NewSpammer(spamConfig, spamHelper)
require.NoError(err)

Expand Down
14 changes: 7 additions & 7 deletions throughput/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package throughput

import "github.com/ava-labs/hypersdk/auth"

type SpamConfig struct {
type Config struct {
uris []string
key *auth.PrivateKey
sZipf float64
Expand All @@ -17,11 +17,11 @@ type SpamConfig struct {
numAccounts int
}

func DefaultSpamConfig(
func NewDefaultConfig(
uris []string,
key *auth.PrivateKey,
) *SpamConfig {
return &SpamConfig{
) *Config {
return &Config{
uris: uris,
key: key,
sZipf: 1.01,
Expand All @@ -34,7 +34,7 @@ func DefaultSpamConfig(
}
}

func NewSpamConfig(
func NewConfig(
uris []string,
key *auth.PrivateKey,
sZipf float64,
Expand All @@ -44,8 +44,8 @@ func NewSpamConfig(
txsPerSecondStep int,
numClients int,
numAccounts int,
) *SpamConfig {
return &SpamConfig{
) *Config {
return &Config{
uris,
key,
sZipf,
Expand Down
4 changes: 1 addition & 3 deletions throughput/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ type Spammer struct {
numAccounts int
}

func NewSpammer(sc *SpamConfig,
sh SpamHelper,
) (*Spammer, error) {
func NewSpammer(sc *Config, sh SpamHelper) (*Spammer, error) {
// Log Zipf participants
zipfSeed := rand.New(rand.NewSource(0)) //nolint:gosec
balance, err := sh.LookupBalance(sc.key.Address)
Expand Down

0 comments on commit 3e9bc00

Please sign in to comment.