Skip to content

[PERF] Refactor Constructor Error Handling to Use Custom Errors #708

Description

@mijinummi

Labels: good-first-issue, solidity, gas-saving, gasguard
Difficulty: Easy
Module: contracts/core/


🧠 Concept

Replace string revert messages in contract constructors (require(initValue != 0, "Zero init")) with custom error declarations (error ZeroInit()).

⚠️ Problem

Revert strings in constructors permanently inflate deployment bytecode size, increasing contract deployment gas costs on every deployment.

📁 Implementation Scope

  • contracts/core/GasGuardFactory.sol
  • test/core/GasGuardFactory.test.ts

🛠️ Requirements

  1. Define custom error declarations for constructor setup checks.
  2. Replace all require(condition, "string") calls in constructors with if (!condition) revert CustomError().

🎯 Acceptance Criteria

  • Measurable reduction in contract deployment gas across core factory contracts.
  • All deployment tests pass with expected custom error reverts.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions