Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TxPool: Transactions is validated prior to EIP1559 Normalization #1021

Closed
jangko opened this issue Mar 30, 2022 · 3 comments
Closed

TxPool: Transactions is validated prior to EIP1559 Normalization #1021

jangko opened this issue Mar 30, 2022 · 3 comments

Comments

@jangko
Copy link
Contributor

jangko commented Mar 30, 2022

in tx_packer.nim

proc vmExecGrabItem(pst: TxPackerStateRef; item: TxItemRef)
  ...

  if not xp.classifyValidatePacked(vmState, item):         # <---- the call to validateTransaction is in here
    return ok(false) # continue with next account

  let
    accTx = vmState.stateDB.beginSavepoint 
    gasUsed = pst.runTx(item)                              # < ---- EIP1559 Tx normalization is in here

On the other hand, in process_transaction.nim, EIP1559 normalization is done before calling validateTransaction.

log message:

DBG 2022-03-30 11:35:26.817+07:00 processed jobs topics="tx-pool"
  tid: 9936
  file: tx_pool.nim:624
  nJobs: 1

(pending: 0, staged: 1, packed: 0, total: 1, disposed: 0)
DBG 2022-03-30 11:35:26.820+07:00 invalid tx: maxFee is smaller than baseFee
  tid: 9936
  file: validate.nim:282
  maxFee: 0
  baseFee: 875000000

Because of this, I think every legacy tx will never reach packed bucket and will stay in staged bucket because they will never pass transaction validation when we are assembling post london block.

@mjfh can you please take a look at this? I'm not sure if I move the EIP1559 tx normalization out of runTx is safe, maybe something else need to be moved too. Thank you.

@mjfh
Copy link
Contributor

mjfh commented Mar 30, 2022

(pending: 0, staged: 1, packed: 0, total: 1, disposed: 0)
DBG 2022-03-30 11:35:26.820+07:00 invalid tx: maxFee is smaller than baseFee
tid: 9936
file: validate.nim:282
maxFee: 0
baseFee: 875000000

Certainly, this has to be fixed. IMHO it is an error. If I see it right it is a problem in validateTransaction() checking post London fields for a legacy TX? Alternatively the baseFee could be reset in classifyValidatePacked() for legacy transactions.

I guess one should adapt both.

@jangko
Copy link
Contributor Author

jangko commented Mar 30, 2022

If I see it right it is a problem in validateTransaction() checking post London fields for a legacy TX?

it is not a problem if we normalize the tx according to EIP1559 rule. maxFee will be set to gasPrice which is usually bigger than baseFee. my concern is will there any serious problem if EIP1559 tx normalization moved before validateTransaction()?

@jangko
Copy link
Contributor Author

jangko commented Apr 1, 2022

fixed by #1019

@jangko jangko closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants