Dynamic Parameter Management (Issue #88)#171
Merged
Merged
Conversation
Contributor
|
It looks good to me @ikemHood |
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.
📋 Basic Information
Type of Change
Related Issues
Closes #88
Priority Level
📝 Detailed Description
What does this PR do?
ConfigManagerproviding:store_config(),get_config(),update_config(),reset_to_defaults().get_current_configuration(),get_configuration_history().validate_configuration_changes(changes: ConfigChanges).AdminAccessControl):update_fee_percentage(admin, new_fee: i128)update_dispute_threshold(admin, new_threshold: i128)update_oracle_timeout(admin, timeout_seconds: u32)update_market_limits(admin, limits: MarketLimits)ConfigUpdateRecordwith history capped at 100, persisted underConfigHistoryand events viaEventEmitter::emit_config_updated.contracts/predictify-hybrid/src/lib.rs:get_current_configuration()get_configuration_history()validate_configuration_changes()update_fee_percentage()update_dispute_threshold()update_oracle_timeout()update_market_limits()fees.rs: fee calculation/collection pull dynamic params viaConfigManager::get_config().markets.rs: validations use dynamicMarketConfigviaConfigManager::get_config().admin.rsusingAdminAccessControl::validate_admin_for_action()with action stringsupdate_feesandupdate_config.Key files and symbols:
contracts/predictify-hybrid/src/config.rsContractConfig,FeeConfig,VotingConfig,MarketConfig,ExtensionConfig,ResolutionConfig,OracleConfigConfigManager::{get_*_config, store_config, get_config, update_config, reset_to_defaults, get_current_configuration, get_configuration_history, validate_configuration_changes, update_fee_percentage, update_dispute_threshold, update_oracle_timeout, update_market_limits}ConfigValidator::{validate_contract_config, validate_fee_config, validate_voting_config, validate_market_config, validate_extension_config, validate_resolution_config, validate_oracle_config}MarketLimits,ConfigChanges,ConfigUpdateRecordcontracts/predictify-hybrid/src/lib.rsinitialize_with_config(env, admin, environment)initialize(env, admin, environment)that delegates toinitialize_with_configcontracts/predictify-hybrid/src/fees.rs: dynamic fee usagecontracts/predictify-hybrid/src/markets.rs: dynamic market validationcontracts/predictify-hybrid/src/admin.rs: admin gating for config updatesWhy is this change needed?
How was this tested?
config.rs:test_config_manager_default_configstest_config_validatortest_config_utilstest_config_storagetest_config_testingtest_configuration_constantsAlternative Solutions Considered
ContractConfigwith centralized validation.🏗️ Smart Contract Specific
Contract Changes
ContractConfig,ConfigHistory)AdminAccessControl::validate_admin_for_action)Oracle Integration
OracleConfig)Market Resolution Logic
Security Considerations
🧪 Testing
Test Coverage
Test Results
Manual Testing Steps
PredictifyHybrid::initialize(env, admin, Environment::<choice>).get_current_configuration()works.validate_configuration_changes()with aConfigChangessubset.update_fee_percentage(admin, X)update_dispute_threshold(admin, Y)update_oracle_timeout(admin, Z)update_market_limits(admin, limits)get_configuration_history()reflect changes.📚 Documentation
Documentation Updates
Breaking Changes
None.
Migration note: Ensure a baseline
ContractConfigis stored at initialization via the newinitializesignature orinitialize_with_config.🔍 Code Quality
Code Review Checklist
Performance Impact
ContractConfigandConfigHistorykeys.Security Review
🚀 Deployment & Integration
Deployment Notes
Integration Points
📊 Impact Assessment
User Impact
Business Impact
✅ Final Checklist
Pre-Submission
💬 Notes for Reviewers