Skip to content

Commit 5d51208

Browse files
authored
internal/ethapi: change default tx type to 0x2 (#33058)
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
1 parent f12f0ec commit 5d51208

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

eth/tracers/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
986986
}
987987
var (
988988
msg = args.ToMessage(blockContext.BaseFee, true)
989-
tx = args.ToTransaction(types.LegacyTxType)
989+
tx = args.ToTransaction(types.DynamicFeeTxType)
990990
traceConfig *TraceConfig
991991
)
992992
// Lower the basefee to 0 to avoid breaking EVM

internal/ethapi/api.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ func (api *TransactionAPI) SendTransaction(ctx context.Context, args Transaction
16071607
return common.Hash{}, err
16081608
}
16091609
// Assemble the transaction and sign with the wallet
1610-
tx := args.ToTransaction(types.LegacyTxType)
1610+
tx := args.ToTransaction(types.DynamicFeeTxType)
16111611

16121612
signed, err := wallet.SignTx(account, tx, api.b.ChainConfig().ChainID)
16131613
if err != nil {
@@ -1629,7 +1629,7 @@ func (api *TransactionAPI) FillTransaction(ctx context.Context, args Transaction
16291629
return nil, err
16301630
}
16311631
// Assemble the transaction and obtain rlp
1632-
tx := args.ToTransaction(types.LegacyTxType)
1632+
tx := args.ToTransaction(types.DynamicFeeTxType)
16331633
data, err := tx.MarshalBinary()
16341634
if err != nil {
16351635
return nil, err
@@ -1825,7 +1825,7 @@ func (api *TransactionAPI) SignTransaction(ctx context.Context, args Transaction
18251825
return nil, err
18261826
}
18271827
// Before actually sign the transaction, ensure the transaction fee is reasonable.
1828-
tx := args.ToTransaction(types.LegacyTxType)
1828+
tx := args.ToTransaction(types.DynamicFeeTxType)
18291829
if err := checkTxFee(tx.GasPrice(), tx.Gas(), api.b.RPCTxFeeCap()); err != nil {
18301830
return nil, err
18311831
}
@@ -1881,7 +1881,7 @@ func (api *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs,
18811881
if err := sendArgs.setDefaults(ctx, api.b, sidecarConfig{}); err != nil {
18821882
return common.Hash{}, err
18831883
}
1884-
matchTx := sendArgs.ToTransaction(types.LegacyTxType)
1884+
matchTx := sendArgs.ToTransaction(types.DynamicFeeTxType)
18851885

18861886
// Before replacing the old transaction, ensure the _new_ transaction fee is reasonable.
18871887
price := matchTx.GasPrice()
@@ -1911,7 +1911,7 @@ func (api *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs,
19111911
if gasLimit != nil && *gasLimit != 0 {
19121912
sendArgs.Gas = gasLimit
19131913
}
1914-
signedTx, err := api.sign(sendArgs.from(), sendArgs.ToTransaction(types.LegacyTxType))
1914+
signedTx, err := api.sign(sendArgs.from(), sendArgs.ToTransaction(types.DynamicFeeTxType))
19151915
if err != nil {
19161916
return common.Hash{}, err
19171917
}

0 commit comments

Comments
 (0)