Skip to content

Conversation

nisedo
Copy link
Contributor

@nisedo nisedo commented Aug 24, 2025

Summary

Enhances the entry-points printer to display state variables and contract inheritance alongside function entry points, providing a complete view of contract storage and entry points.

Changes

Added Features

  • State variables table with types, storage slots, and inheritance info
  • Full inheritance chain in contract headers (e.g., "Contract is Parent1 is Parent2")
  • Constructor, receive, and fallback functions (previously excluded, now included in purple color)

Output Example

Before:

Screenshot 2025-08-23 at 12 53 46

After:

Screenshot 2025-08-23 at 12 54 01

Files Changed

  • slither/printers/summary/entry_points.py - Enhanced implementation
  • README.md - Updated description

Same usage: slither . --print entry-points

…unctionality

This commit significantly enhances the existing entry-points printer to provide
comprehensive contract analysis by adding state variable information alongside
function entry points.

New Features:
- Display full contract inheritance chain in headers (e.g., "TSwapPool is ERC20 is Context")
- Show state variables table with types, storage slots, and inheritance information
- Include constructors, receive, and fallback functions in addition to regular entry points
- Visual distinction for special functions (purple color for constructor/receive/fallback)
- Enhanced spacing and professional formatting with plural table headers
- Accurate storage slot calculation using Slither's built-in storage layout analysis
- Proper inheritance detection for both variables and functions

Technical Improvements:
- Use contract.storage_variables_ordered for accurate variable ordering
- Use contract.compilation_unit.storage_layout_of() for correct storage slot calculation
- Implement proper inheritance detection using variable.contract != contract
- Refactored code structure with helper methods for better maintainability
- Full pylint compliance (10.00/10 rating)

The enhanced printer provides a complete view of contract storage layout and entry
points, making it invaluable for security analysis, auditing, and contract understanding.
All existing functionality is preserved while adding significant new capabilities.

Files modified:
- slither/printers/summary/entry_points.py: Enhanced implementation
- README.md: Updated printer description

Usage remains the same: slither contract.sol --print entry-points

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@nisedo nisedo self-assigned this Aug 24, 2025
nisedo added 2 commits August 24, 2025 13:39
Following feedback to focus on high-level contract analysis rather than
low-level storage details. The storage slots information is better suited
for the variable-order printer, while entry-points should provide a clean
overview of contract structure.

Changes:
- Removed 'Storage Slots' column from variables table
- Simplified variable info collection (no longer needs storage layout calculation)
- Maintains variables in correct order using storage_variables_ordered
- Cleaner, more focused output differentiating from variable-order printer
@nisedo
Copy link
Contributor Author

nisedo commented Aug 24, 2025

Removed the Storage Slots column for a cleaner output (8c1009a):

Screenshot 2025-08-24 at 14 22 49

@nisedo nisedo marked this pull request as ready for review August 24, 2025 12:32
@nisedo nisedo requested a review from smonicas as a code owner August 24, 2025 12:32
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.

1 participant