Skip to content

Commit da89b18

Browse files
authored
feat: allow specifying num callers for simulator (#143)
This allows testing things like Block-STM where the number of callers affects performance. If we use a single caller, every transaction conflicts with the next transaction on the balance/nonce of the caller.
1 parent e5e19ab commit da89b18

File tree

4 files changed

+216
-39
lines changed

4 files changed

+216
-39
lines changed

runner/payload/factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package payload
22

33
import (
44
"context"
5-
"errors"
5+
"fmt"
66

77
clienttypes "github.com/base/base-bench/runner/clients/types"
88
benchtypes "github.com/base/base-bench/runner/network/types"
@@ -41,7 +41,7 @@ func NewPayloadWorker(ctx context.Context, log log.Logger, testConfig *benchtype
4141
worker, err = simulator.NewSimulatorPayloadWorker(
4242
ctx, log, sequencerClient.ClientURL(), params, privateKey, amount, &genesis, definition.Params)
4343
default:
44-
return nil, errors.New("invalid payload type")
44+
return nil, fmt.Errorf("invalid payload type: %s", definition.Type)
4545
}
4646

4747
return worker, err

runner/payload/simulator/simulatorstats/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ type StatsConfig struct {
131131
Opcodes *OpcodeStats `yaml:"opcodes"`
132132
Precompiles *OpcodeStats `yaml:"precompiles"`
133133
AvgGasUsed *float64 `yaml:"avg_gas_used"`
134+
// NumCallers is the number of caller accounts to distribute transactions across.
135+
// Defaults to 1 if not specified.
136+
NumCallers *int `yaml:"num_callers"`
134137
}
135138

136139
func (s *StatsConfig) ToStats() *Stats {

0 commit comments

Comments
 (0)