Skip to content

Commit ca46720

Browse files
committed
Bring geth updates for EIP-7623
Refer to ethereum/go-ethereum#30946. That PR is ongoing so we may need further updates.
1 parent 7b4a6f3 commit ca46720

File tree

48 files changed

+232
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+232
-163
lines changed

Diff for: accounts/abi/bind/backends/blockchain.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,13 @@ func (b *BlockchainContractBackend) callContract(call kaia.CallMsg, block *types
156156
if call.AccessList != nil {
157157
accessList = *call.AccessList
158158
}
159-
intrinsicGas, err := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.bc.Config().Rules(block.Number()))
159+
intrinsicGas, tokens, err := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.bc.Config().Rules(block.Number()))
160160
if err != nil {
161161
return nil, err
162162
}
163163

164164
msg := types.NewMessage(call.From, call.To, 0, call.Value, call.Gas, gasPrice, nil, nil, call.Data,
165-
false, intrinsicGas, accessList, nil)
165+
false, intrinsicGas, tokens, accessList, nil)
166166

167167
txContext := blockchain.NewEVMTxContext(msg, block.Header(), b.bc.Config())
168168
blockContext := blockchain.NewEVMBlockContext(block.Header(), b.bc, nil)

Diff for: accounts/abi/bind/backends/simulated.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ func (b *SimulatedBackend) callContract(_ context.Context, call kaia.CallMsg, bl
500500
if call.AccessList != nil {
501501
accessList = *call.AccessList
502502
}
503-
intrinsicGas, _ := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.config.Rules(block.Number()))
504-
msg := types.NewMessage(call.From, call.To, nonce, call.Value, call.Gas, gasPrice, nil, nil, call.Data, true, intrinsicGas, accessList, nil)
503+
intrinsicGas, dataTokens, _ := types.IntrinsicGas(call.Data, accessList, nil, call.To == nil, b.config.Rules(block.Number()))
504+
msg := types.NewMessage(call.From, call.To, nonce, call.Value, call.Gas, gasPrice, nil, nil, call.Data, true, intrinsicGas, dataTokens, accessList, nil)
505505

506506
txContext := blockchain.NewEVMTxContext(msg, block.Header(), b.config)
507507
blockContext := blockchain.NewEVMBlockContext(block.Header(), b.blockchain, nil)

