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

effectiveGasTip in txPool different from gasTip in processTransactionImpl #1029

Closed
jangko opened this issue Apr 2, 2022 · 0 comments
Closed

Comments

@jangko
Copy link
Contributor

jangko commented Apr 2, 2022

Using steps below(some code omitted for clarity):

let tx = makeTx(recipient, amount)

xp.addLocal(tx, force = true)
xp.jobCommit()

var blk = xp.ethBlock()
let body = BlockBody(
  transactions: blk.txs,
  uncles: blk.uncles
)

clique.prepare(parent, blk.header)
clique.seal(blk)

chain.persistBlocks([blk.header], [body])

gasTip = item.tx.effectiveGasTip(xp.chain.head.baseFee)

vmState.stateDB.addBalance(miner, gasBurned.u256 * priorityFee.u256)

Both gasTip and baseFee in tx_packer.nim are different from priorityFee and baseFee in process_transaction.nim. Because of that, stateRoot produced by txPool is not equal to the one produced by persistBlocks.

This issue reveals, probably we need to lift EIP1559 tx normalization up higher near tx entry point to txPool.
Also need to harmonize between two different baseFee.

proc effectiveGasTip*(tx: Transaction; baseFee: GasPrice): GasPriceEx =

Also in effectiveGasTip, for just one transaction, there are 3 different baseFee

BASEFEE: 875000000
gasPrice: 30000000000

BASEFEE: 1000000000
gasPrice: 30000000000

BASEFEE: 0
gasPrice: 30000000000
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

1 participant