-
Notifications
You must be signed in to change notification settings - Fork 71
feat: gas manager for loadtest; add tx-gas-chart #755
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a gas limiting mechanism for the loadtest command to control transaction flow through configurable gas budgets and oscillation curves. The feature aims to enable running loadtests indefinitely while managing gas consumption patterns.
Key changes:
- Adds a new
gaslimiterpackage implementing a gas vault system and oscillating gas provider - Refactors loadtest functions to return transaction objects instead of transaction hashes
- Implements gas budget tracking with configurable oscillation curves for dynamic gas limit control
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/loadtest/gaslimiter/curve.go | Defines base curve interface and configuration for gas oscillation patterns |
| cmd/loadtest/gaslimiter/curve_sine.go | Implements sinusoidal curve for oscillating gas budgets |
| cmd/loadtest/gaslimiter/curve_sine_test.go | Tests sine curve implementation with expected values |
| cmd/loadtest/gaslimiter/gas_vault.go | Implements thread-safe gas budget storage with spend/wait mechanism |
| cmd/loadtest/gaslimiter/gas_provider.go | Base gas provider that watches for new block headers |
| cmd/loadtest/gaslimiter/gas_provider_oscillating.go | Oscillating gas provider that adds gas based on curve values per block |
| cmd/loadtest/gaslimiter/README.md | Documentation for gas limiter components and workflow |
| cmd/loadtest/loadtest.go | Integrates gas limiter into main loadtest loop and refactors transaction handling |
| cmd/loadtest/uniswapv3.go | Updates UniswapV3 loadtest to return transaction object instead of hash |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Fix panic caused by signing a nil transaction in loadTestContractCall. The transaction was being built and assigned to `tx`, but the code was incorrectly trying to sign `rtx` which was declared but never assigned. This caused a segmentation fault when using the `contract-call` mode: panic: runtime error: invalid memory address or nil pointer dereference at cmd/loadtest/loadtest.go:1987 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
closes https://github.com/0xPolygon/devtools/issues/444
This PR adds a Gas Manager to the loadtest command and introduces a new tx-gas-chart visualization tool.
Gas Manager features:
New tx-gas-chart command:
Use cases: