feat: implement #307 excessive contract size detection and #310 hardc…#425
Merged
mijinummi merged 1 commit intoMay 31, 2026
Conversation
…DTechLabs#310 hardcoded address detection Issue MDTechLabs#307 - Detect Excessive Contract Size - Add packages/rules/src/optimization/deployment/excessive_contract_size.rs - ExcessiveContractSizeRule implements the Rule trait - Estimates bytecode size via AST token count heuristic (2 bytes/token) - Warns at 75% of EVM EIP-170 limit (24,576 bytes) with ViolationSeverity::Warning - Flags at 100% with ViolationSeverity::Critical - Exposes estimate_bytecode_size() helper for dashboards/callers - Full unit test coverage: small contract, size growth, threshold ordering, critical violation on oversized contract - Add packages/rules/src/optimization/deployment/mod.rs (module + re-exports) - Update packages/rules/src/optimization/mod.rs to declare and re-export the new deployment sub-module Issue MDTechLabs#310 - Detect Hardcoded Addresses - Add packages/rules/src/security/configuration/hardcoded_addresses.rs - HardcodedAddressesRule implements the Rule trait - Detects 20-byte Ethereum-style addresses (0x + 40 hex chars) via regex - Negative lookahead prevents false-positive matches on longer hashes - Deduplicates repeated occurrences of the same address across items - Suggests moving addresses to constructor args or config registry - Full unit test coverage: const, let binding, function body, short hex, long hash, deduplication, multiple distinct addresses, severity check - Add packages/rules/src/security/configuration/mod.rs - Add packages/rules/src/security/mod.rs (new top-level security module) - Update packages/rules/src/lib.rs to declare pub mod security and re-export ExcessiveContractSizeRule and HardcodedAddressesRule Closes MDTechLabs#307 Closes MDTechLabs#310
|
@Cybermaxi7 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…oded address detection
Issue #307 - Detect Excessive Contract Size
Issue #310 - Detect Hardcoded Addresses
Closes #307
Closes #310