Transaction:inferType wrong behaviour #4858
Labels
investigate
Under investigation and may be a bug.
on-deck
This Enhancement or Bug is currently being worked on.
v6
Issues regarding v6
Ethers Version
6.8.0
Search Terms
inferType
Describe the Problem
Rationale
inferTypes()
function adds typeeip2930
incorrectly:https://github.com/ethers-io/ethers.js/blob/main/src.ts/transaction/transaction.ts#L1024
Error description
if the transaction has a
gasPrice
set, it directly adds to a possible transaction type thetype: 1 (eip2930)
.Later on, it checks if it has an
accessList
, so it addstype: 0 (legacy)
.Logic should be the other way around. If it has
gasPrice
, addtype: 0 (legacy)
. And if it also hasaccessList
, then addtype: 1 (eip2930)
.Since the function sorts the types and later on returns the highest one, it will always return
type: 1 (eip2930)
if it hasgasPrice
set.Correct code
Code Snippet
Contract ABI
No response
Errors
No response
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: