Skip to content

core/txpool/legacypool: add metrics in txpool for more observability#1893

Merged
manav2401 merged 4 commits intodevelopfrom
more-txpool-metrics
Nov 19, 2025
Merged

core/txpool/legacypool: add metrics in txpool for more observability#1893
manav2401 merged 4 commits intodevelopfrom
more-txpool-metrics

Conversation

@manav2401
Copy link
Copy Markdown
Member

@manav2401 manav2401 commented Nov 19, 2025

Description

This PR captures time taken in different functions using global tx pool lock. The primary one being add function responsible for adding new transactions to the pool.

As the stress tests on amoy resulted in lot of wait time for freeing the lock while calling txpool.Pending, it makes sense to capture some more details about things happening while holding the lock. Because the time increased as the number of transactions being added increased, it makes sense to capture some nuanced metrics while adding a transaction.

The solution isn't very neat as there are multiple code paths. The aim was to not do any behavioural changes which can be hard to review and test. Instead all metric collection related stuff is added to main function. Note that it can be removed or simplified once bottlenecks are identified.

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Breaking changes

Please complete this section if any breaking changes have been made, otherwise delete it

Nodes audience

In case this PR includes changes that must be applied only to a subset of nodes, please specify how you handled it (e.g. by adding a flag with a default value...)

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply
  • Created a task in Jira and informed the team for implementation in Erigon client (if applicable)
  • Includes RPC methods changes, and the Notion documentation has been updated

Cross repository changes

  • This PR requires changes to heimdall
    • In case link the PR here:
  • This PR requires changes to matic-cli
    • In case link the PR here:

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on amoy
  • I have created new e2e tests into express-cli

Manual tests

Please complete this section with the steps you performed if you ran manual tests for this functionality, otherwise delete it

Additional comments

Please post additional comments in this section if you have them, otherwise delete it

@manav2401 manav2401 changed the title core/txpool/legacypool: add metrics in txpool.add for lock observability core/txpool/legacypool: add metrics in txpool for more observability Nov 19, 2025
@manav2401 manav2401 requested a review from a team November 19, 2025 10:40
@sonarqubecloud
Copy link
Copy Markdown

@manav2401 manav2401 merged commit 8b9b344 into develop Nov 19, 2025
9 of 12 checks passed
@manav2401 manav2401 deleted the more-txpool-metrics branch November 19, 2025 16:15
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.

3 participants