go-ethereum/internal/ethapi
ozpool 2133e014ae
internal/ethapi: reject gasPrice together with authorizationList (#35320)
Closes #35314.

### Problem

`TransactionArgs.ToTransaction` selects `SetCodeTxType` when an
`authorizationList` is present, but then unconditionally downgrades to
`LegacyTxType` when `gasPrice` is set:

```go
case args.AuthorizationList != nil || defaultType == types.SetCodeTxType:
    usedType = types.SetCodeTxType
...
if args.GasPrice != nil {
    usedType = types.LegacyTxType
}
```

A legacy transaction cannot carry an EIP-7702 authorization list, so the
list is silently dropped. `eth_sendTransaction`, `eth_signTransaction`
and `eth_fillTransaction` can then return a plain legacy
transaction/hash even though the requested delegation update or
revocation was never included.

The downgrade also masks a latent issue: `setFeeDefaults` returns early
once `gasPrice` is set (without `authorizationList`) and never fills
`MaxFeePerGas`/`MaxPriorityFeePerGas`. Building the `SetCodeTx` without
the downgrade would hit
`uint256.MustFromBig((*big.Int)(args.MaxFeePerGas))` with a nil fee cap
and panic. Erroring early is therefore the correct behavior.

### Fix

Reject the `gasPrice` + `authorizationList` combination in
`setFeeDefaults`, mirroring the existing `gasPrice` / EIP-1559 guard, so
the request fails explicitly instead of producing a transaction that
omits the authorization list.

### Test

Added a `setFeeDefaults` case asserting the new error. Verified
fail-on-main: with the guard reverted the test fails (`expected error:
both gasPrice and authorizationList specified`); with the guard it
passes. Full `internal/ethapi` package, `go vet` and `gofmt` are clean.

### Note

The same silent-drop applies to `gasPrice` + `blobVersionedHashes` (blob
transactions also cannot be legacy). I scoped this PR to the reported
`authorizationList` case; happy to extend the guard to blob hashes in
the same spot if preferred.
2026-07-08 11:57:31 -06:00
..
override eth/catalyst: implement testing_buildBlockV1 (#33656) 2026-02-23 15:56:31 +01:00
testdata internal/ethapi: Add timestamp to eth_getTransactionByHash (#33709) 2026-02-02 12:20:16 +01:00
addrlock.go all: update license information (#16089) 2018-02-14 13:49:11 +01:00
api.go eth, triedb, internal: add snap/2 sync progress (#35178) 2026-06-17 13:43:51 +08:00
api_test.go internal/ethapi: default block parameter to latest on state methods (#35100) 2026-06-03 12:35:12 +02:00
backend.go internal/ethapi: add eth_capabilities RPC method (#33886) 2026-05-27 10:15:09 +02:00
capabilities.go internal/ethapi: add eth_capabilities RPC method (#33886) 2026-05-27 10:15:09 +02:00
capabilities_test.go internal/ethapi: add eth_capabilities RPC method (#33886) 2026-05-27 10:15:09 +02:00
dbapi.go all: remove concept of public/private API definitions (#25053) 2022-06-21 12:05:43 +03:00
errors.go internal/ethapi: fix base fee too low error code in eth_simulateV1 (#34951) 2026-05-26 09:36:28 +02:00
logtracer.go internal/ethapi: skip transfer capture for callcode in log tracer (#35248) 2026-07-01 15:40:01 +08:00
simulate.go cmd, core, eth, miner: apply 7997 in block building (#35285) 2026-07-07 14:40:25 +02:00
simulate_test.go internal/ethapi: fix gas cap for eth_simulateV1 (#33952) 2026-03-05 09:09:07 +08:00
transaction_args.go internal/ethapi: reject gasPrice together with authorizationList (#35320) 2026-07-08 11:57:31 -06:00
transaction_args_test.go internal/ethapi: reject gasPrice together with authorizationList (#35320) 2026-07-08 11:57:31 -06:00