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

fix(miner): no check anchor tx when return pending tx #361

Closed
wants to merge 1 commit into from

Conversation

jsvisa
Copy link

@jsvisa jsvisa commented Jan 8, 2025

When I'm debugging with foundry-rs/foundry#9622, I found taiko in sometimes doesn't return the pending state, and after some digging, seems it was caused by

// Verify anchor transaction
if len(body.Transactions) != 0 { // Transactions list might be empty when building empty payload.
isAnchor, err := t.ValidateAnchorTx(body.Transactions[0], header)
if err != nil {
return nil, err
}
if !isAnchor {
return nil, ErrAnchorTxNotFound
}
}

As taiko-geth's txpool will receive both users' transaction list and engine's transaction list, for the later one the first tx will always the Anchor transaction, ref https://github.com/taikoxyz/taiko-mono/blob/b781f761d786d32d25877fd7299fc90dab208d82/packages/taiko-client/driver/chain_syncer/blob/syncer.go#L321-L334

In that case, the Verify succeed and miner.Pending returns the pending state.

When the txpool hasn't received the engine_NewPayload, it will only contains the users' trasaction list, and for this case, this Verify will fail.

So I propose to check it again with the error code, if in taiko mode and err is ErrAnchorTxNotFound just return miner's pending state as well.

@davidtaikocha
Copy link
Member

We are not using the term pending in taiko-geth atm: #357 (comment) , and if u want to fetch the real pending transactions in mempool, you should use: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content

@jsvisa
Copy link
Author

jsvisa commented Jan 8, 2025

We are not using the term pending in taiko-geth atm: #357 (comment) , and if u want to fetch the real pending transactions in mempool, you should use: https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content

@davidtaikocha Actually this is not used for the txpool.content RPC, it used for other RPCS like eth_estimateGas to estimate the gas usage for deploy new contracts or interact with contracts.

If pending is not supported, then many third-party tools cannot natively support taiko's ecosystem, eg foundry-rs/foundry#9622 and NomicFoundation/hardhat#6076 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants