Skip to content

Commit b5c6a9b

Browse files
committed
rename to blobHashes and blobFeeCap
1 parent c90642a commit b5c6a9b

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

internal/ethapi/api_test.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -747,11 +747,11 @@ func TestEstimateGas(t *testing.T) {
747747
{
748748
blockNumber: rpc.LatestBlockNumber,
749749
call: TransactionArgs{
750-
From: &accounts[0].addr,
751-
To: &accounts[1].addr,
752-
Value: (*hexutil.Big)(big.NewInt(1)),
753-
BlobVersionedHashes: []common.Hash{common.Hash{0x01, 0x22}},
754-
MaxFeePerBlobGas: (*hexutil.Big)(big.NewInt(1)),
750+
From: &accounts[0].addr,
751+
To: &accounts[1].addr,
752+
Value: (*hexutil.Big)(big.NewInt(1)),
753+
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
754+
BlobFeeCap: (*hexutil.Big)(big.NewInt(1)),
755755
},
756756
want: 21000,
757757
},
@@ -926,20 +926,20 @@ func TestCall(t *testing.T) {
926926
{
927927
blockNumber: rpc.LatestBlockNumber,
928928
call: TransactionArgs{
929-
From: &accounts[1].addr,
930-
Input: &hexutil.Bytes{0x00},
931-
BlobVersionedHashes: []common.Hash{},
929+
From: &accounts[1].addr,
930+
Input: &hexutil.Bytes{0x00},
931+
BlobHashes: []common.Hash{},
932932
},
933933
expectErr: core.ErrBlobTxCreate,
934934
},
935935
// BLOBHASH opcode
936936
{
937937
blockNumber: rpc.LatestBlockNumber,
938938
call: TransactionArgs{
939-
From: &accounts[1].addr,
940-
To: &randomAccounts[2].addr,
941-
BlobVersionedHashes: []common.Hash{common.Hash{0x01, 0x22}},
942-
MaxFeePerBlobGas: (*hexutil.Big)(big.NewInt(1)),
939+
From: &accounts[1].addr,
940+
To: &randomAccounts[2].addr,
941+
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
942+
BlobFeeCap: (*hexutil.Big)(big.NewInt(1)),
943943
},
944944
overrides: StateOverride{
945945
randomAccounts[2].addr: {
@@ -1028,10 +1028,10 @@ func TestSignBlobTransaction(t *testing.T) {
10281028
})
10291029
api := NewTransactionAPI(b, nil)
10301030
res, err := api.FillTransaction(context.Background(), TransactionArgs{
1031-
From: &b.acc.Address,
1032-
To: &to,
1033-
Value: (*hexutil.Big)(big.NewInt(1)),
1034-
BlobVersionedHashes: []common.Hash{{0x01, 0x22}},
1031+
From: &b.acc.Address,
1032+
To: &to,
1033+
Value: (*hexutil.Big)(big.NewInt(1)),
1034+
BlobHashes: []common.Hash{{0x01, 0x22}},
10351035
})
10361036
if err != nil {
10371037
t.Fatalf("failed to fill tx defaults: %v\n", err)
@@ -1062,10 +1062,10 @@ func TestSendBlobTransaction(t *testing.T) {
10621062
})
10631063
api := NewTransactionAPI(b, nil)
10641064
res, err := api.FillTransaction(context.Background(), TransactionArgs{
1065-
From: &b.acc.Address,
1066-
To: &to,
1067-
Value: (*hexutil.Big)(big.NewInt(1)),
1068-
BlobVersionedHashes: []common.Hash{common.Hash{0x01, 0x22}},
1065+
From: &b.acc.Address,
1066+
To: &to,
1067+
Value: (*hexutil.Big)(big.NewInt(1)),
1068+
BlobHashes: []common.Hash{common.Hash{0x01, 0x22}},
10691069
})
10701070
if err != nil {
10711071
t.Fatalf("failed to fill tx defaults: %v\n", err)
@@ -1097,8 +1097,8 @@ func argsFromTransaction(tx *types.Transaction, from common.Address) Transaction
10971097
ChainID: (*hexutil.Big)(tx.ChainId()),
10981098
// TODO: impl accessList conversion
10991099
//AccessList: tx.AccessList(),
1100-
MaxFeePerBlobGas: (*hexutil.Big)(tx.BlobGasFeeCap()),
1101-
BlobVersionedHashes: tx.BlobHashes(),
1100+
BlobFeeCap: (*hexutil.Big)(tx.BlobGasFeeCap()),
1101+
BlobHashes: tx.BlobHashes(),
11021102
}
11031103
}
11041104

internal/ethapi/transaction_args.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ type TransactionArgs struct {
5757
ChainID *hexutil.Big `json:"chainId,omitempty"`
5858

5959
// 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"`
6262
}
6363

6464
// from retrieves the transaction sender address.
@@ -98,10 +98,10 @@ func (args *TransactionArgs) setDefaults(ctx context.Context, b Backend) error {
9898
if args.Data != nil && args.Input != nil && !bytes.Equal(*args.Data, *args.Input) {
9999
return errors.New(`both "data" and "input" are set and not equal. Please use "input" to pass transaction call data`)
100100
}
101-
if args.BlobVersionedHashes != nil && args.To == nil {
101+
if args.BlobHashes != nil && args.To == nil {
102102
return errors.New(`blob transactions cannot have the form of a create transaction`)
103103
}
104-
if args.BlobVersionedHashes != nil && len(args.BlobVersionedHashes) == 0 {
104+
if args.BlobHashes != nil && len(args.BlobHashes) == 0 {
105105
return errors.New(`need at least 1 blob for a blob-tx`)
106106
}
107107
if args.To == nil && len(args.data()) == 0 {
@@ -166,7 +166,7 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
166166
return nil // No need to set anything, user already set MaxFeePerGas and MaxPriorityFeePerGas
167167
}
168168
// 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 {
170170
return errors.New("maxFeePerBlobGas must be non-zero")
171171
}
172172
// Sanity check the non-EIP-1559 fee parameters.
@@ -186,15 +186,15 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
186186
return err
187187
}
188188
} else if isLondon {
189-
if args.MaxFeePerBlobGas != nil {
189+
if args.BlobFeeCap != nil {
190190
return errors.New("maxFeePerBlobGas is not valid before Cancun is active")
191191
}
192192
// London is active, set maxPriorityFeePerGas and maxFeePerGas.
193193
if err := args.setLondonFeeDefaults(ctx, head, b); err != nil {
194194
return err
195195
}
196196
} else {
197-
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil || args.MaxFeePerBlobGas != nil {
197+
if args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil || args.BlobFeeCap != nil {
198198
return errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active")
199199
}
200200
// London not active, set gas price.
@@ -210,14 +210,14 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend) erro
210210
// setCancunFeeDefaults fills in reasonable default fee values for unspecified fields.
211211
func (args *TransactionArgs) setCancunFeeDefaults(ctx context.Context, head *types.Header, b Backend) error {
212212
// Set maxFeePerBlobGas if it is missing.
213-
if args.BlobVersionedHashes != nil && args.MaxFeePerBlobGas == nil {
213+
if args.BlobHashes != nil && args.BlobFeeCap == nil {
214214
// ExcessBlobGas must be set for a Cancun block.
215215
blobBaseFee := eip4844.CalcBlobFee(*head.ExcessBlobGas)
216216
// Set the max fee to be 2 times larger than the previous block's blob base fee.
217217
// The additional slack allows the tx to not become invalidated if the base
218218
// fee is rising.
219219
val := new(big.Int).Mul(blobBaseFee, big.NewInt(2))
220-
args.MaxFeePerBlobGas = (*hexutil.Big)(val)
220+
args.BlobFeeCap = (*hexutil.Big)(val)
221221
}
222222
return args.setLondonFeeDefaults(ctx, head, b)
223223
}
@@ -309,9 +309,9 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
309309
}
310310
}
311311
}
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 {
315315
blobGasFeeCap = new(big.Int)
316316
}
317317
value := new(big.Int)
@@ -334,7 +334,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
334334
Data: data,
335335
AccessList: accessList,
336336
BlobGasFeeCap: blobGasFeeCap,
337-
BlobHashes: args.BlobVersionedHashes,
337+
BlobHashes: args.BlobHashes,
338338
SkipAccountChecks: true,
339339
}
340340
return msg, nil
@@ -345,7 +345,7 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (*
345345
func (args *TransactionArgs) toTransaction() *types.Transaction {
346346
var data types.TxData
347347
switch {
348-
case args.BlobVersionedHashes != nil:
348+
case args.BlobHashes != nil:
349349
al := types.AccessList{}
350350
if args.AccessList != nil {
351351
al = *args.AccessList
@@ -360,8 +360,8 @@ func (args *TransactionArgs) toTransaction() *types.Transaction {
360360
Value: uint256.MustFromBig((*big.Int)(args.Value)),
361361
Data: args.data(),
362362
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)),
365365
}
366366
case args.MaxFeePerGas != nil:
367367
al := types.AccessList{}
@@ -411,5 +411,5 @@ func (args *TransactionArgs) ToTransaction() *types.Transaction {
411411

412412
// IsEIP4844 returns an indicator if the args contains EIP4844 fields.
413413
func (args *TransactionArgs) IsEIP4844() bool {
414-
return args.BlobVersionedHashes != nil || args.MaxFeePerBlobGas != nil
414+
return args.BlobHashes != nil || args.BlobFeeCap != nil
415415
}

internal/ethapi/transaction_args_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,29 +210,29 @@ func TestSetFeeDefaults(t *testing.T) {
210210
{
211211
"set maxFeePerBlobGas pre cancun",
212212
"london",
213-
&TransactionArgs{MaxFeePerBlobGas: fortytwo},
213+
&TransactionArgs{BlobFeeCap: fortytwo},
214214
nil,
215215
errors.New("maxFeePerBlobGas is not valid before Cancun is active"),
216216
},
217217
{
218218
"set maxFeePerBlobGas pre london",
219219
"legacy",
220-
&TransactionArgs{MaxFeePerBlobGas: fortytwo},
220+
&TransactionArgs{BlobFeeCap: fortytwo},
221221
nil,
222222
errors.New("maxFeePerGas and maxPriorityFeePerGas and maxFeePerBlobGas are not valid before London is active"),
223223
},
224224
{
225225
"set gas price and maxFee for blob-tx",
226226
"cancun",
227-
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobVersionedHashes: []common.Hash{}},
227+
&TransactionArgs{GasPrice: fortytwo, MaxFeePerGas: maxFee, BlobHashes: []common.Hash{}},
228228
nil,
229229
errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"),
230230
},
231231
{
232232
"fill maxFeePerBlobGas",
233233
"cancun",
234-
&TransactionArgs{BlobVersionedHashes: []common.Hash{}},
235-
&TransactionArgs{BlobVersionedHashes: []common.Hash{}, MaxFeePerBlobGas: (*hexutil.Big)(big.NewInt(4)), MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
234+
&TransactionArgs{BlobHashes: []common.Hash{}},
235+
&TransactionArgs{BlobHashes: []common.Hash{}, BlobFeeCap: (*hexutil.Big)(big.NewInt(4)), MaxFeePerGas: maxFee, MaxPriorityFeePerGas: fortytwo},
236236
nil,
237237
},
238238
}

0 commit comments

Comments
 (0)