Diff for: api/api_ethereum.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1413,11 +1413,11 @@ func EthDoCall(ctx context.Context, b Backend, args EthTransactionArgs, blockNrO
14131413
} else {
14141414
baseFee = new(big.Int).SetUint64(params.ZeroBaseFee)
14151415
}
1416-
intrinsicGas, err := types.IntrinsicGas(args.data(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
1416+
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.data(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
14171417
if err != nil {
14181418
return nil, err
14191419
}
1420-
msg, err := args.ToMessage(globalGasCap, baseFee, intrinsicGas)
1420+
msg, err := args.ToMessage(globalGasCap, baseFee, intrinsicGas, dataTokens)
14211421
if err != nil {
14221422
return nil, err
14231423
}
@@ -1570,11 +1570,11 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
15701570
precompiles := vm.ActivePrecompiles(rules)
15711571

15721572
toMsg := func() (*types.Transaction, error) {
1573-
intrinsicGas, err := types.IntrinsicGas(args.data(), nil, nil, args.To == nil, rules)
1573+
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.data(), nil, nil, args.To == nil, rules)
15741574
if err != nil {
15751575
return nil, err
15761576
}
1577-
return args.ToMessage(gasCap, header.BaseFee, intrinsicGas)
1577+
return args.ToMessage(gasCap, header.BaseFee, intrinsicGas, dataTokens)
15781578
}
15791579

15801580
if args.Gas == nil {

Diff for: api/api_public_blockchain.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
327327
// this makes sure resources are cleaned up.
328328
defer cancel()
329329

330-
intrinsicGas, err := types.IntrinsicGas(args.InputData(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
330+
intrinsicGas, dataTokens, err := types.IntrinsicGas(args.InputData(), args.GetAccessList(), nil, args.To == nil, b.ChainConfig().Rules(header.Number))
331331
if err != nil {
332332
return nil, 0, err
333333
}
@@ -339,7 +339,7 @@ func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.Blo
339339
} else {
340340
baseFee = new(big.Int).SetUint64(params.ZeroBaseFee)
341341
}
342-
msg, err := args.ToMessage(globalGasCap.Uint64(), baseFee, intrinsicGas)
342+
msg, err := args.ToMessage(globalGasCap.Uint64(), baseFee, intrinsicGas, dataTokens)
343343
if err != nil {
344344
return nil, 0, err
345345
}
@@ -689,7 +689,7 @@ func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash, config *pa
689689
return nil
690690
}
691691

692-
func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64) (*types.Transaction, error) {
692+
func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64, dataTokens uint64) (*types.Transaction, error) {
693693
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
694694
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
695695
} else if args.MaxFeePerGas != nil && args.MaxPriorityFeePerGas != nil {
@@ -737,5 +737,5 @@ func (args *CallArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsic
737737
if args.AccessList != nil {
738738
accessList = *args.AccessList
739739
}
740-
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, args.InputData(), false, intrinsicGas, accessList, nil), nil
740+
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, args.InputData(), false, intrinsicGas, dataTokens, accessList, nil), nil
741741
}

Diff for: api/tx_args.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ func (args *EthTransactionArgs) setDefaults(ctx context.Context, b Backend) erro
729729
}
730730

731731
// ToMessage change EthTransactionArgs to types.Transaction in Kaia.
732-
func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64) (*types.Transaction, error) {
732+
func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, intrinsicGas uint64, dataTokens uint64) (*types.Transaction, error) {
733733
// Reject invalid combinations of pre- and post-1559 fee styles
734734
if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) {
735735
return nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified")
@@ -780,7 +780,7 @@ func (args *EthTransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int,
780780
if args.AccessList != nil {
781781
accessList = *args.AccessList
782782
}
783-
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, data, false, intrinsicGas, accessList, nil), nil
783+
return types.NewMessage(addr, args.To, 0, value, gas, gasPrice, nil, nil, data, false, intrinsicGas, dataTokens, accessList, nil), nil
784784
}
785785

786786
// toTransaction converts the arguments to a transaction.

Diff for: blockchain/bench_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
111111
return func(i int, gen *BlockGen) {
112112
toaddr := common.Address{}
113113
data := make([]byte, nbytes)
114-
gas, _ := types.IntrinsicGas(data, nil, nil, false, params.TestChainConfig.Rules(big.NewInt(0)))
114+
gas, _, _ := types.IntrinsicGas(data, nil, nil, false, params.TestChainConfig.Rules(big.NewInt(0)))
115115
signer := types.LatestSignerForChainID(params.TestChainConfig.ChainID)
116116
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(benchRootAddr), toaddr, big.NewInt(1), gas, nil, data), signer, benchRootKey)
117117
gen.AddTx(tx)

