Skip to content

Commit

Permalink
feat: erc20 transfer in stress
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkAfCod committed Oct 31, 2024
1 parent 7dcafd6 commit d3fb414
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 49 deletions.
12 changes: 6 additions & 6 deletions cmd/replayor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func Main() cliapp.LifecycleAction {
logger.Info("client setup complete")

// Benchmark stats
s, err := stats.NewStorage(logger, cfg)
if err != nil {
return nil, err
}
logger.Info("storage setup complete")
//s, err := stats.NewStorage(logger, cfg)
//if err != nil {
// return nil, err
//}
//logger.Info("storage setup complete")

statsRecorder := stats.NewStoredStats(s, logger, cfg.BenchmarkStartBlock)
statsRecorder := stats.NewStoredStats(nil, logger, cfg.BenchmarkStartBlock)
logger.Info("stats recorder setup complete")

return replayor.NewService(c, statsRecorder, cfg, logger, close), nil
Expand Down
2 changes: 2 additions & 0 deletions packages/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type ReplayorConfig struct {
Bucket string
StorageType string
DiskPath string
InjectERC20 bool
}

func (r ReplayorConfig) TestDescription() string {
Expand Down Expand Up @@ -98,5 +99,6 @@ func LoadReplayorConfig(cliCtx *cli.Context, l log.Logger) (ReplayorConfig, erro
Bucket: cliCtx.String(S3Bucket.Name),
StorageType: cliCtx.String(StorageType.Name),
DiskPath: cliCtx.String(DiskPath.Name),
InjectERC20: cliCtx.Bool(InjectErc20.Name),
}, nil
}
6 changes: 6 additions & 0 deletions packages/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ var (
Required: false,
EnvVars: opservice.PrefixEnvVar(EnvVarPrefix, "DISK_PATH"),
}
InjectErc20 = &cli.BoolFlag{
Name: "inject-erc20-txs",
Usage: "whether to inject erc20 txs",
Required: false,
EnvVars: opservice.PrefixEnvVar(EnvVarPrefix, "INJECT_ERC20_TXS"),
}
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion packages/replayor/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *Service) Start(ctx context.Context) error {
}
r.log.Info("retrieved current block number", "blockNum", currentBlock.Number())

retry.Do(ctx, 720, retry.Fixed(10*time.Second), func() (bool, error) {
_, _ = retry.Do(ctx, 720, retry.Fixed(10*time.Second), func() (bool, error) {
result, err := r.clients.EngineApi.ForkchoiceUpdate(ctx, &eth.ForkchoiceState{
HeadBlockHash: currentBlock.Hash(),
SafeBlockHash: currentBlock.Hash(),
Expand Down
Loading

0 comments on commit d3fb414

Please sign in to comment.