persistence

Prop 148: Persistence DEX Vault Contract Upgrade to v1.2.2 - Fix Query Pools Function for Defunct Pool Handling

This proposal requests approval to upgrade the Persistence DEX Vault contract from version 1.2.1 to 1.2.2 to address a critical bug in the query_pools function that causes failures when defunct pools are present in the system.

The current query_pools function in v1.2.1 attempts to load all pool IDs within a range without checking if pools are defunct, causing query failures when defunct pools exist. This breaks pagination and pool discovery functionality for frontend applications and other integrators.

Additionally, this proposal updates the global WASM CodeUploadAccess parameter to modify the whitelist of addresses permitted to upload new code. This is part of a key rotation security exercise. Specifically, it removes persistence1eld9dngatavy9nqu9j0d5ratjvp2887zsnqp6x and adds persistence10h0xshu73ylnguew3uf9c7tv23nneuecfv50m5, keeping existing addresses intact.

Proposal

The proposal aims to:

  • Fix Query Pools Function Logic: Implement proper iteration with may_load() to skip defunct pools gracefully
  • Enhance Pagination: Improve pagination logic to properly handle gaps in pool IDs caused by defunct pools
  • Add Migration Support: Include MigrateMsg::V1_2_2 variant for seamless upgrade path
  • Maintain Backward Compatibility: Ensure all existing functionality remains unchanged

Technical Changes

  1. Fixed query_pools Function Logic:

    • Before: Used a simple range-based approach that failed when encountering defunct pools
    • After: Implements proper iteration with may_load() to skip defunct pools gracefully
    • Impact: Ensures query_pools only returns active pools and handles pagination correctly
  2. Enhanced Pagination:

    • Improved pagination logic to properly handle gaps in pool IDs caused by defunct pools
    • Maintains correct limit enforcement even when skipping defunct pools
    • Ensures consistent behavior across different query scenarios
  3. Migration Support:

    • Added MigrateMsg::V1_2_2 variant for seamless upgrade path
    • Includes proper version validation (from v1.2.1 to v1.2.2)
    • No state migration required - purely a bug fix upgrade
  4. Governance Params Update (WASM):

    • Update wasm.params.code_upload_access via MsgUpdateParams
    • Address list after update:
      • persistence1raa4kyx5ypz75qqk3566c6slx2mw3qzs6dk8rc
      • persistence1p2ed00z77mp8m9w0pkssur3392letx52sveruq
      • persistence10h0xshu73ylnguew3uf9c7tv23nneuecfv50m5
    • Leaves other WASM params unchanged

Code Quality Improvements

  • Added comprehensive test suite (query_pools.rs) with 6 test cases covering:
    • Basic pool queries
    • Pagination scenarios
    • Defunct pool handling
    • Edge cases and boundary conditions
  • Minor code formatting improvements

Benefits

  • Reliability: Prevents query failures when defunct pools exist
  • User Experience: Frontend applications can reliably fetch pool lists
  • API Stability: Maintains backward compatibility while fixing the bug
  • Future-Proof: Robust handling for mixed active/defunct pool scenarios

Risk Assessment

  • Low Risk: This is purely a bug fix with no breaking changes
  • Backward Compatible: All existing functionality remains unchanged
  • Well Tested: Comprehensive test coverage for all scenarios
  • No State Changes: Migration only updates version, no storage modifications

Deployment Details

  • Current Version: 1.2.1
  • Target Version: 1.2.2
  • Migration Type: MigrateMsg::V1_2_2 {}
  • WASM Hash: Updated in artifacts with new checksum

Voting

  • YES: Vote in favor of upgrading the vault contract to fix the query pools functionality
  • NO: Vote against the implementation
  • NO WITH VETO: Vote if you believe this proposal is spam or fundamentally flawed
  • ABSTAIN: Abstain from voting while contributing to quorum requirements

This upgrade is essential for maintaining the reliability of the Persistence DEX pool querying functionality and ensuring a smooth user experience across all integrating applications.