-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Overview
This feature aims to extend the current milestone system to better support synchronization between on-chain data and frontend tracking. The goal is to integrate additional metadata, proof management, and enhanced admin functions to pre-allocate and manage milestone funding before project creation.
Background & Context
- Current State: The existing on-chain
Milestonestructure lacks metadata for frontend tracking and advanced progress tracking. Furthermore, there is no seamless link between the frontend milestone data and the on-chain state. - Admin Needs: The Boundless admin team requires robust functions for pre-allocating milestone funds, configuring milestone requirements, validating allocations, and managing emergency actions.
- Project Relevance: This is a critical enhancement for the Boundless project. For detailed context, please refer to the Current Milestone Implementation and the Interface Definition in the project repository.
Detailed Requirements
1. Enhanced Milestone Structure
Expand the current Milestone structure to include:
- New fields:
metadata_hash: IPFS/Arweave hash for extended milestone data.proof_hash: Optional hash of completion proof documents.verification_status: Status of milestone verification (enum with values like Pending, InReview, etc.).last_updated: Timestamp of the last update.version: Version number to track modifications.
2. New Contract Functions
Implement two sets of functions:
Milestone Metadata Management
update_milestone_metadata: Update the metadata hash for a given milestone.add_milestone_proof: Add proof hash upon milestone completion.get_milestone_metadata: Retrieve the metadata and proof hash.
Verification Status Management
request_verification: Request for verification of a milestone.update_verification_status: Update the status based on admin decision.
3. Storage Structure & Event System Updates
- Define new storage keys to manage milestone metadata, proofs, and history.
- Emit events such as
MetadataUpdated,ProofAdded,VerificationRequested, andVerificationStatusChangedfor transparency.
4. Admin-Specific Functions
Implement the following admin functions:
A. Admin Milestone Pre-allocation
- Function:
admin_allocate_milestones- Validate admin credentials.
- Verify that the total allocation matches the project's funding target.
- Ensure milestone sequence is valid and store the pre-allocated data.
- Emit appropriate allocation events.
B. Admin Milestone Configuration
- Function:
admin_configure_milestone_requirements- Define and set verification requirements, needed documents, and review periods.
- Emit configuration events.
C. Admin Milestone Validation
- Functions:
admin_validate_milestone_allocation: Check totals, sequencing, and funding distribution.admin_get_milestone_allocations: Retrieve all allocations along with history.
D. Admin Emergency Functions
- Functions:
admin_emergency_pause_milestone: Ability to pause a milestone in emergencies.admin_emergency_reallocate_funds: Handle fund reallocation under emergency conditions, ensuring multi-sig authentication.
5. Testing and Documentation
- Create comprehensive tests in
tests/admin_milestone.rsfor:- Milestone pre-allocation
- Allocation and configuration validation
- Emergency functions and edge cases (invalid allocations, unauthorized access, etc.)
- Ensure that documentation is updated to reflect these changes.
Technical Considerations
- Admin authentication is required for all admin functions.
- Pre-allocation can only occur before project creation.
- Emergency functions must incorporate multi-sig validation and generate an audit trail.
- Gas optimization should be considered for bulk operations.
Acceptance Criteria ✅
- Admins can pre-allocate milestone funds accurately before project creation.
- Allocation, configuration, and emergency functions work reliably with proper multi-sig requirements and event emissions.
- A comprehensive testing suite covers all new admin functionalities and edge cases.
- Documentation and event logs are updated accordingly.
Let's ensure the implementation meets all security and technical requirements while integrating seamlessly with frontend operations! 🚀