Task/deprecated registry#898
Open
muhsar27 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #748
Pull Request Description
📋 Basic Information
Type of Change
Please select the type of change this PR introduces:
Related Issues
(No specific issue linked)
Priority Level
📝 Detailed Description
What does this PR do?
This PR implements a centralised, compile-time registry for deprecated contract entrypoints (
DeprecatedRegistryindeprecated.rs), mirroring theEventSchemaRegistrypattern. It:emit_deprecatedcalls inlib.rswith a single, unified registry routing (emit_if_deprecated).list_deprecatedread-only entrypoint so off-chain callers can query all deprecated functions, their recommended replacements, and planned removal versions programmatically.docs/DEPRECATED.md.Why is this change needed?
Previously, deprecated functions lacked a single source of truth for their replacements, deprecation dates, and planned removal versions. This made it difficult for consumers and indexers to discover and migrate away from obsolete entrypoints. This registry solves that by providing all metadata in one place.
How was this tested?
Added 11 focused unit tests in
deprecated.rsthat cover:is_deprecated).Alternative Solutions Considered
We considered storing the registry in contract storage, but chose a compile-time unit struct with
Symbols. This ensures the registry remains zero-cost at rest, requires no storage reads, and consumes minimal gas.🏗️ Smart Contract Specific
Contract Changes
Please check all that apply:
list_deprecated)verify_result,resolve_market)DeprecatedCallevents)Oracle Integration
Market Resolution Logic
Security Considerations
🧪 Testing
Test Coverage
edge_casesanddisputes)Test Results
Manual Testing Steps
lib.rssyntax to ensureDeprecatedRegistry::emit_if_deprecatedsafely replacesemit_deprecated.docs/DEPRECATED.mdaligns precisely with the new code registry.📚 Documentation
Documentation Updates
deprecated.rs)DEPRECATED.mdadded)Breaking Changes
Breaking Changes:
Migration Guide:
docs/DEPRECATED.mdto see the new recommended replacements forverify_resultandresolve_market.🔍 Code Quality
Code Review Checklist
Performance Impact
Symboltypes and operates entirely at compile-time with O(1) matching. No heap allocations for standard lookups.Security Review
🚀 Deployment & Integration
Deployment Notes
Integration Points
list_deprecatedto alert users of upcoming breaking changes dynamically).📊 Impact Assessment
User Impact
Business Impact
✅ Final Checklist
Pre-Submission
Review Readiness
💬 Notes for Reviewers
Please pay special attention to:
Symbolinstead ofStringinDeprecatedEntrypointto enforce zero-cost abstraction at rest.removal_versionfield currently defaults to"TBD"across all entries.Questions for reviewers:
Thank you for your contribution to Predictify! 🚀