Staking 5.0.9

3 August 2025

This release has upgrade notes. Read them before updating — they describe behaviour changes that need your attention.

STAKINGSECURITYPERFORMANCEMAJOR

Core v5.4.1

Release Date: August 3, 2025
Tags: STAKING, SECURITY, PERFORMANCE, MAJOR

Upgrade Notes

Migration

  • Database: run migrations to add the new indexes (automatic with Sequelize sync)
  • Configuration: no configuration changes required

Breaking Changes

  • Position listings are now paginated: the position listing endpoint previously returned an array of positions and now returns an object holding the positions plus pagination details. Anything you have built outside the product that reads that list needs updating.
  • Error responses: errors are now returned in one standard format across all staking endpoints.

Changed

Staking System Security & Reliability

  • Wallet Integration: Complete wallet balance validation and fund management
    • Balance Validation: Added comprehensive wallet balance checks before allowing stakes
    • Atomic Transactions: All financial operations now wrapped in database transactions
    • Wallet Deduction: Proper fund deduction from user wallets when staking
    • Claim Credits: Automatic wallet crediting when users claim earnings
    • Transaction Records: Complete audit trail for all wallet operations
    • Concurrent Operations: Financial operations lock the rows they touch, so simultaneous stakes and claims cannot corrupt one another or deadlock

Admin Management Features

  • Bulk Operations: New endpoints for efficient staking management
    • Position Management: Bulk update multiple staking positions (pause, resume, complete, cancel)
    • Earnings Distribution: Manual earnings distribution with dry-run capability
    • Pool Reordering: Dynamic display order management for staking pools
    • Comprehensive Analytics: Detailed pool performance metrics and user statistics

Performance Optimizations

  • Database Indexing: Strategic indexes for improved query performance
    • Position Indexes: Composite indexes for user+status queries
    • Earning Records: Optimized indexes for claim operations
    • Date-based Queries: Enhanced indexing for time-series data
  • Pagination Support: Efficient data loading for large datasets
    • Position Listings: Added pagination with configurable limits
    • Analytics Queries: Optimized queries with proper limits

Frontend Improvements

  • Error Handling: Robust error boundaries and loading states
    • Error Boundaries: A failing section now shows an error instead of taking the page down
    • Loading States: Skeleton loaders for better UX during data fetching
    • Retry Logic: Automatic retry mechanisms for failed operations
  • Component Updates: Replaced mock data with real API integrations

Error Reporting & Audit Trail

  • Error Messages: Improved error messages with actionable guidance
  • Audit Trail: Comprehensive logging for all staking operations
  • Admin Activity: Complete audit log for administrative actions

Fixed

Critical Security Issues

  • Chain Reference Bug: Fixed an incorrect chain reference on staking positions that caused runtime errors
  • Missing Financial Integrity: Added atomic transactions for all financial operations
    • Prevents partial state updates during staking/claiming operations
    • Ensures consistency between staking records and wallet balances

API Completeness

  • Missing Endpoints: Created all required staking endpoints
    • Pool performance analytics endpoint
    • User earnings history endpoint
    • Admin bulk management endpoints
    • Earnings distribution controls

Validation & Security

  • Input Validation: Comprehensive validation for all staking operations
    • Amount validation with decimal precision checks
    • Pool ID and position ID validation
    • Maximum staking limits enforcement
  • Rate Limiting: Implemented rate limiting on critical operations
    • Staking: 5 requests per minute per user
    • Claims: 10 requests per hour per user
  • Permission Checks: Consistent authorization across all admin endpoints