Skip to content
This repository was archived by the owner on Jul 13, 2022. It is now read-only.

Commit 95fc717

Browse files
authored
Use max gas price from config for TX sending when BaseFee is above maxGasPrice (#698)
* change maxFeePerGas to use config.maxGasPrice rather than current base fee * updated test * test constants fix
1 parent 8b1b0e0 commit 95fc717

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

connections/ethereum/connection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (c *Connection) EstimateGasLondon(ctx context.Context, baseFee *big.Int) (*
171171

172172
if c.maxGasPrice.Cmp(baseFee) < 0 {
173173
maxPriorityFeePerGas = big.NewInt(1)
174-
maxFeePerGas = new(big.Int).Add(baseFee, maxPriorityFeePerGas)
174+
maxFeePerGas = new(big.Int).Add(c.maxGasPrice, maxPriorityFeePerGas)
175175
return maxPriorityFeePerGas, maxFeePerGas, nil
176176
}
177177

connections/ethereum/connection_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func TestConnection_SafeEstimateGasMax(t *testing.T) {
100100

101101
func TestConnection_EstimateGasLondon(t *testing.T) {
102102
// Set TestEndpoint to Goerli endpoint when testing as the current Github CI doesn't use the London version of geth
103-
// Goerli commonly has a base fee of 7 gwei with maxPriorityFeePerGas of 4.999999993 gwei
103+
// Goerli commonly has a base fee of 7 wei with maxPriorityFeePerGas of 4.999999993 gwei
104104
maxGasPrice := big.NewInt(100000000000)
105105
conn := NewConnection(TestEndpoint, false, AliceKp, log15.Root(), GasLimit, maxGasPrice, GasMultipler, "", "")
106106
err := conn.Connect()
@@ -129,7 +129,7 @@ func TestConnection_EstimateGasLondon(t *testing.T) {
129129

130130
func TestConnection_EstimateGasLondonMax(t *testing.T) {
131131
// Set TestEndpoint to Goerli endpoint when testing as the current Github CI doesn't use the London version of geth
132-
// Goerli commonly has a base fee of 7 gwei with maxPriorityFeePerGas of 4.999999993 gwei
132+
// Goerli commonly has a base fee of 7 wei with maxPriorityFeePerGas of 4.999999993 gwei
133133
maxGasPrice := big.NewInt(100)
134134
conn := NewConnection(TestEndpoint, false, AliceKp, log15.Root(), GasLimit, maxGasPrice, GasMultipler, "", "")
135135
err := conn.Connect()
@@ -164,7 +164,7 @@ func TestConnection_EstimateGasLondonMax(t *testing.T) {
164164

165165
func TestConnection_EstimateGasLondonMin(t *testing.T) {
166166
// Set TestEndpoint to Goerli endpoint when testing as the current Github CI doesn't use the London version of geth
167-
// Goerli commonly has a base fee of 7 gwei with maxPriorityFeePerGas of 4.999999993 gwei
167+
// Goerli commonly has a base fee of 7 wei with maxPriorityFeePerGas of 4.999999993 gwei
168168
maxGasPrice := big.NewInt(1)
169169
conn := NewConnection(TestEndpoint, false, AliceKp, log15.Root(), GasLimit, maxGasPrice, GasMultipler, "", "")
170170
err := conn.Connect()
@@ -186,7 +186,7 @@ func TestConnection_EstimateGasLondonMin(t *testing.T) {
186186
}
187187

188188
maxPriorityFeePerGas := big.NewInt(1)
189-
maxFeePerGas := new(big.Int).Add(head.BaseFee, maxPriorityFeePerGas)
189+
maxFeePerGas := new(big.Int).Add(maxGasPrice, maxPriorityFeePerGas)
190190

191191
if suggestedGasTip.Cmp(maxPriorityFeePerGas) != 0 {
192192
t.Fatalf("Gas tip cap should be equal to 1. Suggested: %s Max Tip: %s", suggestedGasTip.String(), maxPriorityFeePerGas)

0 commit comments

Comments
 (0)