Diff for: blockchain/blockchain_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ func TestAccessListTx(t *testing.T) {
14611461
b.SetRewardbase(common.Address{1})
14621462

14631463
// One transaction to 0xAAAA
1464-
intrinsicGas, _ := types.IntrinsicGas([]byte{}, list, nil, false, gspec.Config.Rules(block.Number()))
1465-
tx, _ := types.SignTx(types.NewMessage(senderAddr, &contractAddr, senderNonce, big.NewInt(0), 30000, big.NewInt(1), nil, nil, []byte{}, false, intrinsicGas, list, nil), signer, senderKey)
1464+
intrinsicGas, dataTokens, _ := types.IntrinsicGas([]byte{}, list, nil, false, gspec.Config.Rules(block.Number()))
1465+
tx, _ := types.SignTx(types.NewMessage(senderAddr, &contractAddr, senderNonce, big.NewInt(0), 30000, big.NewInt(1), nil, nil, []byte{}, false, intrinsicGas, dataTokens, list, nil), signer, senderKey)
14661466
b.AddTx(tx)
14671467
})
14681468
if n, err := chain.InsertChain(blocks); err != nil {
@@ -2345,13 +2345,13 @@ func TestEIP7702(t *testing.T) {
23452345
b.SetRewardbase(common.Address{1})
23462346

23472347
authorizationList := []types.Authorization{*auth1, *auth2}
2348-
intrinsicGas, err := types.IntrinsicGas(nil, nil, authorizationList, false, params.TestRules)
2348+
intrinsicGas, dataTokens, err := types.IntrinsicGas(nil, nil, authorizationList, false, params.TestRules)
23492349
if err != nil {
23502350
t.Fatalf("failed to run intrinsic gas: %v", err)
23512351
}
23522352

23532353
tx, err := types.SignTx(types.NewMessage(addr1, &addr1, uint64(0), nil, 500000, nil, newGkei(50),
2354-
big.NewInt(20), nil, false, intrinsicGas, nil, authorizationList), signer, key1)
2354+
big.NewInt(20), nil, false, intrinsicGas, dataTokens, nil, authorizationList), signer, key1)
23552355
if err != nil {
23562356
t.Fatalf("failed to sign tx: %v", err)
23572357
}
@@ -2426,13 +2426,13 @@ func TestEIP7702(t *testing.T) {
24262426
}, key1)
24272427

24282428
authorizationList := []types.Authorization{*authForEmpty}
2429-
intrinsicGas, err := types.IntrinsicGas(nil, nil, authorizationList, false, params.TestRules)
2429+
intrinsicGas, dataTokens, err := types.IntrinsicGas(nil, nil, authorizationList, false, params.TestRules)
24302430
if err != nil {
24312431
t.Fatalf("failed to run intrinsic gas: %v", err)
24322432
}
24332433

24342434
tx, err := types.SignTx(types.NewMessage(addr1, &addr1, state.GetNonce(addr1), nil, 500000, nil, newGkei(50),
2435-
big.NewInt(20), nil, false, intrinsicGas, nil, authorizationList), signer, key1)
2435+
big.NewInt(20), nil, false, intrinsicGas, dataTokens, nil, authorizationList), signer, key1)
24362436
if err != nil {
24372437
t.Fatalf("failed to sign tx: %v", err)
24382438
}

