-
Notifications
You must be signed in to change notification settings - Fork 6
Arbitrator contracts update and subgraph redeploy #110
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
WalkthroughThis update refactors the deployment utility functions for contract retrieval, centralizing arbitrator contract fetching and simplifying network support logic. The deployment script is updated to use the new utility. The Hardhat configuration removes the external deployments property. Several dependencies are upgraded across the contracts, subgraph, and web packages, with the web app removing the ethers dependency and updating related packages. The subgraph configuration is switched to index a different network and contract deployment, reflecting a move from Arbitrum One to Arbitrum Sepolia. Changes
Sequence Diagram(s)sequenceDiagram
participant DeployScript as Deployment Script
participant Utils as getContracts.ts
participant HRE as Hardhat Runtime Env
participant Shared as getContractsEthers
DeployScript->>Utils: getArbitratorContracts(hre)
Utils->>HRE: Get current network name
Utils->>Utils: Map network name to deployment name
Utils->>Shared: _getArbitratorContracts(provider, deploymentName)
Shared-->>Utils: Return { klerosCore, disputeTemplateRegistry }
Utils-->>DeployScript: Return arbitrator contracts
Suggested labels
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
💤 Files with no reviewable changes (1)
🧰 Additional context used🧬 Code Graph Analysis (1)contracts/deploy/00-escrow.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🔇 Additional comments (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-escrow-v2 failed. Why did it fail? →
|
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: 1
🧹 Nitpick comments (1)
contracts/deploy/utils/getContracts.ts (1)
5-9: Good use of constant mapping for network configurationThe
NETWORK_TO_DEPLOYMENTconstant effectively maps network names to deployment names, making the code more maintainable. This approach follows best practices by centralizing configuration in a type-safe mapping.However, consider adding a comment explaining the mapping's purpose and the meaning of each deployment name (devnet, testnet, mainnetNeo) for better documentation.
const NETWORK_TO_DEPLOYMENT: Record<string, DeploymentName> = { arbitrumSepoliaDevnet: "devnet", arbitrumSepolia: "testnet", arbitrum: "mainnetNeo", + // Map network names to the appropriate deployment names in kleros-v2-contracts } as const;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (7)
contracts/deploy/00-escrow.ts(2 hunks)contracts/deploy/utils/getContracts.ts(1 hunks)contracts/hardhat.config.ts(0 hunks)contracts/package.json(2 hunks)subgraph/package.json(2 hunks)subgraph/subgraph.yaml(2 hunks)web/package.json(2 hunks)
💤 Files with no reviewable changes (1)
- contracts/hardhat.config.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
contracts/deploy/00-escrow.ts (1)
contracts/deploy/utils/getContracts.ts (1)
getArbitratorContracts(11-20)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - kleros-escrow-v2
- GitHub Check: Header rules - kleros-escrow-v2
- GitHub Check: Pages changed - kleros-escrow-v2
🔇 Additional comments (9)
subgraph/package.json (2)
3-3: Version bump aligns with the subgraph redeploymentThe version increment from 2.0.8 to 2.1.0 appropriately reflects the significant changes being made to the subgraph configuration, particularly the network change to arbitrum-sepolia.
33-33: Dependency update looks goodThe gluegun dependency update from ^5.1.2 to ^5.2.0 is a minor version bump that maintains compatibility while providing access to newer features or bug fixes.
web/package.json (1)
55-55: Development dependency update looks goodThe @wagmi/cli update from ^2.1.15 to ^2.2.1 is appropriate and should maintain compatibility while providing access to newer features.
contracts/deploy/00-escrow.ts (1)
5-5: Improved contract fetching abstractionThe refactoring to use the more specific
getArbitratorContractsfunction improves code organization and provides better error handling for unsupported networks. This change follows good software engineering principles by making the code more modular and maintainable.Also applies to: 31-31
subgraph/subgraph.yaml (1)
7-7:✅ Verification successful
Network configuration updated for arbitrum-sepolia
The subgraph configuration has been properly updated to track the arbitrum-sepolia network instead of arbitrum-one. The contract address, start block, and ABI path have all been updated consistently to match the new deployment environment.
Also applies to: 9-9, 11-11, 25-25
🏁 Script executed:
#!/bin/bash # Verify that the contract address in the subgraph.yaml matches the deployment address SUBGRAPH_ADDRESS=$(grep "address:" subgraph/subgraph.yaml | awk '{print $2}' | tr -d "'") DEPLOYMENT_ADDRESS=$(grep -A 1 "address\":" contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json | grep -v "address" | tr -d '", ' | xargs) echo "Subgraph address: $SUBGRAPH_ADDRESS" echo "Deployment file address: $DEPLOYMENT_ADDRESS" if [ "$SUBGRAPH_ADDRESS" = "$DEPLOYMENT_ADDRESS" ]; then echo "✅ Addresses match" else echo "❌ Addresses don't match" fiLength of output: 796
🏁 Script executed:
#!/bin/bash # Inspect the deployment JSON to locate the address field sed -n '1,50p' contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.jsonLength of output: 1252
🏁 Script executed:
#!/bin/bash # Display the first 80 lines of subgraph.yaml with line numbers for review nl -ba subgraph/subgraph.yaml | sed -n '1,80p'Length of output: 139
🏁 Script executed:
#!/bin/bash # Display the first 80 lines of the subgraph manifest to verify address, startBlock, and ABI paths sed -n '1,80p' subgraph/subgraph.yamlLength of output: 1696
Subgraph configuration updated to arbitrum‑sepolia and contract address verified
networkfield changed toarbitrum-sepolia.source.addressinsubgraph/subgraph.yaml(0x5ef185810BCe41c03c9E5ca271B8C91F1024F953) matches the"address"incontracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json.startBlock: 123526741and the ABI file path (../contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json) correctly point to the new deployment.All updates are consistent. Approving these changes.
contracts/package.json (1)
61-61:✅ Verification successful
Dependency updates: Check compatibility and CI success
Several dependencies have been updated to newer versions, including major version bumps for
chai(^4.5.0 → ^5.2.0) and@types/chai(^4.3.20 → ^5.2.1), which might introduce breaking changes in the testing infrastructure. Also notable is the major version update ofhardhat-deployfrom ^0.14.0 to ^1.0.2. These updates align with the PR objectives of upgrading dependencies.Make sure CI tests are passing successfully to confirm that these updates don't introduce compatibility issues in the existing codebase.
Also applies to: 63-66, 69-69, 72-73, 76-76, 86-87
🏁 Script executed:
#!/bin/bash # Check for any breaking changes in chai v5 that might affect testing echo "Checking for potential breaking changes in Chai v5..." curl -s https://github.com/chaijs/chai/releases | grep -A 10 "v5.0.0" | grep -i "breaking" # Check if there are any CI failures related to these dependency updates echo "Looking for test files that might be affected by chai updates..." find . -type f -name "*.test.ts" | xargs grep -l "chai" | head -5Length of output: 410
🏁 Script executed:
#!/bin/bash set -e echo "=== Checking Chai CHANGELOG for v5.0.0 entries ===" curl -s https://raw.githubusercontent.com/chaijs/chai/main/CHANGELOG.md \ | sed -n '/## 5\.0\.0/,/## 5\.1\.0/p' \ | head -n 20 echo echo "=== Checking for “break” keywords in that section ===" curl -s https://raw.githubusercontent.com/chaijs/chai/main/CHANGELOG.md \ | sed -n '/## 5\.0\.0/,/## 5\.1\.0/p' \ | grep -i break || echo "No “break” mentions found" echo echo "=== Checking hardhat-deploy CHANGELOG for v1.0.0 entries ===" curl -s https://raw.githubusercontent.com/wighawag/hardhat-deploy/main/CHANGELOG.md \ | sed -n '/## \[1\.0\.0\]/,/## \[1\.1\.0\]/p' \ | head -n 20 echo echo "=== Checking for “break” keywords in that section ===" curl -s https://raw.githubusercontent.com/wighawag/hardhat-deploy/main/CHANGELOG.md \ | sed -n '/## \[1\.0\.0\]/,/## \[1\.1\.0\]/p' \ | grep -i break || echo "No “break” mentions found" echo echo "=== Searching codebase for Chai imports in tests ===" rg -n "from ['\"]chai['\"]" --glob "*.{ts,js}" || echo "No direct imports from 'chai' found"Length of output: 1439
Dependency updates verified – no breaking changes in Chai v5 or Hardhat‑deploy v1 detected
Chai v5.0.0 and Hardhat‑deploy v1.0.0 CHANGELOGs show no explicit breaking changes, and no direct
import/requireofchaiwas found in the test files. Please confirm that the CI test suite passes under these new versions. No further changes are required.contracts/deploy/utils/getContracts.ts (3)
2-2: Improved import with renamed helper functionThe refactoring centralizes contract retrieval logic by importing a helper function from the Kleros contracts package. Renaming the imported function to
_getArbitratorContractsmakes its purpose clearer and follows the convention of marking internal utilities with an underscore.
11-20: Well-implemented helper function with proper error handlingThe new
getArbitratorContractsfunction effectively:
- Retrieves the current network name
- Maps it to a deployment name
- Provides a clear error message for unsupported networks
- Delegates actual retrieval to the imported helper
This improves modularity and follows the single responsibility principle by isolating the network mapping logic.
23-24: Simplified contract retrieval with cleaner implementationThe updated
getContractsfunction now uses the new helper function to retrieve arbitrator contracts, making the code more maintainable by removing duplicate logic and centralizing the contract retrieval process. This aligns well with the PR objective of refactoring contract fetching logic.
PR-Codex overview
This PR updates various dependencies and configurations across multiple files, including version upgrades and changes to the network configuration for the
subgraph. It also refactors contract fetching logic and improves package management.Detailed summary
versioninsubgraph/package.jsonto2.1.0.gluegunversion to5.2.0.@wagmi/cliversion to2.2.1.subgraph/subgraph.yamlfromarbitrum-onetoarbitrum-sepolia.subgraph.yaml.contracts/deploy/utils/getContracts.ts.ethersversion to6.13.6in multiple files.@kleros/kleros-v2-contractsversion to0.9.2.hardhatversion to2.23.0andhardhat-deployto1.0.2.Summary by CodeRabbit