internal/ethapi: change default tx type to 0x2 (#33058)
Some checks failed
/ Linux Build (push) Has been cancelled
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled

We still default to legacy txes for methods like eth_sendTransaction,
eth_signTransaction. We can default to 0x2 and if someone would like to
stay on legacy they can do so by setting the `gasPrice` field.

cc @deffrian
This commit is contained in:
Sina M 2025-11-28 15:32:40 +01:00 committed by GitHub
parent f12f0ec0cd
commit 5d51208334
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -986,7 +986,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
}
var (
msg = args.ToMessage(blockContext.BaseFee, true)
tx = args.ToTransaction(types.LegacyTxType)
tx = args.ToTransaction(types.DynamicFeeTxType)
traceConfig *TraceConfig
)
// Lower the basefee to 0 to avoid breaking EVM

View file

@ -1607,7 +1607,7 @@ func (api *TransactionAPI) SendTransaction(ctx context.Context, args Transaction
return common.Hash{}, err
}
// Assemble the transaction and sign with the wallet
tx := args.ToTransaction(types.LegacyTxType)
tx := args.ToTransaction(types.DynamicFeeTxType)
signed, err := wallet.SignTx(account, tx, api.b.ChainConfig().ChainID)
if err != nil {
@ -1629,7 +1629,7 @@ func (api *TransactionAPI) FillTransaction(ctx context.Context, args Transaction
return nil, err
}
// Assemble the transaction and obtain rlp
tx := args.ToTransaction(types.LegacyTxType)
tx := args.ToTransaction(types.DynamicFeeTxType)
data, err := tx.MarshalBinary()
if err != nil {
return nil, err
@ -1825,7 +1825,7 @@ func (api *TransactionAPI) SignTransaction(ctx context.Context, args Transaction
return nil, err
}
// Before actually sign the transaction, ensure the transaction fee is reasonable.
tx := args.ToTransaction(types.LegacyTxType)
tx := args.ToTransaction(types.DynamicFeeTxType)
if err := checkTxFee(tx.GasPrice(), tx.Gas(), api.b.RPCTxFeeCap()); err != nil {
return nil, err
}
@ -1881,7 +1881,7 @@ func (api *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs,
if err := sendArgs.setDefaults(ctx, api.b, sidecarConfig{}); err != nil {
return common.Hash{}, err
}
matchTx := sendArgs.ToTransaction(types.LegacyTxType)
matchTx := sendArgs.ToTransaction(types.DynamicFeeTxType)
// Before replacing the old transaction, ensure the _new_ transaction fee is reasonable.
price := matchTx.GasPrice()
@ -1911,7 +1911,7 @@ func (api *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs,
if gasLimit != nil && *gasLimit != 0 {
sendArgs.Gas = gasLimit
}
signedTx, err := api.sign(sendArgs.from(), sendArgs.ToTransaction(types.LegacyTxType))
signedTx, err := api.sign(sendArgs.from(), sendArgs.ToTransaction(types.DynamicFeeTxType))
if err != nil {
return common.Hash{}, err
}