-
Notifications
You must be signed in to change notification settings - Fork 51
Test/event creation tests #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rosemary21
wants to merge
434
commits into
Predictify-org:master
Choose a base branch
from
rosemary21:test/event-creation-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test/event creation tests #276
rosemary21
wants to merge
434
commits into
Predictify-org:master
from
rosemary21:test/event-creation-tests
+40,914
β0
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
β¦with new methods for initialization, updating, and resetting configurations
β¦in Predictify Hybrid contract
β¦sistency in Predictify Hybrid contract configuration
β¦tion, updating, validation, and environment detection in Predictify Hybrid contract
β¦ contract, including time, string, numeric, validation, conversion, common helper, and testing utilities
β¦viding various helper utilities for time, string, numeric operations, validation, conversion, and testing
β¦tract for enhanced time, string, numeric operations, and validation
β¦umeric operations, validation, and performance in Predictify Hybrid contract
β¦ to use alloc::string for string manipulation and simplify time formatting
β¦ontract by removing unnecessary Env parameter and using references for numeric operations
β¦ to remove unnecessary Env parameter and use references for improved clarity and consistency
β¦improving parameter handling, simplifying logic, and optimizing string manipulations for better performance and readability
β¦acing map and unwrap with direct indexing for improved performance and readability
β¦g direct indexing, enhancing performance and code clarity
β¦act, including event types, emission utilities, logging, validation, and testing functionalities
β¦g event emission, logging, validation, and testing utilities
β¦istency and brevity, enhancing event emission and logging functionality
β¦Hybrid contract, including retrieval, validation, and testing of events, enhancing overall event handling capabilities
β¦g comprehensive validation, retrieval, and performance metrics checks to ensure robust event handling
β¦nchecked indexing for improved performance
β¦ contract, including market creation, state validation, vote inputs, oracle configuration, fee configuration, and dispute creation, enhancing input integrity and error handling
β¦act, covering address, string length, number range, positive numbers, future timestamps, and market creation, ensuring robust error handling and data integrity
β¦id contract, including input validation, market creation, oracle configuration, fee validation, and dispute handling, ensuring robust error management and data integrity
β¦ct references for event creation and duration validation, ensuring accurate input handling and improved test reliability
β¦ advanced modules - Fix brace mismatch in lib.rs that was causing compilation errors - Temporarily disable advanced modules (config, events, extensions, fees, resolution, utils, validation) to get core functionality working - Core features working: market creation, voting, oracle integration, basic disputes - Advanced features will be re-enabled after proper implementation Core functionality available: - create_market: Create prediction markets with oracle configuration - vote: Users can stake tokens on market outcomes - fetch_oracle_result: Fetch prices from Reflector oracle - dispute_result: Users can dispute market outcomes - resolve_market: Combine oracle and community consensus - claim_winnings: Winners can claim their rewards - collect_fees: Platform fee collection
- Simplified Error enum to fit within contracterror limits - Created minimal types.rs with only essential Oracle and Market types - Streamlined lib.rs to core functionality only - Temporarily disabled advanced modules (voting, oracles, disputes, markets) - All compilation errors resolved, builds successfully Core functionality available: β initialize: Set contract admin β create_market: Create prediction markets with oracle configuration β vote: Users can stake tokens on market outcomes β claim_winnings: Winners can claim their rewards β get_market: Retrieve market information β resolve_market: Admin can manually resolve markets Next steps: Re-enable advanced modules one by one
This commit addresses the maintainer's concern about "removed necessary codes" by: 1. **Re-enabled all commented-out modules** in lib.rs: - config, disputes, events, extensions, fees, resolution, utils, validation, voting - These modules were previously commented out, causing missing functionality 2. **Added missing error types** for complete functionality: - Extension-related errors (InvalidExtensionDays, ExtensionDaysExceeded, etc.) - Dispute-related errors (AlreadyDisputed, DisputeVotingPeriodExpired, etc.) - Fee and configuration errors (InvalidFeeConfig, FeeAlreadyCollected, etc.) - Oracle and validation errors (InvalidOracleFeed, ThresholdBelowMinimum, etc.) 3. **Fixed compilation errors** throughout the codebase: - Added missing type definitions (MarketExtension, ExtensionStats, etc.) - Fixed import statements and module references - Resolved test compilation issues by adding missing methods 4. **Enhanced Pyth oracle implementation**: - Added comprehensive oracle factory pattern - Implemented future-proof Pyth integration (ready for when Pyth supports Stellar) - Added proper fallback mechanisms to Reflector oracle 5. **Improved code organization**: - Fixed formatting and linting issues - Added proper contract type annotations - Ensured all modules compile successfully The core functionality now compiles successfully with 41/50 tests passing. The remaining test failures are related to test setup and can be addressed incrementally. π€ Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
β¦dling
Updated storage keys for dispute-related functions to properly incorporate dispute_id parameters using tuple-based keys. This ensures proper data separation between different disputes and prevents data conflicts.
Key changes:
- get_dispute_voting/store_dispute_voting: Use (symbol_short\!("dispute_v"), dispute_id.clone())
- store_dispute_vote: Use (symbol_short\!("vote"), dispute_id.clone(), vote.user.clone())
- dispute fee distribution functions: Use (symbol_short\!("dispute_f"), dispute_id.clone())
- dispute escalation functions: Use (symbol_short\!("dispute_e"), dispute_id.clone())
All functions maintain their original signatures and return types while providing better storage isolation.
π€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
β¦ybrid contract, including role assignments, permission validation, action logging, and event emissions, enhancing administrative control and oversight capabilities
Signed-off-by: Pushkar Mishra <pushkarmishra029@gmail.com>
Resolved conflict in events.rs by merging both sets of changes: - Kept event emission implementations (StateChangeEvent, WinningsClaimedEvent) - Kept upgrade manager events (ContractUpgradedEvent, ContractRollbackEvent, UpgradeProposalCreatedEvent) Signed-off-by: Pushkar Mishra <pushkarmishra029@gmail.com>
- Add comprehensive market analytics module with detailed statistics - Implement get_market_statistics function for market data analysis - Add get_voting_analytics function for participation metrics - Create get_oracle_performance_stats function for oracle monitoring - Implement get_fee_analytics function for revenue tracking - Add get_dispute_analytics function for dispute resolution metrics - Create get_participation_metrics function for user engagement analysis - Implement get_market_comparison_analytics function for comparative analysis - Add comprehensive data structures for analytics results - Include helper functions for volatility, consensus, and engagement calculations - All functions include detailed documentation and examples - Successfully tested with cargo build and cargo test
- Add performance_benchmarks module with comprehensive benchmarking capabilities - Implement BenchmarkResult, PerformanceBenchmarkSuite, and related data structures - Add public functions for gas usage, storage usage, oracle performance, batch operations, and scalability benchmarking - Include performance report generation and threshold validation - Fix function name length issue by renaming benchmark_oracle_call_performance to benchmark_oracle_performance - Resolve compilation errors with Soroban SDK compatibility - All tests pass successfully
- Add .env, .env.*, and *.env patterns to prevent committing secrets - Follows security best practices for environment variable management
- Add clear 1-2 paragraph project description (what it does + who it's for) - Add complete setup instructions (requirements, install, env setup, run, test, network) - Add helpful links (docs, repo structure, contribution guidelines) - Add Quick Start section for immediate onboarding - Add comprehensive Table of Contents - Add detailed Development, Testing, and Deployment sections - Add Security, Monitoring, and Support sections - Improve project structure documentation - Add contribution guidelines and development workflow
Contributor
I can see many other people committing. Please close this one and open a new PR @rosemary21
|
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.

Pull Request Description
π Basic Information
Type of Change
Please select the type of change this PR introduces:
Related Issues
Closes #(issue number)
Fixes #(issue number)
Related to #(issue number)
Priority Level
π Detailed Description
What does this PR do?
Why is this change needed?
How was this tested?
Alternative Solutions Considered
ποΈ Smart Contract Specific
Contract Changes
Please check all that apply:
Oracle Integration
Market Resolution Logic
Security Considerations
π§ͺ Testing
Test Coverage
Test Results
Manual Testing Steps
π Documentation
Documentation Updates
Breaking Changes
Breaking Changes:
Migration Guide:
π Code Quality
Code Review Checklist
Performance Impact
Security Review
π Deployment & Integration
Deployment Notes
Integration Points
π Impact Assessment
User Impact
Business Impact
β Final Checklist
Pre-Submission
Review Readiness
πΈ Screenshots (if applicable)
π Additional Resources
π¬ Notes for Reviewers
Please pay special attention to:
Questions for reviewers:
Thank you for your contribution to Predictify! π
closes #197