The contract should use consistent error handling patterns throughout to optimize gas usage and maintain code quality.
The emergencyWithdrawERC20
function uses string-based revert messages while all other functions use custom errors, creating inconsistency and higher gas costs.
Likelihood:
Every time the emergency withdrawal function is called with core tokens
When users or tools parse error messages for different patterns
During contract interactions where gas optimization matters
Impact:
Higher gas costs due to string storage and processing
Inconsistent error handling makes debugging more difficult
Code maintainability decreases due to mixed error patterns
Gas Cost Comparison: This demonstrates the gas difference between string and custom error handling.
Cost Analysis:
Custom errors: ~4 bytes for error selector + parameters (minimal gas)
String errors: ~68 bytes for the long string message (significantly higher gas)
Deployment cost: String errors increase contract size and deployment costs
Runtime cost: String errors cost more to revert with due to longer data
Tooling integration: Mixed error patterns make automated testing and monitoring harder
Why this works:
Consistency: Aligns with the existing custom error pattern used throughout the contract
Gas efficiency: Saves ~64 bytes of string data, reducing deployment and runtime costs
Maintainability: Easier to manage and update error messages from a central location
Tooling compatibility: Better integration with error handling and monitoring systems
Additional considerations:
Consider using error parameters if more context is needed: error CannotWithdrawCoreTokens(address token)
Document all custom errors in NatSpec comments for better developer experience
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.