@@ -18,6 +18,7 @@ package ethapi
18
18
19
19
import (
20
20
"context"
21
+ "errors"
21
22
"fmt"
22
23
"math/big"
23
24
"reflect"
@@ -57,6 +58,7 @@ func TestSetFeeDefaults(t *testing.T) {
57
58
58
59
var (
59
60
b = newBackendMock ()
61
+ zero = (* hexutil .Big )(big .NewInt (0 ))
60
62
fortytwo = (* hexutil .Big )(big .NewInt (42 ))
61
63
maxFee = (* hexutil .Big )(new (big.Int ).Add (new (big.Int ).Mul (b .current .BaseFee , big .NewInt (2 )), fortytwo .ToInt ()))
62
64
al = & types.AccessList {types.AccessTuple {Address : common.Address {0xaa }, StorageKeys : []common.Hash {{0x01 }}}}
@@ -71,13 +73,27 @@ func TestSetFeeDefaults(t *testing.T) {
71
73
& TransactionArgs {GasPrice : fortytwo },
72
74
nil ,
73
75
},
76
+ {
77
+ "legacy tx pre-London with zero price" ,
78
+ false ,
79
+ & TransactionArgs {GasPrice : zero },
80
+ & TransactionArgs {GasPrice : zero },
81
+ nil ,
82
+ },
74
83
{
75
84
"legacy tx post-London, explicit gas price" ,
76
85
true ,
77
86
& TransactionArgs {GasPrice : fortytwo },
78
87
& TransactionArgs {GasPrice : fortytwo },
79
88
nil ,
80
89
},
90
+ {
91
+ "legacy tx post-London with zero price" ,
92
+ true ,
93
+ & TransactionArgs {GasPrice : zero },
94
+ nil ,
95
+ errors .New ("gasPrice must be non-zero after EIP-1559 fork" ),
96
+ },
81
97
82
98
// Access list txs
83
99
{
@@ -143,14 +159,14 @@ func TestSetFeeDefaults(t *testing.T) {
143
159
false ,
144
160
& TransactionArgs {MaxFeePerGas : maxFee },
145
161
nil ,
146
- fmt .Errorf ("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active" ),
162
+ fmt .Errorf ("maxFeePerGas and maxPriorityFeePerGas are not valid before EIP-1559 is active" ),
147
163
},
148
164
{
149
165
"dynamic fee tx pre-London, priorityFee set" ,
150
166
false ,
151
167
& TransactionArgs {MaxPriorityFeePerGas : fortytwo },
152
168
nil ,
153
- fmt .Errorf ("maxFeePerGas and maxPriorityFeePerGas are not valid before London is active" ),
169
+ fmt .Errorf ("maxFeePerGas and maxPriorityFeePerGas are not valid before EIP-1559 is active" ),
154
170
},
155
171
{
156
172
"dynamic fee tx, maxFee < priorityFee" ,
@@ -166,6 +182,13 @@ func TestSetFeeDefaults(t *testing.T) {
166
182
nil ,
167
183
fmt .Errorf ("maxFeePerGas (0x7) < maxPriorityFeePerGas (0x2a)" ),
168
184
},
185
+ {
186
+ "dynamic fee tx post-London, explicit gas price" ,
187
+ true ,
188
+ & TransactionArgs {MaxFeePerGas : zero , MaxPriorityFeePerGas : zero },
189
+ nil ,
190
+ errors .New ("maxFeePerGas must be non-zero" ),
191
+ },
169
192
170
193
// Misc
171
194
{
0 commit comments