66 "time"
77
88 "github.com/sirupsen/logrus"
9- "github.com/yu-org/yu/core/startup"
109 "golang.org/x/time/rate"
1110
1211 "github.com/reddio-com/reddio/evm"
@@ -15,9 +14,8 @@ import (
1514)
1615
1716var (
18- configPath string
17+ dataPath string
1918 evmConfigPath string
20- maxBlock int
2119 qps int
2220 action string
2321 duration time.Duration
@@ -28,33 +26,26 @@ var (
2826)
2927
3028func init () {
31- flag .StringVar (& configPath , "configPath " , "" , "" )
29+ flag .StringVar (& dataPath , "data-path " , "./bin/prepared_test_data.json " , "Path to uniswap data " )
3230 flag .StringVar (& evmConfigPath , "evmConfigPath" , "./conf/evm.toml" , "" )
33- flag .IntVar (& maxBlock , "maxBlock" , 500 , "" )
34- flag .IntVar (& qps , "qps" , 1500 , "" )
35- flag .StringVar (& action , "action" , "run" , "" )
36- flag .DurationVar (& duration , "duration" , time .Minute * 5 , "" )
37- flag .IntVar (& deployUsers , "deployUsers" , 10 , "" )
38- flag .IntVar (& testUsers , "testUsers" , 100 , "" )
31+ flag .IntVar (& qps , "qps" , 5 , "" )
32+ flag .StringVar (& action , "action" , "prepare" , "" )
33+ flag .DurationVar (& duration , "duration" , time .Minute * 3 , "" )
34+ flag .IntVar (& deployUsers , "deployUsers" , 1 , "" )
35+ flag .IntVar (& testUsers , "testUsers" , 2 , "" )
3936 flag .BoolVar (& nonConflict , "nonConflict" , false , "" )
4037 flag .IntVar (& maxUsers , "maxUsers" , 0 , "" )
4138}
4239
4340func main () {
4441 flag .Parse ()
45- if err := conf .LoadConfig (configPath ); err != nil {
46- panic (err )
47- }
48- yuCfg := startup .InitDefaultKernelConfig ()
49- yuCfg .IsAdmin = true
50- yuCfg .Txpool .PoolSize = 10000000
5142 evmConfig := evm .LoadEvmConfig (evmConfigPath )
5243 ethManager := & uniswap.EthManager {}
5344 cfg := conf .Config .EthCaseConf
5445 limiter := rate .NewLimiter (rate .Limit (qps ), qps )
5546 ethManager .Configure (cfg , evmConfig )
5647 ethManager .AddTestCase (
57- uniswap .NewUniswapV2TPSStatisticsTestCase ("UniswapV2 TPS StatisticsTestCase" , deployUsers , testUsers , maxUsers , limiter , action == "run" , nonConflict ))
48+ uniswap .NewUniswapV2TPSStatisticsTestCase ("UniswapV2 TPS StatisticsTestCase" , deployUsers , testUsers , maxUsers , limiter , action == "run" , nonConflict , dataPath ))
5849 switch action {
5950 case "prepare" :
6051 prepareBenchmark (context .Background (), ethManager )
0 commit comments