Skip to content

Conversation

@dragann-milosevic
Copy link

@dragann-milosevic dragann-milosevic commented Oct 29, 2025

Fixes issue #47

Summary

Implements the second half of transaction pool RPC support, completing the txpool API integration. Part 2 of 2.

Changes

RPC Methods Implemented

  • txpool_inspect() - Returns transaction summaries (to, value, gas, gas_price) for all pool transactions
  • txpool_content() - Returns full TransactionInfo objects with transaction details
  • anvil_removePoolTransactions(address) - Removes all transactions from a specific sender address

Implementation Details

  • Added extract_tx_fields helper to parse 5 ETH transaction types (Legacy, EIP-2930, EIP-1559, EIP-4844, EIP-7702)
  • Added extract_tx_summary helper to create TxpoolInspectSummary from Substrate extrinsics
  • Added extract_tx_info helper to create full TransactionInfo from extrinsics
  • Added extract_sender helper to efficiently extract sender address from extrinsics

Testing

Added 3 new integration tests:

  • test_txpool_inspect - Tests transaction summaries for pending and queued pools, including nonce gap scenarios
  • test_txpool_content - Tests full transaction info retrieval with sender verification
  • test_remove_pool_transactions - Tests removing all transactions from specific address with multiple senders

Notes

  • Output format is 100% compatible with ETH Anvil
  • All 6 txpool tests pass
  • Completes txpool RPC implementation (6/6 methods)

Copy link

@AlexandruCihodaru AlexandruCihodaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work <3. Left some nits.

Copy link

@re-gius re-gius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link

@alindima alindima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thanks!

Copy link

@re-gius re-gius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dragann-milosevic dragann-milosevic merged commit 1d6e7fa into master Nov 4, 2025
27 of 31 checks passed
@dragann-milosevic dragann-milosevic deleted the dragann-milosevic/anvil-txpool-methods-part2 branch November 4, 2025 16:59
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

Successfully merging this pull request may close these issues.

6 participants