Skip to content

Commit

Permalink
gas price increase
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Apr 10, 2024
1 parent d409afe commit 96c8143
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions command/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func DefaultConfig() *Config {
ShouldSeal: true,
TxPool: &TxPool{
PriceLimit: 0,
MaxSlots: 500_000,
MaxAccountEnqueued: 100_000,
MaxSlots: 4096,
MaxAccountEnqueued: 128,
},
LogLevel: "INFO",
RestoreFile: "",
Expand Down
17 changes: 9 additions & 8 deletions loadtest/runner/eoa_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,8 @@ func (e *EOARunner) sendTransactionsForUser(account *account, chainID *big.Int,
return nil, err
}

gasPrice, err := e.client.GasPrice()
if err != nil {
return nil, err
}

bigGasPrice := new(big.Int).SetUint64(gasPrice)

var (
gasPrice *big.Int
maxFeePerGas *big.Int
maxPriorityFeePerGas *big.Int
)
Expand All @@ -115,6 +109,13 @@ func (e *EOARunner) sendTransactionsForUser(account *account, chainID *big.Int,

maxFeePerGas = new(big.Int).Add(baseFee, mpfpg)
maxFeePerGas.Mul(maxFeePerGas, big.NewInt(2))
} else {
gp, err := e.client.GasPrice()
if err != nil {
return nil, err
}

gasPrice = new(big.Int).SetUint64(gp + (gp * 20 / 100))
}

for i := 0; i < e.cfg.TxsPerUser; i++ {
Expand All @@ -136,7 +137,7 @@ func (e *EOARunner) sendTransactionsForUser(account *account, chainID *big.Int,
types.WithTo(&receiverAddr),
types.WithValue(ethgo.Gwei(1)),
types.WithGas(21000),
types.WithGasPrice(bigGasPrice),
types.WithGasPrice(gasPrice),
types.WithFrom(account.key.Address()),
)), account.key)
}
Expand Down
17 changes: 9 additions & 8 deletions loadtest/runner/erc20_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,8 @@ func (e *ERC20Runner) sendTransactionsForUser(account *account, chainID *big.Int
return nil, err
}

gasPrice, err := e.client.GasPrice()
if err != nil {
return nil, err
}

bigGasPrice := new(big.Int).SetUint64(gasPrice)

var (
gasPrice *big.Int
maxFeePerGas *big.Int
maxPriorityFeePerGas *big.Int
)
Expand All @@ -268,6 +262,13 @@ func (e *ERC20Runner) sendTransactionsForUser(account *account, chainID *big.Int

maxFeePerGas = new(big.Int).Add(baseFee, mpfpg)
maxFeePerGas.Mul(maxFeePerGas, big.NewInt(2))
} else {
gp, err := e.client.GasPrice()
if err != nil {
return nil, err
}

gasPrice = new(big.Int).SetUint64(gp + (gp * 20 / 100))
}

for i := 0; i < e.cfg.TxsPerUser; i++ {
Expand All @@ -293,7 +294,7 @@ func (e *ERC20Runner) sendTransactionsForUser(account *account, chainID *big.Int
_, err = txRelayer.SendTransaction(types.NewTx(types.NewLegacyTx(
types.WithNonce(account.nonce),
types.WithTo(&e.erc20Token),
types.WithGasPrice(bigGasPrice),
types.WithGasPrice(gasPrice),
types.WithFrom(account.key.Address()),
types.WithInput(input),
)), account.key)
Expand Down

0 comments on commit 96c8143

Please sign in to comment.