Skip to content

Commit

Permalink
remove some redundant arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
gatsbyz committed Jun 28, 2023
1 parent 0848f13 commit 290803c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions cmd/loadtest/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,27 +821,27 @@ func mainLoop(ctx context.Context, c *ethclient.Client, rpc *ethrpc.Client) erro
}
switch localMode {
case loadTestModeTransaction:
startReq, endReq, err = loadtestTransaction(ctx, c, myNonceValue, legacyTransactionMode)
startReq, endReq, err = loadtestTransaction(ctx, c, myNonceValue)
case loadTestModeDeploy:
startReq, endReq, err = loadtestDeploy(ctx, c, myNonceValue, legacyTransactionMode)
startReq, endReq, err = loadtestDeploy(ctx, c, myNonceValue)
case loadTestModeCall:
startReq, endReq, err = loadtestCall(ctx, c, myNonceValue, ltContract, legacyTransactionMode)
startReq, endReq, err = loadtestCall(ctx, c, myNonceValue, ltContract)
case loadTestModeFunction:
startReq, endReq, err = loadtestFunction(ctx, c, myNonceValue, ltContract, legacyTransactionMode)
startReq, endReq, err = loadtestFunction(ctx, c, myNonceValue, ltContract)
case loadTestModeInc:
startReq, endReq, err = loadtestInc(ctx, c, myNonceValue, ltContract, legacyTransactionMode)
startReq, endReq, err = loadtestInc(ctx, c, myNonceValue, ltContract)
case loadTestModeStore:
startReq, endReq, err = loadtestStore(ctx, c, myNonceValue, ltContract, legacyTransactionMode)
startReq, endReq, err = loadtestStore(ctx, c, myNonceValue, ltContract)
case loadTestModeLong:
startReq, endReq, err = loadtestLong(ctx, c, myNonceValue, delegatorContract, ltAddr, legacyTransactionMode)
startReq, endReq, err = loadtestLong(ctx, c, myNonceValue, delegatorContract, ltAddr)
case loadTestModeERC20:
startReq, endReq, err = loadtestERC20(ctx, c, myNonceValue, erc20Contract, ltAddr, legacyTransactionMode)
startReq, endReq, err = loadtestERC20(ctx, c, myNonceValue, erc20Contract, ltAddr)
case loadTestModeERC721:
startReq, endReq, err = loadtestERC721(ctx, c, myNonceValue, erc721Contract, ltAddr, legacyTransactionMode)
startReq, endReq, err = loadtestERC721(ctx, c, myNonceValue, erc721Contract, ltAddr)
case loadTestModePrecompiledContract:
startReq, endReq, err = loadtestCallPrecompiledContracts(ctx, c, myNonceValue, ltContract, true, legacyTransactionMode)
startReq, endReq, err = loadtestCallPrecompiledContracts(ctx, c, myNonceValue, ltContract, true)
case loadTestModePrecompiledContracts:
startReq, endReq, err = loadtestCallPrecompiledContracts(ctx, c, myNonceValue, ltContract, false, legacyTransactionMode)
startReq, endReq, err = loadtestCallPrecompiledContracts(ctx, c, myNonceValue, ltContract, false)
default:
log.Error().Str("mode", mode).Msg("We've arrived at a load test mode that we don't recognize")
}
Expand Down Expand Up @@ -957,7 +957,7 @@ func blockUntilSuccessful(ctx context.Context, c *ethclient.Client, f func() err
}
}

func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64, legacy bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

gasPrice := ltp.CurrentGas
Expand All @@ -979,7 +979,7 @@ func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64,

gasLimit := uint64(21000)
var tx *ethtypes.Transaction
if legacy {
if *ltp.LegacyTransactionMode {
tx = ethtypes.NewTransaction(nonce, *to, amount, gasLimit, gasPrice, nil)
} else {
gasTipCap := ltp.CurrentGasTipCap
Expand Down Expand Up @@ -1008,7 +1008,7 @@ func loadtestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64,
return
}

func loadtestDeploy(ctx context.Context, c *ethclient.Client, nonce uint64, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestDeploy(ctx context.Context, c *ethclient.Client, nonce uint64) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1028,7 +1028,7 @@ func loadtestDeploy(ctx context.Context, c *ethclient.Client, nonce uint64, lega
return
}

func loadtestFunction(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestFunction(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1050,7 +1050,7 @@ func loadtestFunction(ctx context.Context, c *ethclient.Client, nonce uint64, lt
return
}

func loadtestCall(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestCall(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1072,7 +1072,7 @@ func loadtestCall(ctx context.Context, c *ethclient.Client, nonce uint64, ltCont
return
}

func loadtestCallPrecompiledContracts(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, useSelectedAddress bool, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestCallPrecompiledContracts(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, useSelectedAddress bool) (t1 time.Time, t2 time.Time, err error) {
var f int
ltp := inputLoadTestParams

Expand All @@ -1099,7 +1099,7 @@ func loadtestCallPrecompiledContracts(ctx context.Context, c *ethclient.Client,
return
}

func loadtestInc(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestInc(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1119,7 +1119,7 @@ func loadtestInc(ctx context.Context, c *ethclient.Client, nonce uint64, ltContr
return
}

func loadtestStore(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestStore(ctx context.Context, c *ethclient.Client, nonce uint64, ltContract *contracts.LoadTester) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1141,7 +1141,7 @@ func loadtestStore(ctx context.Context, c *ethclient.Client, nonce uint64, ltCon
return
}

func loadtestLong(ctx context.Context, c *ethclient.Client, nonce uint64, delegatorContract *contracts.Delegator, ltAddress ethcommon.Address, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestLong(ctx context.Context, c *ethclient.Client, nonce uint64, delegatorContract *contracts.Delegator, ltAddress ethcommon.Address) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

chainID := new(big.Int).SetUint64(*ltp.ChainID)
Expand All @@ -1165,7 +1165,7 @@ func loadtestLong(ctx context.Context, c *ethclient.Client, nonce uint64, delega
return
}

func loadtestERC20(ctx context.Context, c *ethclient.Client, nonce uint64, erc20Contract *contracts.ERC20, ltAddress ethcommon.Address, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestERC20(ctx context.Context, c *ethclient.Client, nonce uint64, erc20Contract *contracts.ERC20, ltAddress ethcommon.Address) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams

to := ltp.ToETHAddress
Expand All @@ -1191,7 +1191,7 @@ func loadtestERC20(ctx context.Context, c *ethclient.Client, nonce uint64, erc20
return
}

func loadtestERC721(ctx context.Context, c *ethclient.Client, nonce uint64, erc721Contract *contracts.ERC721, ltAddress ethcommon.Address, legacyTransactionMode bool) (t1 time.Time, t2 time.Time, err error) {
func loadtestERC721(ctx context.Context, c *ethclient.Client, nonce uint64, erc721Contract *contracts.ERC721, ltAddress ethcommon.Address) (t1 time.Time, t2 time.Time, err error) {
ltp := inputLoadTestParams
iterations := ltp.Iterations

Expand Down

0 comments on commit 290803c

Please sign in to comment.