-
Notifications
You must be signed in to change notification settings - Fork 73
feat: add new report cmd #812
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 adds a new report command to generate comprehensive blockchain analysis reports for Ethereum-compatible chains. The command fetches block and transaction data via RPC, calculates statistics, and outputs results in JSON, HTML, or PDF format with support for concurrent requests and rate limiting.
Key changes:
- New report command with JSON/HTML/PDF output formats
- Concurrent block fetching (configurable, default 10 workers) with rate limiting (default 4 req/s)
- Comprehensive metrics including transaction counts, gas usage, unique addresses, and top-10 analyses
- HTML visualizations with SVG charts and interactive tooltips
- PDF generation using chromedp for headless browser rendering
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod / go.sum | Added chromedp dependencies for PDF generation and viper v1.19.0 (moved from direct to indirect dependency) with related transitive dependency version adjustments |
| cmd/root.go | Registered the new report command in the CLI |
| cmd/report/report.go | Core implementation: flag validation, concurrent RPC fetching with rate limiting, block/transaction data processing, and output generation |
| cmd/report/types.go | Data structures for report, summary statistics, block info, transaction info, and top-10 analyses |
| cmd/report/html.go | HTML generation functions including stat cards, SVG line charts for transactions and gas usage, and top-10 tables |
| cmd/report/pdf.go | PDF generation using chromedp to render HTML to PDF with page settings |
| cmd/report/template.html | HTML template with embedded CSS for styling and JavaScript for chart tooltips |
| cmd/report/usage.md | Documentation covering features, usage examples, and report contents |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 11 out of 12 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move github.com/spf13/viper from a separate require block back to the main require block where it belongs. This restores consistency with the go.mod structure in the main branch. The viper dependency is a direct dependency used for configuration management and should be grouped with other direct dependencies like cobra and pflag.
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
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add validation in generateReport to ensure start and end blocks are not BlockNotSet (math.MaxUint64) before entering the block fetching loop. If endBlock is math.MaxUint64, the loop condition (blockNum <= report.EndBlock) would cause an overflow when blockNum increments past MaxUint64, resulting in an infinite loop. This is defensive programming since the RunE function already resolves BlockNotSet values to actual block numbers before calling generateReport. However, this validation prevents potential bugs if generateReport is called directly or if the smart defaults logic is bypassed. Added comprehensive tests to verify the validation catches all invalid block range scenarios.
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
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
leovct
left a comment
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.
lgtm
closes https://github.com/0xPolygon/devtools/issues/479
Adds a new report command to generate comprehensive blockchain analysis reports for Ethereum-compatible chains. Supports JSON, HTML, and PDF output formats with statistics, visualizations, and performance optimizations.
Features
Usage
JSON
HTML
PDF