-
Notifications
You must be signed in to change notification settings - Fork 46
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
Court configs: new oracle court, edited spanish non-technical court #1848
Conversation
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces comprehensive updates to court configurations across multiple environments (devnet, testnet, and mainnet-neo). The changes involve adding new courts like "General Court", "Curation", "English Language", "Corte de Disputas de Consumo y Vecindad", and "Oracle Court" to various JSON configuration files. The modifications include adjusting court parameters such as minimum stake, juror fees, and court jump thresholds. Additionally, the project's package scripts have been expanded to support populating these new court configurations, and related frontend components have been updated to accommodate the new court structure. Changes
Poem
Possibly related PRs
Suggested Labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (15)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for kleros-v2-university ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kleros-v2-neo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (6)
contracts/scripts/populatePolicyRegistry.ts (1)
30-30
: Add Parameter Validation forstart
While adding an optional parameter
start
is a great enhancement for controlling which courts to populate, consider validating negative or out-of-bounds values more explicitly. By default, array slicing will return an empty array ifstart
exceeds the array length, but surfacing a warning or error might preempt unintended behavior.contracts/scripts/populateCourts.ts (2)
Line range hint
53-57
: Validate Negative or Largestart
ValuesSimilar to the
populate:policy-registry
script, adding an optionalstart
is beneficial. Consider explicitly warning or validating ifstart
is negative or beyond the length ofcourtsV2
, to prevent unintentional slices that yield no changes or partial changes.
153-162
: Logging and Slicing Behavior
- Logging
The log statement at line 156, “Keeping only the first X courts, starting from Y,” is a good aid. Consider adding an explicit log if no courts remain after slicing, for transparency.- Reversing the Order
Lines 159-162 properly check thereverse
flag before inverting the array. This approach is clear and avoids reversing twice ifreverse
is false.- Wait Between Calls
The timeout uses 100ms between population calls. If usage scales or if there’s a need to minimize network overhead, you might parametrize this delay or allow skipping it in a hurry scenario.contracts/config/policies.v2/Consumo-y-Vecindad.json (1)
1-6
: Add Polish to Policy SummaryThe newly introduced file thoroughly describes “Corte de Disputas de Consumo y Vecindad.” The content is clear and well-structured. However, the "summary" field is empty (line 4). Consider either removing it if not needed or adding a concise one-line summary to maintain consistency with other courts’ policies.
contracts/config/courts.v2.testnet.json (1)
19-26
: Curation Court Parameter TuningThe
alpha
of 3100 indicates a 31% penalty at final appeal, which is unique compared to the 50% in other courts. If that’s intentional to promote slightly more lenient or experimental curation decisions, it’s fine. Otherwise, review it for consistency.contracts/config/policies.v2/Oracle-Court-Policy.json (1)
4-4
: Consider adding guidelines for handling time-sensitive disputes.The policy comprehensively covers various scenarios but could benefit from additional guidelines for handling time-sensitive prediction market disputes where delays in resolution could impact market outcomes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
contracts/config/courts.v2.devnet.json
(3 hunks)contracts/config/courts.v2.mainnet-neo.json
(2 hunks)contracts/config/courts.v2.testnet.json
(4 hunks)contracts/config/policies.v2.devnet.json
(1 hunks)contracts/config/policies.v2.mainnet-neo.json
(1 hunks)contracts/config/policies.v2.testnet.json
(1 hunks)contracts/config/policies.v2/Consumo-y-Vecindad.json
(1 hunks)contracts/config/policies.v2/Oracle-Court-Policy.json
(1 hunks)contracts/package.json
(1 hunks)contracts/scripts/populateCourts.ts
(4 hunks)contracts/scripts/populatePolicyRegistry.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: contracts-testing
- GitHub Check: Analyze (javascript)
- GitHub Check: dependency-review
🔇 Additional comments (24)
contracts/scripts/populatePolicyRegistry.ts (1)
98-102
: Confirm Edge Cases for Array SlicingThe slicing logic correctly adjusts the slice range based on
start
andmaxNumberOfCourts
. However, consider the following edge cases:
• Ifstart
is larger thanpoliciesV2.length
, the resulting slice will be empty.
• IfmaxNumberOfCourts
is negative (accidentally or otherwise), the calculation forend
might be less thanstart
.Although JavaScript handles these gracefully by returning an empty slice, logging a notice when no policies are sliced could help retain clarity and prevent silent no-ops.
contracts/scripts/populateCourts.ts (2)
65-65
: Ensure Reversed Population Won’t Break Parent-Child ReferencesThe
reverse
flag is a handy way to modify courts in descending order of IDs. However, creating or updating a child court before its parent exists might cause problems if the parent is not yet recognized on-chain. Double-check that all parent courts (like court ID 1) have been created before child courts are processed in reverse.
138-138
: Directly AssigningcourtsV2ArbitrumDevnet
Previously,
courtsV2ArbitrumDevnet
was transformed viaparametersProductionToDev
, but now you’re assigning it directly. Ensure that any environment-specific parameter overrides (e.g., for a dev environment) are intentionally not required in this new approach.contracts/config/courts.v2.testnet.json (4)
Line range hint
3-17
: Check HighminStake
andjurorsForCourtJump
for General CourtThe “General Court” has a relatively high
minStake
(150 ETH) and a largejurorsForCourtJump
(511). Ensure this aligns with your testnet usage scenarios, especially if the main goal is to allow easier or more frequent testing of stake thresholds.
Line range hint
35-48
: English Language Court ParametersThis configuration largely mirrors other specialized courts. The
hiddenVotes
flag is set tofalse
, consistent with the notion of transparent deliberations in a language-specific context. No issues here.
49-65
: Introducing “Corte de Disputas de Consumo y Vecindad”Confirmed alignment with the newly added policy file. The parameters (
alpha
,minStake
,feeForJuror
,jurorsForCourtJump: 63
) match the moderate-complexity usage described in the policy. Looks good.
66-80
: Oracle Court as a Specialized TierThe “Oracle Court” (ID 5) uses the same
minStake
as neighboring courts, but with a smallerjurorsForCourtJump: 31
. Consider verifying that 31 jurors is sufficient to handle the advanced oracles-based context.contracts/config/courts.v2.devnet.json (3)
7-7
: Verify the significant reductions in minStake and feeForJuror values.The minStake and feeForJuror values have been significantly reduced across multiple courts:
- General Court: ~99.7% reduction in minStake, ~99.9% reduction in feeForJuror
- Curation: ~99.6% reduction in minStake, ~99.9% reduction in feeForJuror
- English Language: ~99.8% reduction in minStake, ~99.9% reduction in feeForJuror
These substantial reductions could significantly impact the court's economics and security. Please confirm if these reductions are intentional and have been properly analyzed for their impact on:
- Court security (lower stakes might increase vulnerability to attacks)
- Juror incentives (lower fees might reduce participation)
- Economic sustainability of the courts
Also applies to: 9-9, 23-23, 25-25, 39-39, 41-41
51-64
: Review configuration for the new Spanish non-technical court.The configuration for "Corte de Disputas de Consumo y Vecindad" looks reasonable with:
- Appropriate parent court (General Court)
- Standard minStake and feeForJuror values
- Reasonable timesPerPeriod values for a consumer disputes court
67-80
: Review configuration for the new Oracle court (KIP-72).The configuration for "Oracle Court" looks reasonable with:
- Appropriate parent court (General Court)
- Standard minStake and feeForJuror values
- Reasonable timesPerPeriod values for real-world event reporting
contracts/package.json (1)
55-60
: LGTM! New scripts for court and policy population.The added scripts follow consistent naming and implementation patterns for different networks:
populate:courts:*
for court populationpopulate:policies:*
for policy registry populationcontracts/config/policies.v2/Oracle-Court-Policy.json (2)
2-3
: LGTM! Clear court purpose definition.The court purpose is well-defined and focused on real-world event reporting.
5-5
: LGTM! Clear required skills definition.The required skills are well-defined and appropriate for the court's purpose.
contracts/config/courts.v2.mainnet-neo.json (2)
Line range hint
451-465
: LGTM! Renamed Spanish non-technical court.The court name change from "Blockchain No Técnica" to "Corte de Disputas de Consumo y Vecindad" better reflects its purpose while maintaining its configuration.
467-480
: LGTM! New Oracle court configuration.The Oracle Court configuration is consistent with other environments and has appropriate values for mainnet:
- Higher minStake (5000000000000000000000) for increased security
- Standard feeForJuror (6900000000000000) for juror incentivization
- Reasonable timesPerPeriod values for real-world event reporting
contracts/config/policies.v2.devnet.json (3)
11-11
: LGTM! Improved court descriptions.The descriptions for Curation and English Language courts have been improved:
- Removed unnecessary line breaks
- Added clearer guidelines for content disputes
Also applies to: 19-22
26-31
: LGTM! Clear policy for Spanish non-technical court.The policy for "Corte de Disputas de Consumo y Vecindad" is well-defined with:
- Clear scope and purpose
- Appropriate required skills
- Relevant external resources
34-39
: LGTM! Comprehensive Oracle court policy.The Oracle Court policy is thorough and well-structured with:
- Clear purpose and scope
- Detailed arbitration guidelines
- Appropriate required skills
contracts/config/policies.v2.testnet.json (4)
11-11
: LGTM!The formatting change to the description maintains the same semantic meaning.
19-19
: LGTM! Clear policies added.The added summary section improves clarity by specifying:
- How to handle large content disputes (>10,000 words)
- Policy on accepting different English variations
26-31
: LGTM! Well-defined scope for Spanish civil disputes court.The new court configuration is comprehensive with:
- Clear purpose for handling civil and commercial disputes
- Specific scope including consumer protection
- Well-defined required skills
✅ Verification successful
IPFS URI verification successful - content matches policy configuration
The IPFS content at QmVnqEpQpAeYvdfuPjxnGEvZG7ui7kFz6hhaskpNRgpjk1 is accessible and contains the exact policy data as configured in the JSON file.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the IPFS URI is accessible and contains the correct policy curl -s "https://ipfs.io/ipfs/QmVnqEpQpAeYvdfuPjxnGEvZG7ui7kFz6hhaskpNRgpjk1"Length of output: 1013
34-39
: LGTM! Comprehensive Oracle court configuration.The new Oracle court is well-defined with:
- Clear purpose for real-world event reporting
- Detailed policies for prediction market disputes
- Specific guidelines for handling edge cases
- Appropriate required skills for jurors
✅ Verification successful
IPFS content verification successful
The IPFS URI is accessible and its content exactly matches the Oracle Court configuration in the PR.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the IPFS URI is accessible and contains the correct policy curl -s "https://ipfs.io/ipfs/QmRNKyST212j2DLLkA7WDBDH65tcGAVxiTkJ54LsZkVat7"Length of output: 8505
contracts/config/policies.v2.mainnet-neo.json (2)
224-229
: LGTM! Consistent with testnet configuration.The Spanish civil disputes court configuration maintains parity with the testnet version, successfully replacing the previous "Blockchain No Técnica" court.
232-237
: LGTM! Consistent with testnet configuration.The Oracle court configuration maintains parity with the testnet version, ensuring consistent behavior across networks.
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
e76fffc
to
ad79247
Compare
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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.
Actionable comments posted: 3
🧹 Nitpick comments (4)
contracts/scripts/setPoliciesURIs.sh (2)
3-7
: Enhance input validation.Consider adding these validations before processing:
- Check if input files exist
- Verify read/write permissions on input files
if [ "$#" -lt 1 ]; then echo "Usage: $0 <input_policies_file1> [input_policies_file2 ...]" exit 1 fi + +# Validate file existence and permissions +for file in "$@"; do + if [ ! -f "$file" ]; then + echo "Error: File $file does not exist" + exit 1 + fi + if [ ! -r "$file" ] || [ ! -w "$file" ]; then + echo "Error: Insufficient permissions for $file" + exit 1 + fi +done
1-2
: Add comprehensive documentation.Please add a documentation header that includes:
- Script purpose and functionality
- Prerequisites (IPFS daemon, jq)
- Usage examples
- Error handling behavior
#!/bin/bash +# setPoliciesURIs.sh +# +# Description: +# Updates policy JSON files with IPFS URIs for court configurations. +# +# Prerequisites: +# - IPFS daemon must be running +# - jq must be installed +# +# Usage: +# ./setPoliciesURIs.sh <input_policies_file1> [input_policies_file2 ...] +# +# Example: +# ./setPoliciesURIs.sh config/policies.v2.devnet.json +# +# Error Handling: +# - Creates backups before modifications +# - Validates JSON structure +# - Cleans up temporary files on failurecontracts/config/policies.v2.mainnet-neo.json (2)
231-237
: Enhance readability of Oracle Court rules.The Oracle Court configuration is comprehensive and well-structured. Consider the following improvements:
- Format examples consistently using markdown blockquotes for better readability
- Update examples to use more recent or future dates to avoid confusion (e.g., replace "2020 US presidential election" with "2024 US presidential election")
Apply this diff to improve example formatting:
"rules": "The following rules are subsidiary and will apply only if no contrary provisions are outlined in the primary document or other rules or sources relevant to resolving the specific question. In such cases, jurors should adhere to these standard guidelines for resolution.\n### Refuse to Arbitrate\n\nThe following questions must resolve as \"Refuse to Arbitrate\":\n\n**1. Invalid answers:** Questions in which none of the answers are valid.\n\n -*Refuse to Arbitrate: A Prediction Market question: \"Which movie will win the Best Picture award at the 2024 Oscars Academy Awards?\" with outcomes \"Barbie\" and \"Poor Things\" (the actual winner was \"Oppenheimer\").*\n\n +> *Refuse to Arbitrate: A Prediction Market question: \"Which movie will win the Best Picture award at the 2024 Oscars Academy Awards?\" with outcomes \"Barbie\" and \"Poor Things\" (the actual winner was \"Oppenheimer\").*\n\n
234-234
: Update examples to use more recent or future dates.Several examples reference past events from 2020-2021. Consider updating these to use more recent or future dates to maintain relevance.
Examples to update:
- "2020 US presidential election" → "2024 US presidential election"
- "Copa America 2021" → "Copa America 2024"
- "2021 Turing award" → "2024 Turing award"
🛑 Comments failed to post (3)
contracts/scripts/setPoliciesURIs.sh (3)
61-68: 🛠️ Refactor suggestion
Improve file update safety measures.
Add safeguards for file modifications:
- Create backup before modification
- Validate updated JSON structure
- Verify successful updates
# Step 2: Update the input file with URIs echo "Updating URIs in $INPUT_FILE..." + +# Create backup +cp "$INPUT_FILE" "${INPUT_FILE}.bak" || { + echo "Error: Failed to create backup" + cleanup +} + jq --slurpfile hashes "$HASHES_FILE" ' map(. + {uri: ("/ipfs/" + ($hashes[0][.court | tostring]))}) -' "$INPUT_FILE" > "${INPUT_FILE}.tmp" && mv "${INPUT_FILE}.tmp" "$INPUT_FILE" +' "$INPUT_FILE" > "${INPUT_FILE}.tmp" || { + echo "Error: Failed to update URIs" + mv "${INPUT_FILE}.bak" "$INPUT_FILE" + cleanup +} + +# Validate updated JSON +if ! jq empty "${INPUT_FILE}.tmp" 2>/dev/null; then + echo "Error: Invalid JSON after update" + mv "${INPUT_FILE}.bak" "$INPUT_FILE" + rm "${INPUT_FILE}.tmp" + cleanup +fi + +mv "${INPUT_FILE}.tmp" "$INPUT_FILE" rm "$HASHES_FILE" +rm "${INPUT_FILE}.bak" echo "Done! URIs updated in $INPUT_FILE"Committable suggestion skipped: line range outside the PR's diff.
19-25: 🛠️ Refactor suggestion
Add error handling and cleanup mechanisms.
Several improvements needed for robustness:
- Handle directory creation failures
- Add cleanup on script interruption
- Sanitize directory path construction
+# Cleanup function +cleanup() { + [ -f "$HASHES_FILE" ] && rm "$HASHES_FILE" + exit 1 +} + +# Set trap for cleanup +trap cleanup INT TERM + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -INPUT_FILE_WITHOUT_EXTENSION="${INPUT_FILE%.json}" +# Sanitize input file name for directory creation +INPUT_FILE_WITHOUT_EXTENSION=$(basename "${INPUT_FILE%.json}" | tr -cd '[:alnum:]-_') POLICIES_DIR="$SCRIPT_DIR/../$INPUT_FILE_WITHOUT_EXTENSION" HASHES_FILE=$(mktemp) echo "Creating $POLICIES_DIR directory..." -mkdir -p $POLICIES_DIR +mkdir -p "$POLICIES_DIR" || { + echo "Error: Failed to create directory $POLICIES_DIR" + cleanup +}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.# Cleanup function cleanup() { [ -f "$HASHES_FILE" ] && rm "$HASHES_FILE" exit 1 } # Set trap for cleanup trap cleanup INT TERM SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # Sanitize input file name for directory creation INPUT_FILE_WITHOUT_EXTENSION=$(basename "${INPUT_FILE%.json}" | tr -cd '[:alnum:]-_') POLICIES_DIR="$SCRIPT_DIR/../$INPUT_FILE_WITHOUT_EXTENSION" HASHES_FILE=$(mktemp) echo "Creating $POLICIES_DIR directory..." mkdir -p "$POLICIES_DIR" || { echo "Error: Failed to create directory $POLICIES_DIR" cleanup }
32-57:
⚠️ Potential issueAdd IPFS availability check and improve error handling.
Critical improvements needed for security and reliability:
- Validate IPFS daemon availability
- Add error handling for JSON operations
- Prevent race conditions
- Validate policy content structure
+# Check IPFS daemon +if ! ipfs swarm peers >/dev/null 2>&1; then + echo "Error: IPFS daemon is not running" + cleanup +fi + +# Validate policy structure +if ! jq -e 'all(has("name") and has("court"))' "$INPUT_FILE" >/dev/null 2>&1; then + echo "Error: Invalid policy structure in $INPUT_FILE" + cleanup +fi + jq -c '.[]' "$INPUT_FILE" | while read -r policy; do - name=$(echo "$policy" | jq -r '.name' | tr ' ' '-') - court=$(echo "$policy" | jq -r '.court') + # Extract and validate required fields + name=$(echo "$policy" | jq -r '.name // empty' | tr ' ' '-') + court=$(echo "$policy" | jq -r '.court // empty') + if [ -z "$name" ] || [ -z "$court" ]; then + echo "Error: Missing required fields in policy" + continue + fi + policy_filepath="$POLICIES_DIR/${name}-Policy.json" # Remove the uri field if it exists and save to a temporary file - echo "$policy" | jq 'del(.uri)' > "$policy_filepath" + if ! echo "$policy" | jq 'del(.uri)' > "$policy_filepath"; then + echo "Error: Failed to process policy JSON" + continue + fi # Get IPFS hash - ipfs_hash=$(ipfs add -Q "$policy_filepath") + ipfs_hash=$(ipfs add --offline -Q "$policy_filepath") if [ -n "$ipfs_hash" ]; then📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.# Check IPFS daemon if ! ipfs swarm peers >/dev/null 2>&1; then echo "Error: IPFS daemon is not running" cleanup fi # Validate policy structure if ! jq -e 'all(has("name") and has("court"))' "$INPUT_FILE" >/dev/null 2>&1; then echo "Error: Invalid policy structure in $INPUT_FILE" cleanup fi jq -c '.[]' "$INPUT_FILE" | while read -r policy; do # Extract and validate required fields name=$(echo "$policy" | jq -r '.name // empty' | tr ' ' '-') court=$(echo "$policy" | jq -r '.court // empty') if [ -z "$name" ] || [ -z "$court" ]; then echo "Error: Missing required fields in policy" continue fi policy_filepath="$POLICIES_DIR/${name}-Policy.json" # Remove the uri field if it exists and save to a temporary file if ! echo "$policy" | jq 'del(.uri)' > "$policy_filepath"; then echo "Error: Failed to process policy JSON" continue fi # Get IPFS hash ipfs_hash=$(ipfs add --offline -Q "$policy_filepath") if [ -n "$ipfs_hash" ]; then echo "Preparing $name Court ($court): ${name}-Policy.json" # Add comma for all but the first entry if [ "$first" = true ]; then first=false else echo "," >> "$HASHES_FILE" fi # Store the hash with court as key echo "\"$court\": \"$ipfs_hash\"" >> "$HASHES_FILE" else echo "Failed to get IPFS hash for ${name}-Policy.json" rm "$HASHES_FILE" continue 2 fi done
Code Climate has analyzed commit 5af7b1b and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (15)
contracts/config/courts.v2.devnet.json
(3 hunks)contracts/config/courts.v2.mainnet-neo.json
(2 hunks)contracts/config/courts.v2.testnet.json
(4 hunks)contracts/config/policies.v2.devnet.json
(1 hunks)contracts/config/policies.v2.mainnet-neo.json
(1 hunks)contracts/config/policies.v2.testnet.json
(1 hunks)contracts/config/policies.v2/Curation-Court-Policy.json
(0 hunks)contracts/config/policies.v2/English-Language-Court-Policy.json
(0 hunks)contracts/config/policies.v2/General-Court-Policy.json
(0 hunks)contracts/package.json
(1 hunks)contracts/scripts/populateCourts.ts
(4 hunks)contracts/scripts/populatePolicyRegistry.ts
(2 hunks)contracts/scripts/setPoliciesURIs.sh
(1 hunks)web/src/pages/Courts/CourtDetails/Description.tsx
(4 hunks)web/src/styles/global-style.ts
(1 hunks)
💤 Files with no reviewable changes (3)
- contracts/config/policies.v2/Curation-Court-Policy.json
- contracts/config/policies.v2/General-Court-Policy.json
- contracts/config/policies.v2/English-Language-Court-Policy.json
🚧 Files skipped from review as they are similar to previous changes (6)
- web/src/styles/global-style.ts
- contracts/config/courts.v2.mainnet-neo.json
- contracts/scripts/setPoliciesURIs.sh
- contracts/config/courts.v2.testnet.json
- contracts/package.json
- contracts/config/courts.v2.devnet.json
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: Redirect rules - kleros-v2-university
- GitHub Check: Header rules - kleros-v2-university
- GitHub Check: Pages changed - kleros-v2-university
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Header rules - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Pages changed - kleros-v2-testnet
- GitHub Check: Redirect rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Analyze (javascript)
🔇 Additional comments (15)
web/src/pages/Courts/CourtDetails/Description.tsx (4)
25-50
: Well-structured styling improvements!The added styles establish a clear visual hierarchy and improve readability through consistent spacing and typography.
65-67
: LGTM: Interface updated to match new policy structure.The interface changes correctly reflect the migration from description/summary to purpose/rules fields.
75-75
: LGTM: Tab visibility logic updated.The visibility checks are correctly updated to use the new purpose and rules fields.
Also applies to: 87-87
118-120
: LGTM: Routes updated to use new field names.The route elements correctly use the new purpose and rules fields.
contracts/scripts/populatePolicyRegistry.ts (2)
30-30
: LGTM: Added flexible court population control.The start parameter allows for more granular control over court population.
98-102
: LGTM: Slicing logic properly handles start parameter.The implementation correctly:
- Adds a warning about index shifting
- Calculates the end index based on start and maxNumberOfCourts
- Updates the log message to reflect the new parameters
contracts/scripts/populateCourts.ts (3)
53-53
: LGTM: Enhanced court population control.Added useful parameters:
- start: For granular control over which courts to populate
- reverse: For controlling population order, particularly useful for minStake updates
Also applies to: 65-65
138-138
: LGTM: Simplified devnet court assignment.Removed unnecessary transformation for devnet courts.
153-162
: LGTM: Proper implementation of court selection and ordering.The implementation correctly:
- Handles court slicing with start parameter
- Implements reverse functionality for ordered updates
- Includes clear warning about index shifting
contracts/config/policies.v2.devnet.json (3)
4-7
: LGTM: Existing courts updated to new structure.The changes correctly:
- Replace description with purpose
- Replace summary with rules
- Update URIs accordingly
Also applies to: 11-15, 19-23
26-32
: LGTM: Spanish court properly configured.The "Corte de Disputas de Consumo y Vecindad" court is well-defined with appropriate:
- Purpose in Spanish
- Required skills including consumer rights knowledge
- Proper court ID and URI
34-39
: LGTM: Oracle court properly configured.The Oracle court implementation is comprehensive with:
- Clear purpose for real-world event resolution
- Detailed rules for handling prediction market cases
- Well-defined required skills
- Proper court ID and URI
contracts/config/policies.v2.testnet.json (1)
1-39
: LGTM: Testnet policies mirror devnet configuration.The changes maintain consistency with devnet, ensuring uniform court structure across environments.
contracts/config/policies.v2.mainnet-neo.json (2)
231-237
: Excellent implementation of the Oracle court!The Oracle court implementation is comprehensive and well-structured:
- Clear purpose definition
- Detailed rules with examples
- Edge cases covered (invalid answers, multiple outcomes, prohibited questions)
- Well-defined required skills
7-7
: Verify accessibility and content of IPFS URIs.Each court references an IPFS URI. These URIs should be verified to ensure:
- They are accessible
- Their content is consistent with the policy file
Also applies to: 14-14, 22-22, 29-29, 37-37, 45-45, 53-53, 61-61, 69-69, 77-77, 85-85, 93-93, 101-101, 109-109, 117-117, 125-125, 133-133, 141-141, 149-149, 157-157, 165-165, 173-173, 181-181, 189-189, 197-197, 205-205, 213-213, 221-221, 229-229, 237-237
✅ Verification successful
All IPFS URIs are accessible and contain valid content
All 30 IPFS URIs were successfully verified:
- Each URI is accessible through the IPFS gateway
- Content structure matches the policy file format
- Content is consistent with the corresponding court entries
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify IPFS URIs are accessible and contain valid content # Extract all IPFS URIs echo "Checking IPFS URIs..." grep -o '/ipfs/[a-zA-Z0-9]*' contracts/config/policies.v2.mainnet-neo.json | while read -r uri; do echo "Verifying $uri" # Try to fetch the content curl -s "https://ipfs.io$uri" > /dev/null if [ $? -eq 0 ]; then echo "✓ URI is accessible" else echo "✗ Failed to access $uri" fi doneLength of output: 9257
Script:
#!/bin/bash # Description: Fetch and examine content from IPFS URIs # Extract first URI to check its content structure FIRST_URI=$(grep -o '/ipfs/[a-zA-Z0-9]*' contracts/config/policies.v2.mainnet-neo.json | head -n 1) echo "Examining content from $FIRST_URI..." curl -s "https://ipfs.io$FIRST_URI" | jq '.' # Get the policy file content for comparison echo -e "\nComparing with policy file structure..." cat contracts/config/policies.v2.mainnet-neo.json | jq '.'Length of output: 45621
"purpose": "In this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n### Example\nContractor utilizes poor grammar in a sponsored article which doesn’t meet the standards as agreed in the contract.", | ||
"rules": "- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ", |
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.
🛠️ Refactor suggestion
Refactor translation courts to use correct examples and specific rules.
The purpose and rules sections are incorrectly copy-pasted from the English Language court. They should be updated to include translation-specific examples and rules.
For each translation court, update the purpose section to include translation-specific examples:
-"purpose": "In this subcourt, jurors will solve disputes involving quality of written content. This includes grammar and text logic.\n### Example\nContractor utilizes poor grammar in a sponsored article which doesn't meet the standards as agreed in the contract.",
+"purpose": "In this subcourt, jurors will solve disputes involving the quality of translations between [Language] and English.\n### Example\nA translation fails to accurately convey the meaning of technical terms in a whitepaper translation.",
And update the rules to be translation-specific:
-"rules": "- If the disputed content is of significant size (> 10 000 words), parties in the dispute should point out to specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.\n- All variations of English (UK, US, Australia, etc) are to accepted unless a target audience is specifically mentioned in the contract. ",
+"rules": "- If the disputed translation is of significant size (> 10,000 words), parties must highlight specific passages that are being disputed.\n- Cultural context and idiomatic expressions should be appropriately adapted while maintaining the original meaning.\n- Technical terminology should be consistently translated using industry-standard terms.",
Also applies to: 113-114, 121-122, 129-130, 137-138, 145-146, 153-154, 161-162, 169-170
"purpose": "", | ||
"rules": "", |
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.
🛠️ Refactor suggestion
Complete missing purpose and rules fields.
The following courts have empty fields that should be completed to ensure clear guidance for jurors:
- Data Analysis: missing purpose and rules
- Statistical Modeling: missing purpose and rules
- Curation (Medium): missing rules
Would you like me to help draft the missing content for these courts?
Also applies to: 89-90, 98-98
"name": "Corte de Disputas de Consumo y Vecindad", | ||
"purpose": "Esta corte está destinada a resolver una amplia variedad de disputas de complejidad baja a moderada, principalmente de carácter civil y comercial. La misma actúa como tribunal subsidiario para los casos en los que no exista otra corte más especializada o aplicable. Su alcance incluye, pero no se limita a:\n- Conflictos contractuales.\n- Reclamos por daños y perjuicios.\n- Reclamos de defensa del consumidor entre usuarios y empresas.", | ||
"rules": "", | ||
"requiredSkills": "- Familiaridad con los [derechos básicos del consumidor](https://buenosaires.gob.ar/principales-derechos-de-los-consumidores).\n- Comprensión de las prácticas comunes en entornos digitales y descentralizados.\n- Capacidad para evaluar de manera crítica y objetiva la autenticidad y relevancia de las pruebas presentadas.", | ||
"court": 29, | ||
"uri": "/ipfs/QmVxh7KmFrimGz6WMvLMRXZhwQFDoj28KEYLTpYoUTGwAj/xDai-Blockchain-No-Tecnica-Policy.json" | ||
"uri": "/ipfs/Qmczrn2DgdKGnacdvKRYwCk7JkeyTCokdqQycWdetYrxGC" |
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.
🛠️ Refactor suggestion
Add rules for the consumer disputes court.
The rules field is empty for "Corte de Disputas de Consumo y Vecindad". Consider adding specific guidelines for handling consumer and neighborhood disputes.
Add rules to guide jurors in handling these specific types of disputes:
-"rules": "",
+"rules": "- Los jurados deben considerar la legislación local de protección al consumidor como referencia.\n- En casos de disputas vecinales, se debe priorizar soluciones que mantengan la convivencia.\n- Para reclamos de daños, se requiere evidencia clara del perjuicio causado.\n- Los jurados deben verificar que las pruebas presentadas sean contemporáneas a los hechos reclamados.",
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"name": "Corte de Disputas de Consumo y Vecindad", | |
"purpose": "Esta corte está destinada a resolver una amplia variedad de disputas de complejidad baja a moderada, principalmente de carácter civil y comercial. La misma actúa como tribunal subsidiario para los casos en los que no exista otra corte más especializada o aplicable. Su alcance incluye, pero no se limita a:\n- Conflictos contractuales.\n- Reclamos por daños y perjuicios.\n- Reclamos de defensa del consumidor entre usuarios y empresas.", | |
"rules": "", | |
"requiredSkills": "- Familiaridad con los [derechos básicos del consumidor](https://buenosaires.gob.ar/principales-derechos-de-los-consumidores).\n- Comprensión de las prácticas comunes en entornos digitales y descentralizados.\n- Capacidad para evaluar de manera crítica y objetiva la autenticidad y relevancia de las pruebas presentadas.", | |
"court": 29, | |
"uri": "/ipfs/QmVxh7KmFrimGz6WMvLMRXZhwQFDoj28KEYLTpYoUTGwAj/xDai-Blockchain-No-Tecnica-Policy.json" | |
"uri": "/ipfs/Qmczrn2DgdKGnacdvKRYwCk7JkeyTCokdqQycWdetYrxGC" | |
"name": "Corte de Disputas de Consumo y Vecindad", | |
"purpose": "Esta corte está destinada a resolver una amplia variedad de disputas de complejidad baja a moderada, principalmente de carácter civil y comercial. La misma actúa como tribunal subsidiario para los casos en los que no exista otra corte más especializada o aplicable. Su alcance incluye, pero no se limita a:\n- Conflictos contractuales.\n- Reclamos por daños y perjuicios.\n- Reclamos de defensa del consumidor entre usuarios y empresas.", | |
"rules": "- Los jurados deben considerar la legislación local de protección al consumidor como referencia.\n- En casos de disputas vecinales, se debe priorizar soluciones que mantengan la convivencia.\n- Para reclamos de daños, se requiere evidencia clara del perjuicio causado.\n- Los jurados deben verificar que las pruebas presentadas sean contemporáneas a los hechos reclamados.", | |
"requiredSkills": "- Familiaridad con los [derechos básicos del consumidor](https://buenosaires.gob.ar/principales-derechos-de-los-consumidores).\n- Comprensión de las prácticas comunes en entornos digitales y descentralizados.\n- Capacidad para evaluar de manera crítica y objetiva la autenticidad y relevancia de las pruebas presentadas.", | |
"court": 29, | |
"uri": "/ipfs/Qmczrn2DgdKGnacdvKRYwCk7JkeyTCokdqQycWdetYrxGC" |
Changes
description
renamed intopurpose
summary
renamed intorules
Before / After
PR-Codex overview
This PR focuses on updating court policies and configurations, enhancing styles, and modifying scripts for populating courts and policies. It introduces new courts, updates existing ones, and improves the user interface with style adjustments.
Detailed summary
font-weight
inglobal-style.ts
.courts.v2.mainnet-neo.json
andcourts.v2.testnet.json
.Oracle Court
and updatedCorte de Disputas de Consumo y Vecindad
.jurorsForCourtJump
from30
to31
in some courts.populatePolicyRegistry.ts
to allow starting index and max courts.purpose
andrules
instead ofdescription
andsummary
.Description.tsx
for better readability.Summary by CodeRabbit
New Features
Configuration Updates
Development Improvements