@@ -57,8 +57,8 @@ type TransactionArgs struct {
57
57
ChainID * hexutil.Big `json:"chainId,omitempty"`
58
58
59
59
// Introduced by EIP-4844.
60
- MaxFeePerBlobGas * hexutil.Big `json:"maxFeePerBlobGas"`
61
- BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
60
+ BlobFeeCap * hexutil.Big `json:"maxFeePerBlobGas"`
61
+ BlobHashes []common.Hash `json:"blobVersionedHashes,omitempty"`
62
62
}
63
63
64
64
// from retrieves the transaction sender address.
@@ -98,10 +98,10 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
98
98
if args .Data != nil && args .Input != nil && ! bytes .Equal (* args .Data , * args .Input ) {
99
99
return errors .New (`both "data" and "input" are set and not equal. Please use "input" to pass transaction call data` )
100
100
}
101
- if args .BlobVersionedHashes != nil && args .To == nil {
101
+ if args .BlobHashes != nil && args .To == nil {
102
102
return errors .New (`blob transactions cannot have the form of a create transaction` )
103
103
}
104
- if args .BlobVersionedHashes != nil && len (args .BlobVersionedHashes ) == 0 {
104
+ if args .BlobHashes != nil && len (args .BlobHashes ) == 0 {
105
105
return errors .New (`need at least 1 blob for a blob-tx` )
106
106
}
107
107
if args .To == nil && len (args .data ()) == 0 {
@@ -166,7 +166,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
166
166
return nil // No need to set anything, user already set MaxFeePerGas and MaxPriorityFeePerGas
167
167
}
168
168
// Sanity check the EIP-4844 fee parameters.
169
- if args .MaxFeePerBlobGas != nil && args .MaxFeePerBlobGas .ToInt ().Sign () == 0 {
169
+ if args .BlobFeeCap != nil && args .BlobFeeCap .ToInt ().Sign () == 0 {
170
170
return errors .New ("maxFeePerBlobGas must be non-zero" )
171
171
}
172
172
// Sanity check the non-EIP-1559 fee parameters.
@@ -186,15 +186,15 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
186
186
return err
187
187
}
188
188
} else if isLondon {
189
- if args .MaxFeePerBlobGas != nil {
189
+ if args .BlobFeeCap != nil {
190
190
return errors .New ("maxFeePerBlobGas is not valid before Cancun is active" )
191
191
}
192
192
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
193
193
if err := args .setLondonFeeDefaults (ctx , head , b ); err != nil {
194
194
return err
195
195
}
196
196
} else {
197
- if args .MaxFeePerGas != nil || args .MaxPriorityFeePerGas != nil || args .MaxFeePerBlobGas != nil {
197
+ if args .MaxFeePerGas != nil || args .MaxPriorityFeePerGas != nil || args .BlobFeeCap != nil {
198
198
return errors .New ("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active" )
199
199
}
200
200
// London not active, set gas price.
@@ -210,14 +210,14 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
210
210
// setCancunFeeDefaults fills in reasonable default fee values for unspecified fields.
211
211
func (args * TransactionArgs ) setCancunFeeDefaults (ctx context.Context , head * types.Header , b Backend ) error {
212
212
// Set maxFeePerBlobGas if it is missing.
213
- if args .BlobVersionedHashes != nil && args .MaxFeePerBlobGas == nil {
213
+ if args .BlobHashes != nil && args .BlobFeeCap == nil {
214
214
// ExcessBlobGas must be set for a Cancun block.
215
215
blobBaseFee := eip4844 .CalcBlobFee (* head .ExcessBlobGas )
216
216
// Set the max fee to be 2 times larger than the previous block's blob base fee.
217
217
// The additional slack allows the tx to not become invalidated if the base
218
218
// fee is rising.
219
219
val := new (big.Int ).Mul (blobBaseFee , big .NewInt (2 ))
220
- args .MaxFeePerBlobGas = (* hexutil .Big )(val )
220
+ args .BlobFeeCap = (* hexutil .Big )(val )
221
221
}
222
222
return args .setLondonFeeDefaults (ctx , head , b )
223
223
}
@@ -309,9 +309,9 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
309
309
}
310
310
}
311
311
}
312
- if args .MaxFeePerBlobGas != nil {
313
- blobGasFeeCap = args .MaxFeePerBlobGas .ToInt ()
314
- } else if args .BlobVersionedHashes != nil {
312
+ if args .BlobFeeCap != nil {
313
+ blobGasFeeCap = args .BlobFeeCap .ToInt ()
314
+ } else if args .BlobHashes != nil {
315
315
blobGasFeeCap = new (big.Int )
316
316
}
317
317
value := new (big.Int )
@@ -334,7 +334,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
334
334
Data : data ,
335
335
AccessList : accessList ,
336
336
BlobGasFeeCap : blobGasFeeCap ,
337
- BlobHashes : args .BlobVersionedHashes ,
337
+ BlobHashes : args .BlobHashes ,
338
338
SkipAccountChecks : true ,
339
339
}
340
340
return msg , nil
@@ -345,7 +345,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
345
345
func (args * TransactionArgs ) toTransaction () * types.Transaction {
346
346
var data types.TxData
347
347
switch {
348
- case args .BlobVersionedHashes != nil :
348
+ case args .BlobHashes != nil :
349
349
al := types.AccessList {}
350
350
if args .AccessList != nil {
351
351
al = * args .AccessList
@@ -360,8 +360,8 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
360
360
Value : uint256 .MustFromBig ((* big .Int )(args .Value )),
361
361
Data : args .data (),
362
362
AccessList : al ,
363
- BlobHashes : args .BlobVersionedHashes ,
364
- BlobFeeCap : uint256 .MustFromBig ((* big .Int )(args .MaxFeePerBlobGas )),
363
+ BlobHashes : args .BlobHashes ,
364
+ BlobFeeCap : uint256 .MustFromBig ((* big .Int )(args .BlobFeeCap )),
365
365
}
366
366
case args .MaxFeePerGas != nil :
367
367
al := types.AccessList {}
@@ -411,5 +411,5 @@ func (args *TransactionArgs) ToTransaction() *types.Transaction {
411
411
412
412
// IsEIP4844 returns an indicator if the args contains EIP4844 fields.
413
413
func (args * TransactionArgs ) IsEIP4844 () bool {
414
- return args .BlobVersionedHashes != nil || args .MaxFeePerBlobGas != nil
414
+ return args .BlobHashes != nil || args .BlobFeeCap != nil
415
415
}
0 commit comments