Diff for: blockchain/error.go

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ var (
8686
// than required to start the invocation.
8787
ErrIntrinsicGas = errors.New("intrinsic gas too low")
8888

89+
// ErrDataFloorGas is returned if the transaction is specified to use less gas
90+
// than required for the data floor cost.
91+
ErrDataFloorGas = errors.New("insufficient gas for data floor cost")
92+
8993
// ErrGasLimit is returned if a transaction's requested gas limit exceeds the
9094
// maximum allowance of the current block.
9195
ErrGasLimit = errors.New("exceeds block gas limit")

Diff for: blockchain/state_processor.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func ProcessParentBlockHash(header *types.Header, vmenv *vm.EVM, statedb vm.Stat
112112
gasLimit = uint64(30_000_000)
113113
)
114114

115-
intrinsicGas, err := types.IntrinsicGas(data, nil, nil, false, rules)
115+
intrinsicGas, dataTokens, err := types.IntrinsicGas(data, nil, nil, false, rules)
116116
if err != nil {
117117
return err
118118
}
@@ -129,6 +129,7 @@ func ProcessParentBlockHash(header *types.Header, vmenv *vm.EVM, statedb vm.Stat
129129
data,
130130
false,
131131
intrinsicGas,
132+
dataTokens,
132133
nil,
133134
nil,
134135
)

Diff for: blockchain/state_transition.go

+34-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package blockchain
2525
import (
2626
"errors"
2727
"fmt"
28+
"math"
2829
"math/big"
2930

3031
"github.com/kaiachain/kaia/blockchain/types"
@@ -83,7 +84,7 @@ type Message interface {
8384

8485
// ValidatedIntrinsicGas returns the intrinsic gas of the transaction.
8586
// The returned intrinsic gas should be derived by calling AsMessageAccountKeyPicker().
86-
ValidatedIntrinsicGas() uint64
87+
ValidatedIntrinsicGas() *types.ValidatedIntrinsicGas
8788

8889
// FeeRatio returns a ratio of tx fee paid by the fee payer in percentage.
8990
// For example, if it is 30, 30% of tx fee will be paid by the fee payer.
@@ -111,7 +112,7 @@ type Message interface {
111112

112113
// IntrinsicGas returns `intrinsic gas` based on the tx type.
113114
// This value is used to differentiate tx fee based on the tx type.
114-
IntrinsicGas(currentBlockNumber uint64) (uint64, error)
115+
IntrinsicGas(currentBlockNumber uint64) (uint64, uint64, error)
115116

116117
// Type returns the transaction type of the message.
117118
Type() types.TxType
@@ -345,11 +346,20 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
345346
}
346347

347348
// Check clauses 4-5, subtract intrinsic gas if everything is correct
348-
amount := msg.ValidatedIntrinsicGas()
349-
if st.gas < amount {
349+
validatedGas := msg.ValidatedIntrinsicGas()
350+
if st.gas < validatedGas.Gas {
350351
return nil, ErrIntrinsicGas
351352
}
352-
st.gas -= amount
353+
if st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber).IsPrague {
354+
floorGas, err := FloorDataGas(validatedGas.Tokens)
355+
if err != nil {
356+
return nil, err
357+
}
358+
if st.gas < floorGas {
359+
return nil, fmt.Errorf("%w: have %d, want %d", ErrDataFloorGas, st.gas, floorGas)
360+
}
361+
}
362+
st.gas -= validatedGas.Gas
353363

354364
// Check clause 6
355365
if msg.Value().Sign() > 0 && !st.evm.Context.CanTransfer(st.state, msg.ValidatedSender(), msg.Value()) {
@@ -408,6 +418,15 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
408418
return nil, vm.ErrTotalTimeLimitReached
409419
}
410420

421+
if st.evm.ChainConfig().Rules(st.evm.Context.BlockNumber).IsPrague {
422+
// After EIP-7623: Data-heavy transactions pay the floor gas.
423+
// Overflow error has already been checked and can be ignored here.
424+
floorGas, _ := FloorDataGas(validatedGas.Tokens)
425+
if st.gasUsed() < floorGas {
426+
st.gas = st.initialGas - floorGas
427+
}
428+
}
429+
411430
if rules.IsKore {
412431
// After EIP-3529: refunds are capped to gasUsed / 5
413432
st.refundGas(params.RefundQuotientEIP3529)
@@ -582,3 +601,13 @@ func (st *StateTransition) processAuthorizationList(authList types.Authorization
582601
}
583602
}
584603
}
604+
605+
// FloorDataGas calculates the minimum gas required for a transaction
606+
// based on its data tokens (EIP-7623).
607+
func FloorDataGas(tokens uint64) (uint64, error) {
608+
// Check for overflow
609+
if (math.MaxUint64-params.TxGas)/params.CostFloorPerToken7623 < tokens {
610+
return 0, types.ErrGasUintOverflow
611+
}
612+
return params.TxGas + tokens*params.CostFloorPerToken7623, nil
613+
}

Diff for: blockchain/system/multicall.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func (caller *ContractCallerForMultiCall) CallContract(ctx context.Context, call
4949
gasPrice := big.NewInt(0) // execute call regardless of the balance of the sender
5050
gasLimit := uint64(1e8) // enough gas limit to execute multicall contract functions
5151
intrinsicGas := uint64(0) // read operation doesn't require intrinsicGas
52+
dataTokens := uint64(0) // read operation has no calldata
5253

5354
// call.From: zero address will be assigned if nothing is specified
5455
// call.To: the target contract address will be assigned by `BoundContract`
@@ -63,7 +64,7 @@ func (caller *ContractCallerForMultiCall) CallContract(ctx context.Context, call
6364
}
6465

6566
msg := types.NewMessage(call.From, call.To, caller.state.GetNonce(call.From),
66-
call.Value, gasLimit, gasPrice, nil, nil, call.Data, false, intrinsicGas, nil, nil)
67+
call.Value, gasLimit, gasPrice, nil, nil, call.Data, false, intrinsicGas, dataTokens, nil, nil)
6768

6869
blockContext := blockchain.NewEVMBlockContext(caller.header, caller.chain, nil)
6970
txContext := blockchain.NewEVMTxContext(msg, caller.header, caller.chain.Config())

Diff for: blockchain/system/rebalance.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func (caller *Kip103ContractCaller) CallContract(ctx context.Context, call kaia.
108108
gasPrice := big.NewInt(0) // execute call regardless of the balance of the sender
109109
gasLimit := uint64(1e8) // enough gas limit to execute kip103 contract functions
110110
intrinsicGas := uint64(0) // read operation doesn't require intrinsicGas
111+
dataTokens := uint64(0) // read operation has no calldata
111112

112113
// call.From: zero address will be assigned if nothing is specified
113114
// call.To: the target contract address will be assigned by `BoundContract`
@@ -122,7 +123,7 @@ func (caller *Kip103ContractCaller) CallContract(ctx context.Context, call kaia.
122123
// return nil, err
123124
//}
124125
msg := types.NewMessage(call.From, call.To, caller.state.GetNonce(call.From),
125-
call.Value, gasLimit, gasPrice, nil, nil, call.Data, false, intrinsicGas, nil, nil)
126+
call.Value, gasLimit, gasPrice, nil, nil, call.Data, false, intrinsicGas, dataTokens, nil, nil)
126127

127128
blockContext := blockchain.NewEVMBlockContext(caller.header, caller.chain, nil)
128129
txContext := blockchain.NewEVMTxContext(msg, caller.header, caller.chain.Config())

Diff for: blockchain/tx_pool.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -836,14 +836,24 @@ func (pool *TxPool) validateTx(tx *types.Transaction) error {
836836
}
837837
}
838838

839-
intrGas, err := tx.IntrinsicGas(pool.currentBlockNumber)
839+
intrGas, dataTokens, err := tx.IntrinsicGas(pool.currentBlockNumber)
840840
intrGas += gasFrom + gasFeePayer
841841
if err != nil {
842842
return err
843843
}
844844
if tx.Gas() < intrGas {
845845
return ErrIntrinsicGas
846846
}
847+
// Ensure the transaction can cover floor data gas.
848+
if pool.rules.IsPrague {
849+
floorGas, err := FloorDataGas(dataTokens)
850+
if err != nil {
851+
return err
852+
}
853+
if tx.Gas() < floorGas {
854+
return fmt.Errorf("%w: gas %v, minimum needed %v", ErrDataFloorGas, tx.Gas(), floorGas)
855+
}
856+
}
847857

848858
// "tx.Validate()" conducts additional validation for each new txType.
849859
// Validate humanReadable address when this tx has "true" in the humanReadable field.

Diff for: blockchain/types/transaction.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ func ErrFeePayer(err error) error {
7272
return fmt.Errorf("invalid fee payer: %s", err)
7373
}
7474

75+
type ValidatedIntrinsicGas struct {
76+
Gas uint64
77+
Tokens uint64
78+
}
79+
7580
type Transaction struct {
7681
data TxInternalData
7782
time time.Time
@@ -90,7 +95,7 @@ type Transaction struct {
9095
validatedFeePayer common.Address
9196
// validatedIntrinsicGas represents intrinsic gas of the transaction to be used for ApplyTransaction().
9297
// This value is set in AsMessageWithAccountKeyPicker().
93-
validatedIntrinsicGas uint64
98+
validatedIntrinsicGas *ValidatedIntrinsicGas
9499
// The account's nonce is checked only if `checkNonce` is true.
95100
checkNonce bool
96101
// This value is set when the tx is invalidated in block tx validation, and is used to remove pending tx in txPool.
@@ -385,15 +390,15 @@ func (tx *Transaction) ValidatedFeePayer() common.Address {
385390
return tx.validatedFeePayer
386391
}
387392

388-
func (tx *Transaction) ValidatedIntrinsicGas() uint64 {
393+
func (tx *Transaction) ValidatedIntrinsicGas() *ValidatedIntrinsicGas {
389394
tx.mu.RLock()
390395
defer tx.mu.RUnlock()
391396
return tx.validatedIntrinsicGas
392397
}
393398
func (tx *Transaction) MakeRPCOutput() map[string]interface{} { return tx.data.MakeRPCOutput() }
394399
func (tx *Transaction) GetTxInternalData() TxInternalData { return tx.data }
395400

396-
func (tx *Transaction) IntrinsicGas(currentBlockNumber uint64) (uint64, error) {
401+
func (tx *Transaction) IntrinsicGas(currentBlockNumber uint64) (uint64, uint64, error) {
397402
return tx.data.IntrinsicGas(currentBlockNumber)
398403
}
399404

@@ -584,7 +589,7 @@ func (tx *Transaction) Execute(vm VM, stateDB StateDB, currentBlockNumber uint64
584589
// XXX Rename message to something less arbitrary?
585590
// TODO-Kaia: Message is removed and this function will return *Transaction.
586591
func (tx *Transaction) AsMessageWithAccountKeyPicker(s Signer, picker AccountKeyPicker, currentBlockNumber uint64) (*Transaction, error) {
587-
intrinsicGas, err := tx.IntrinsicGas(currentBlockNumber)
592+
intrinsicGas, dataTokens, err := tx.IntrinsicGas(currentBlockNumber)
588593
if err != nil {
589594
return nil, err
590595
}
@@ -607,7 +612,7 @@ func (tx *Transaction) AsMessageWithAccountKeyPicker(s Signer, picker AccountKey
607612
}
608613

609614
tx.mu.Lock()
610-
tx.validatedIntrinsicGas = intrinsicGas + gasFrom + gasFeePayer
615+
tx.validatedIntrinsicGas = &ValidatedIntrinsicGas{Gas: intrinsicGas + gasFrom + gasFeePayer, Tokens: dataTokens}
611616
tx.mu.Unlock()
612617

613618
return tx, err
@@ -1079,9 +1084,9 @@ func (t *TransactionsByPriceAndNonce) Clear() {
10791084
}
10801085

10811086
// NewMessage returns a `*Transaction` object with the given arguments.
1082-
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice, gasFeeCap, gasTipCap *big.Int, data []byte, checkNonce bool, intrinsicGas uint64, list AccessList, auth AuthorizationList) *Transaction {
1087+
func NewMessage(from common.Address, to *common.Address, nonce uint64, amount *big.Int, gasLimit uint64, gasPrice, gasFeeCap, gasTipCap *big.Int, data []byte, checkNonce bool, intrinsicGas uint64, dataTokens uint64, list AccessList, auth AuthorizationList) *Transaction {
10831088
transaction := &Transaction{
1084-
validatedIntrinsicGas: intrinsicGas,
1089+
validatedIntrinsicGas: &ValidatedIntrinsicGas{Gas: intrinsicGas, Tokens: dataTokens},
10851090
validatedFeePayer: from,
10861091
validatedSender: from,
10871092
checkNonce: checkNonce,

0 commit comments

Comments
 (0)