Author: Ian He
Created: 10 Oct 2025
Status: Draft
Motivation/Purpose
Limitations of Original Design If We Allow instant delegation
The original delegation system lacked crucial safeguards to allow instant delegation, creating significant fairness and security vulnerabilities:
Last-Minute Delegation Exploitation
- Delegators could stake large amounts of SQT in the final moments of an era
- This allowed them to capture a disproportionate share of era rewards with minimal time commitment
- Example: A delegator could delegate 1M SQT in the last 5 minutes of a 7-day era and receive rewards equivalent to 7 days of staking
Reward Distribution Manipulation
- Late massive delegations distorted the final reward distribution calculations
- Honest delegators who staked throughout the entire era saw their rewards diluted
- Created perverse incentives for timing-based gaming rather than genuine network participation
Capital Efficiency Imbalance
- No mechanism to differentiate between long-term and opportunistic delegations
- All delegations received equal reward treatment regardless of duration within the era
- Undermined the principle of “fair reward for contribution duration”
Solution Approach
This proposal introduces a quota-based instant delegation system to address these fundamental flaws:
Time-Based Fairness
- 70% era window restriction prevents last-minute delegation sniping
- Ensures minimum commitment period for instant delegation benefits
- Rewards align more closely with actual network participation time
Controlled Delegation Impact
- Per-wallet, per-era quotas limit the disruptive potential of large, timed delegations
- Prevents single actors from manipulating reward distributions at era boundaries
- Maintains stability in reward calculations throughout the era
Description
This proposal implements a comprehensive quota management system for instant delegations that operates across era boundaries with automatic reset functionality. The system introduces several key features to address the original design flaws:
Quota Management
- Per-wallet, per-era instant delegation quotas that automatically reset with each era transition
- Configurable quota limits adjustable via governance parameters
- Real-time quota tracking and enforcement to prevent reward manipulation
Era-Based Fairness Restrictions
- 70% era window restriction specifically designed to prevent last-minute delegation sniping
- After 70% of era completion, new delegations cannot receive instant rewards for that era
- Ensures minimum 30% era participation requirement for any instant delegation rewards
- Automatic handling of era progress calculations to enforce timing rules
Delegation Processing with Fairness Guarantees
- Intelligent splitting of large delegations into instant and pending components
- Reuse of proven
applyRedelegation()
logic for instant rewards processing - Transparent handling that maintains fairness across all participant types
Configuration Flexibility
- Adjustable quota limits via governance parameters to adapt to network needs
- Configurable era window percentage for fine-tuning delegation timing restrictions
- Extensible parameter system for future fairness enhancements
Implementation
The implementation requires modifications across multiple contracts with comprehensive test coverage, specifically designed to eliminate the original system’s vulnerabilities:
Core Contracts
-
Staking.sol
- Implements quota tracking and management to prevent concentrated late-era delegations
- Handles token transfers and balance management with timing considerations
- Adds configuration options for quota parameters and era window settings
- Manages era-based quota resets to maintain consistent fairness across eras
-
StakingManager.sol
- Refactored
delegate()
logic with era progress validation against the 70% window - Implements quota checking and enforcement to limit manipulation impact
- Handles automatic delegation splitting to ensure large stakes don’t bypass timing rules
- Manages era window restrictions to prevent last-minute reward sniping
- Refactored
-
IStaking.sol
- New interface methods supporting fair instant delegation
- Quota management function signatures for controlled delegation
- Configuration parameter definitions for governance-adjusted fairness settings
Technical Features Addressing Original Flaws
- Gas-efficient quota tracking using mapping structures to prevent reward manipulation
- Era progress calculation with percentage-based restrictions specifically targeting last-minute exploits
- Automatic fallback to pending delegations when quotas are exceeded, preventing era-boundary gaming
- Comprehensive event emission for transparent delegation tracking and auditability
Testing & Verification with Edge Cases
- Comprehensive test suite covering last-minute delegation scenarios and quota exhaustion
- Specific tests validating the 70% window restriction prevents final-moment exploitation
- Edge case testing for era transitions to ensure no gaps in quota enforcement
- Reward distribution tests verifying fairness across different delegation timing strategies
- Gas optimization verification and security analysis focused on prevention of timing attacks
The implementation maintains full backward compatibility while adding robust quota management and timing restrictions that directly address the fundamental fairness issues in the original instant delegation design, ensuring rewards are distributed more proportionally to actual network participation time.