diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index 1a7cf1c118..586df48759 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -195,6 +195,12 @@ func (args *TransactionArgs) setFeeDefaults(ctx context.Context, b Backend, head if args.GasPrice != nil && (args.MaxFeePerGas != nil || args.MaxPriorityFeePerGas != nil) { return errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified") } + // An EIP-7702 set-code transaction cannot be a legacy transaction, so gasPrice + // is incompatible with an authorization list. Reject the combination instead of + // silently dropping the authorization list in ToTransaction. + if args.GasPrice != nil && args.AuthorizationList != nil { + return errors.New("both gasPrice and authorizationList specified") + } // If the tx has completely specified a fee mechanism, no default is needed. // This allows users who are not yet synced past London to get defaults for // other tx values. See https://github.com/ethereum/go-ethereum/pull/23274 diff --git a/internal/ethapi/transaction_args_test.go b/internal/ethapi/transaction_args_test.go index f3fc16dcbb..1d587032bb 100644 --- a/internal/ethapi/transaction_args_test.go +++ b/internal/ethapi/transaction_args_test.go @@ -58,6 +58,7 @@ func TestSetFeeDefaults(t *testing.T) { fortytwo = (*hexutil.Big)(big.NewInt(42)) maxFee = (*hexutil.Big)(new(big.Int).Add(new(big.Int).Mul(b.current.BaseFee, big.NewInt(2)), fortytwo.ToInt())) al = &types.AccessList{types.AccessTuple{Address: common.Address{0xaa}, StorageKeys: []common.Hash{{0x01}}}} + authList = []types.SetCodeAuthorization{{Address: common.Address{0xbb}}} ) tests := []test{ @@ -208,6 +209,13 @@ func TestSetFeeDefaults(t *testing.T) { nil, errors.New("both gasPrice and (maxFeePerGas or maxPriorityFeePerGas) specified"), }, + { + "set gas price and authorization list", + "london", + &TransactionArgs{GasPrice: fortytwo, AuthorizationList: authList}, + nil, + errors.New("both gasPrice and authorizationList specified"), + }, // EIP-4844 { "set gas price and maxFee for blob transaction",