mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-09 06:24:27 +00:00
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. |
||
|---|---|---|
| .. | ||
| override | ||
| testdata | ||
| addrlock.go | ||
| api.go | ||
| api_test.go | ||
| backend.go | ||
| capabilities.go | ||
| capabilities_test.go | ||
| dbapi.go | ||
| errors.go | ||
| logtracer.go | ||
| simulate.go | ||
| simulate_test.go | ||
| transaction_args.go | ||
| transaction_args_test.go | ||