refactor: replace require strings with custom errors for gas optimiza…#42
refactor: replace require strings with custom errors for gas optimiza…#42Atharva0506 wants to merge 1 commit into
Conversation
…tion - Define 11 custom errors: InvalidSignature, TestimonialDoesNotExist, TestimonialHasBeenDeleted, TokensAreNonTransferrable, OnlyRecipientCanDelete, TestimonialAlreadyDeleted, InsufficientFeePayment, FeeTransferFailed, RefundFailed, SetTreasuryBeforeEnablingFees, TreasuryCannotBeZeroAddress - Replace all 12 require(condition, string) with if/revert patterns - Update 20 expectRevert calls across 5 test files to use error selectors - All 65 tests pass
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThis PR replaces 11 string-based ChangesCustom Error Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Addressed Issues:
Fixes #39
Screenshots/Recordings:
Not applicable. This is a smart contract optimization PR that does not affect the frontend UI.
Additional Notes:
This PR implements a major gas optimization refactor across the
VouchMesmart contract.require(condition, "string")statements withif (!condition) revert CustomError();patterns.InvalidSignature(),TestimonialDoesNotExist()).vm.expectRevert()statements across 5 test files to properly catch the new error selectors.AI Usage Disclosure:
We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.
Check one of the checkboxes below:
I have used the following AI models and tools: Claude opus 4.6 via Antigravity
Checklist
Summary by CodeRabbit
Refactor
Tests