|
1 |
| -# STILL IN IDEATION PHASE |
| 1 | +# SigScan - Smart Contract Signature Scanner |
2 | 2 |
|
3 |
| --- TODO |
4 |
| -A tool in vs code or your any favourite text editor / code editor which can go through all the contracts in the src/ folder for a foundry / hardhat project and goes thru each function and generates the calldata method hash |
| 3 | +## STILL IN IDEATION PHASE |
5 | 4 |
|
6 |
| -for example : |
| 5 | +### Core Concept |
| 6 | +A tool in VS Code or your favorite text editor/code editor which can go through all the contracts in the `src/` folder for a Foundry/Hardhat project and goes through each function and generates the calldata method hash. |
| 7 | + |
| 8 | +**Example:** |
| 9 | +```bash |
7 | 10 | cast sig "createPair(address, address)" --> 0xc9c65396
|
8 | 11 | cast 4byte 0xc9c65396 --> createPair(address,address)
|
| 12 | +``` |
9 | 13 |
|
10 |
| -Just they dont have to use cast : this tool would automatically take all the fns every second / minute these fns are introduced in the smart contract and saved in the dir / project the tool will automatically execute all the fns methods signature in a verifiable way . |
| 14 | +Just they don't have to use cast: this tool would automatically take all the functions every second/minute these functions are introduced in the smart contract and saved in the dir/project. The tool will automatically execute all the function method signatures in a verifiable way. |
11 | 15 |
|
12 |
| -inherently it should do by making a method.txt in the root of forge/ hardhat project in the format of for all the .sol contracts by implementing this ( would be amazing to be vigilant before sending any transaction via cli ) |
| 16 | +Inherently it should do by making a `methods.txt` in the root of forge/hardhat project in the format of for all the `.sol` contracts by implementing this (would be amazing to be vigilant before sending any transaction via CLI). |
13 | 17 |
|
14 |
| -FOR DEVS : |
| 18 | +**FOR DEVS:** |
| 19 | +``` |
15 | 20 | Method Fn Signature/Method
|
16 | 21 | - createPair(address, address) --> 0xc9c65396
|
17 | 22 | - etc etc --> some signature
|
18 |
| - ``` REQUIREMENT |
19 |
| - cast by foundry / or any other way it should detect if any changes is there in the contracts/src folder / |
| 23 | +``` |
| 24 | + |
| 25 | +**REQUIREMENT:** |
| 26 | +Cast by foundry / or any other way it should detect if any changes are there in the `contracts/src` folder / irl method updates / appending them methods / updating if any changes are there to be performed. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## 🚀 Enhanced Project Structure & Features |
| 31 | + |
| 32 | +### 📁 Project Architecture |
| 33 | +``` |
| 34 | +sigScan/ |
| 35 | +├── README.md |
| 36 | +├── package.json |
| 37 | +├── tsconfig.json |
| 38 | +├── .gitignore |
| 39 | +├── src/ |
| 40 | +│ ├── extension/ # VS Code Extension |
| 41 | +│ │ ├── extension.ts # Main extension entry point |
| 42 | +│ │ ├── commands/ # Extension commands |
| 43 | +│ │ ├── providers/ # Language providers, hover, etc. |
| 44 | +│ │ └── views/ # Custom views and panels |
| 45 | +│ ├── core/ # Core functionality |
| 46 | +│ │ ├── scanner/ # Contract scanning logic |
| 47 | +│ │ ├── parser/ # Solidity parsing |
| 48 | +│ │ ├── watcher/ # File system watching |
| 49 | +│ │ └── signature/ # Signature generation & validation |
| 50 | +│ ├── cli/ # Command Line Interface |
| 51 | +│ │ ├── index.ts # CLI entry point |
| 52 | +│ │ ├── commands/ # CLI commands |
| 53 | +│ │ └── utils/ # CLI utilities |
| 54 | +│ └── utils/ # Shared utilities |
| 55 | +├── tests/ # Test files |
| 56 | +├── docs/ # Documentation |
| 57 | +├── examples/ # Example projects |
| 58 | +└── dist/ # Built files |
| 59 | +``` |
| 60 | + |
| 61 | +### 🔧 Core Features |
| 62 | + |
| 63 | +#### 1. **Project Detection & Support** |
| 64 | +- ✅ Auto-detect Foundry projects (`foundry.toml`) |
| 65 | +- ✅ Auto-detect Hardhat projects (`hardhat.config.js/ts`) |
| 66 | +- ✅ Support multiple contract directories: |
| 67 | + - `src/` (Foundry default) |
| 68 | + - `contracts/` (Hardhat default) |
| 69 | + - `lib/` (Dependencies) |
| 70 | +- ✅ Handle nested contract structures |
| 71 | + |
| 72 | +#### 2. **Enhanced Function Analysis** |
| 73 | +- ✅ Extract all function signatures |
| 74 | +- ✅ Generate method hashes (4-byte selectors) |
| 75 | +- ✅ Detect function visibility (public, external, internal, private) |
| 76 | +- ✅ Identify view/pure vs state-changing functions |
| 77 | +- ✅ Handle function overloading |
| 78 | +- ✅ Parse constructor signatures |
| 79 | +- ✅ Extract event signatures |
| 80 | +- ✅ Extract custom error signatures |
| 81 | +- ✅ Support for modifiers |
| 82 | + |
| 83 | +#### 3. **Real-time Monitoring** |
| 84 | +- ✅ File system watcher for `.sol` files |
| 85 | +- ✅ Incremental updates (only scan changed files) |
| 86 | +- ✅ Git integration to track signature changes |
| 87 | +- ✅ Configurable scan intervals (seconds/minutes) |
| 88 | +- ✅ Backup/restore previous signatures |
| 89 | + |
| 90 | +#### 4. **Output Formats & Storage** |
| 91 | +- ✅ `methods.txt` - Human readable format |
| 92 | +- ✅ `signatures.json` - Structured data |
| 93 | +- ✅ `methods.csv` - Spreadsheet compatible |
| 94 | +- ✅ `signatures.md` - Markdown documentation |
| 95 | +- ✅ Database storage option (SQLite) |
| 96 | + |
| 97 | +### 🛡️ Security & Verification Features |
| 98 | + |
| 99 | +#### 5. **Signature Verification** |
| 100 | +- ✅ Cross-reference with 4byte.directory |
| 101 | +- ✅ Detect potential signature collisions |
| 102 | +- ✅ Warn about common attack vectors |
| 103 | +- ✅ Integration with known vulnerability databases |
| 104 | +- ✅ Signature uniqueness validation |
| 105 | + |
| 106 | +#### 6. **Transaction Safety** |
| 107 | +- ✅ Pre-transaction signature validation |
| 108 | +- ✅ Warning system for unknown signatures |
| 109 | +- ✅ Integration with wallet security tools |
| 110 | +- ✅ Blacklist/whitelist functionality |
| 111 | + |
| 112 | +### 🎨 Developer Experience |
| 113 | + |
| 114 | +#### 7. **VS Code Extension Features** |
| 115 | +- ✅ Hover tooltips showing function signatures |
| 116 | +- ✅ Command palette integration |
| 117 | +- ✅ Status bar indicators |
| 118 | +- ✅ Syntax highlighting for signatures |
| 119 | +- ✅ Signature explorer view panel |
| 120 | +- ✅ Quick actions (copy signature, search 4byte, etc.) |
| 121 | +- ✅ Settings panel for configuration |
| 122 | + |
| 123 | +#### 8. **CLI Tool** |
| 124 | +- ✅ Standalone CLI for CI/CD integration |
| 125 | +- ✅ Batch processing capabilities |
| 126 | +- ✅ Custom filtering options |
| 127 | +- ✅ Watch mode for continuous monitoring |
| 128 | +- ✅ Export to multiple formats |
| 129 | + |
| 130 | +### 📊 Advanced Features |
| 131 | + |
| 132 | +#### 9. **Analytics & Insights** |
| 133 | +- ✅ Function usage statistics |
| 134 | +- ✅ Signature collision detection |
| 135 | +- ✅ Code complexity metrics |
| 136 | +- ✅ Historical signature changes |
| 137 | +- ✅ Dependency analysis |
| 138 | + |
| 139 | +#### 10. **Integration Capabilities** |
| 140 | +- ✅ GitHub Actions integration |
| 141 | +- ✅ CI/CD pipeline support |
| 142 | +- ✅ Webhook notifications |
| 143 | +- ✅ API endpoints for external tools |
| 144 | +- ✅ Plugin architecture for extensibility |
| 145 | + |
| 146 | +### 🔄 Workflow Integration |
| 147 | + |
| 148 | +#### 11. **Development Workflow** |
| 149 | +- ✅ Pre-commit hooks |
| 150 | +- ✅ Pull request checks |
| 151 | +- ✅ Deployment verification |
| 152 | +- ✅ Test coverage for signatures |
| 153 | +- ✅ Documentation generation |
| 154 | + |
| 155 | +#### 12. **Collaboration Features** |
| 156 | +- ✅ Team signature sharing |
| 157 | +- ✅ Signature comments/annotations |
| 158 | +- ✅ Review system for new signatures |
| 159 | +- ✅ Version control integration |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## 🛠️ Technical Stack |
| 164 | + |
| 165 | +- **Language**: TypeScript/JavaScript |
| 166 | +- **VS Code Extension**: VS Code Extension API |
| 167 | +- **CLI**: Commander.js / Yargs |
| 168 | +- **Parsing**: Solidity AST parser |
| 169 | +- **File Watching**: Chokidar |
| 170 | +- **Database**: SQLite / JSON files |
| 171 | +- **Testing**: Jest / Mocha |
| 172 | +- **Build**: Webpack / ESBuild |
| 173 | + |
| 174 | +## 📋 Implementation Phases |
| 175 | + |
| 176 | +### Phase 1: Core Functionality |
| 177 | +- Basic contract scanning |
| 178 | +- Function signature extraction |
| 179 | +- Method hash generation |
| 180 | +- File watching |
| 181 | +- Basic output formats |
| 182 | + |
| 183 | +### Phase 2: VS Code Extension |
| 184 | +- Extension development |
| 185 | +- UI components |
| 186 | +- Command integration |
| 187 | +- Settings management |
| 188 | + |
| 189 | +### Phase 3: Advanced Features |
| 190 | +- Security verification |
| 191 | +- 4byte.directory integration |
| 192 | +- Analytics and insights |
| 193 | +- CI/CD integration |
20 | 194 |
|
21 |
| --- irl method updates / appending them methods / updating if any changes are there to be performed |
| 195 | +### Phase 4: Polish & Distribution |
| 196 | +- Documentation |
| 197 | +- Testing |
| 198 | +- Publishing to VS Code Marketplace |
| 199 | +- Community feedback integration |
0 commit comments