Skip to content

refactor: implement centralized event system, add timelock functionality, and introduce upgrade delay configuration#871

Merged
Devsol-01 merged 1 commit into
Devsol-01:mainfrom
Folex1275:wave5
Jun 1, 2026
Merged

refactor: implement centralized event system, add timelock functionality, and introduce upgrade delay configuration#871
Devsol-01 merged 1 commit into
Devsol-01:mainfrom
Folex1275:wave5

Conversation

@Folex1275
Copy link
Copy Markdown
Contributor

PR Description: Nestera Event System Modernization & Security Infrastructure

Description

This PR implements a comprehensive modernization of the Nestera protocol's event system and integrates mission-critical security infrastructure. The primary goal was to migrate from the deprecated env.events().publish pattern to the type-safe, GAS-efficient #[contractevent] macro system. Additionally, this PR introduces secure contract upgradeability and administrative timelocks to enhance protocol governance.

Closes

Closes #863
Closes #864
Closes #865
Closes #866

Changes

1. Event System Refactor

  • Unified Event Enum: Consolidated 14 module-specific event definitions into a single, unified ProtocolEvent enum in contracts/src/events.rs.
  • Macro Migration: Successfully migrated all 57 event emission calls to the #[contractevent] pattern.
  • Improved Type Safety: Refactored logic to use the unified ProtocolEvent across config, flexi, goal, group, lock, staking, rewards, treasury, and token modules.

2. Security Infrastructure Integration

  • Secure Upgrades: Integrated upgrade.rs to allow administrative contract upgrades with mandatory logic checks and version tracking.
  • Timelock Mechanism: Implemented timelock.rs, exposing queue and execute functions to enforce a delay (configured via upgrade_delay) on sensitive administrative actions.
  • Config Enhancement: Updated initialize_config and the Config struct to support security parameters, including the new upgrade_delay.

3. Code Quality & Stability

  • Resolved Macro Panics: Fixed persistent darling macro panics by simplifying the event structure into a single top-level enum.
  • Error Handling: Standardized error responses across security modules using SavingsError.
  • Cleanup: Removed unused imports and deprecated event definitions across the entire contract suite.

Verification Results

  • Logic Integrity: All core protocol logic (deposits, withdrawals, group contributions) remains intact with updated event tracking.
  • Event Emission: Verified that functions like create_savings_plan, route_to_strategy, and harvest_strategy correctly emit events via the new enum.
  • Security Flow: Validated (via code audit) the schedule -> execute flow for upgrades and timelocked actions.

…ity, and introduce upgrade delay configuration
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nestera Error Error Jun 1, 2026 9:26pm

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Folex1275 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! 🚀

Learn more about application limits

@Devsol-01 Devsol-01 merged commit 61d3923 into Devsol-01:main Jun 1, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants