-
Notifications
You must be signed in to change notification settings - Fork 3
feat: handle new (hash) type of ruling options #203
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new ruling option by adding a "hash" type and bumps the version of the "@reality.eth/reality-eth-lib" dependency. Key changes include:
- Adding a "hash" entry to the QuestionTypes enumeration.
- Inserting a console.log statement in the convertToRealitioFormat function for debugging purposes.
- Upgrading the "@reality.eth/reality-eth-lib" dependency and adding a resolutions block for "html-to-text".
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/components/disputeDetails.js | Added support for a new "hash" ruling option and a debugging log |
package.json | Upgraded dependency versions and added resolutions configuration |
Comments suppressed due to low confidence (1)
src/components/disputeDetails.js:25
- [nitpick] Ensure that the new 'hash' type is properly processed in the convertToRealitioFormat function, and add unit tests to verify its behavior alongside other types.
hash: "Hash"
src/components/disputeDetails.js
Outdated
|
||
console.log({currentRuling,metaEvidenceJSON}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove or disable the console.log debug statement before merging to production to prevent exposing internal state.
console.log({currentRuling,metaEvidenceJSON}) |
Copilot uses AI. Check for mistakes.
bugbot run |
…oFormat - Add proper hex character validation for hash type rulings - Apply -1 offset to hash types for consistency with numeric types
- Fixed precision loss in hash type rulings by conditionally applying parseInt() - For hash types, preserve raw string value to maintain full precision - For other types, continue using parseInt() as before - Added descriptive error for scientific notation edge cases Fixes issue where large hash values like 0x0386adbca7661db55f3ecfc221735565459a4ed5722db980ff536fda79f1b384 were being converted to scientific notation (1.5948951406472317e+75) causing precision loss
- Removed console.log/console.debug statements from production code - Removed unused debug import from prettier/doc - Improved error message for better user experience - Added documentation comments explaining hash precision preservation - Cleaned up component lifecycle methods Code is now production-ready with proper error handling and documentation.
Improves code quality by using const for immutable variables.
- Extracted helper methods for hash value processing - Created renderDecisionAlerts helper to reduce nested conditionals - Created renderCrowdfundingCards helper for different question types - Created renderVariableTypeCrowdfundingCards for variable type rulings - Simplified main render method with early return pattern - Reduced maximum nesting from 5+ levels to 3 levels max Improves code readability and maintainability by eliminating 'spaghetti code'.
- Added parentheses around single parameters for consistency - Fixed loose equality operators (== to ===) for better type safety - Ensured consistent spacing around arrow functions - Applied consistent formatting across all arrow functions Improves code readability, predictability, and maintainability by following shared coding conventions for arrow function usage.
- Extract magic numbers to improve code readability and maintainability - Add constants for precision scaling, percentage calculations, dispute periods - Replace hardcoded values in disputeDetails.js, app.js, and disputeTimeline.js - Complies with javascript:S109 rule while preserving existing functionality
Fixed bug where Object.keys(contributions) string keys were not properly compared with numeric currentRuling, causing duplicate crowdfunding cards. Convert currentRuling to string for proper comparison.
- Add 'hash' to isVariableType check in renderVariableTypeCrowdfundingCards - This allows users to contribute to appeals for hash-type rulings - Hash types should be treated as variable input types like uint, int, string, datetime
…ty bug Fixed bit comparison from bit === 1 to bit === '1' since bit is a string from binary representation split, not a number. This was preventing correct mapping of bits to titles in multiple-select questions.
|
No description provided.