Conversation
❌ Deploy Preview for kleros-v2-testnet-devtools failed. Why did it fail? →
|
❌ Deploy Preview for kleros-v2-neo failed. Why did it fail? →
|
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThe pull request adds contract synchronization capabilities with Tenderly by introducing a new TypeScript script that reads deployment artifacts, syncs contracts to Tenderly via API calls, and supports tagging/untagging workflows. Configuration updates include a new npm script and a duplicate Tenderly plugin import in Hardhat config. Changes
Sequence Diagram(s)sequenceDiagram
actor CLI as CLI User
participant Script as syncToTenderly Script
participant FS as Filesystem
participant API as Tenderly API
CLI->>Script: yarn sync-tenderly --network=X [--dry-run]
rect rgb(200, 220, 255)
note over Script,FS: Sync Mode
Script->>FS: Read deployment artifacts
FS-->>Script: Contract list (main + implementations)
Script->>API: Add contracts (bulk)
API-->>Script: 200/409/error responses
Script->>Script: Aggregate results (succeeded, failed, exists)
end
CLI->>Script: yarn sync-tenderly --network=X --tag=T [--dry-run]
rect rgb(220, 200, 255)
note over Script,API: Tag Mode
Script->>Script: Filter non-implementation contracts
loop Per Contract
Script->>API: POST tag to contract
API-->>Script: Success/failure
Script->>Script: Rate-limit pause
end
Script->>Script: Return tag results
end
Script-->>CLI: Structured results + logs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @contracts/hardhat.config.ts:
- Line 12: Remove the duplicate import of "hardhat-deploy-tenderly" — there are
two identical import statements for that module (one at the top and the
duplicate shown in the diff); delete the redundant import so only a single
import of "hardhat-deploy-tenderly" remains in contracts/hardhat.config.ts.
🧹 Nitpick comments (3)
contracts/scripts/syncToTenderly.ts (3)
201-209: Consider adding a request timeout.The
fetchcall has no timeout, which could cause the script to hang indefinitely on network issues. Consider usingAbortControllerwith a timeout.Example implementation
const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort(), 30000); // 30s timeout try { const response = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json", "X-Access-Key": config.accessKey, }, body: JSON.stringify(payload), signal: controller.signal, }); // ... rest of logic } finally { clearTimeout(timeoutId); }
504-507: Clarify 404 handling behavior.When a contract doesn't have the tag (404), it's counted as a failure. If this is intentional for reporting purposes, consider using
logger.debuginstead of incrementingfailedcount since the tag removal goal is effectively achieved (tag doesn't exist).Alternative: treat 404 as success
// 404 might mean contract doesn't have the tag - treat as warning, not error if (response.status === 404) { - return { success: false, error: "Tag not found on contract" }; + return { success: true, alreadyRemoved: true }; }
536-538: Guard against flags being parsed as values.If a user runs
yarn sync-tenderly --network --dry-run, the code would parse--dry-runas the network value. Consider validating that the value doesn't start with--.Suggested fix
} else if (networkSpaceIndex !== -1 && args[networkSpaceIndex + 1]) { - network = args[networkSpaceIndex + 1]; + const value = args[networkSpaceIndex + 1]; + if (!value.startsWith("--")) { + network = value; + } }Apply similar logic for
--tagand--untagparsing.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
contracts/hardhat.config.tscontracts/package.jsoncontracts/scripts/syncToTenderly.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
- 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: Redirect rules - kleros-v2-testnet-devtools
- GitHub Check: Header rules - kleros-v2-neo
- GitHub Check: Header rules - kleros-v2-testnet-devtools
- GitHub Check: Pages changed - kleros-v2-neo
- GitHub Check: Pages changed - kleros-v2-testnet-devtools
- GitHub Check: Analyze (javascript)
- GitHub Check: SonarCloud
- GitHub Check: hardhat-tests
🔇 Additional comments (4)
contracts/scripts/syncToTenderly.ts (3)
110-167: LGTM!The deployment reading logic correctly handles missing directories, validates
.chainId, filters deployment artifacts appropriately, and handles parse errors gracefully without failing the entire operation.
249-292: LGTM!The sync logic correctly aggregates results, handles rate limiting with a delay, and provides clear logging for each contract status.
309-406: LGTM!The tagging function correctly filters contracts, builds the contract ID format expected by Tenderly, and handles both success and failure cases appropriately.
contracts/package.json (1)
70-70: LGTM!The new npm script is consistent with the project's existing patterns and correctly invokes the new Tenderly sync script.
| import "solidity-coverage"; | ||
| import "hardhat-deploy"; | ||
| import "hardhat-deploy-ethers"; | ||
| import "hardhat-deploy-tenderly"; |
There was a problem hiding this comment.
Remove duplicate import.
hardhat-deploy-tenderly is already imported at line 7.
Suggested fix
-import "hardhat-deploy-tenderly";📝 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.
| import "hardhat-deploy-tenderly"; |
🤖 Prompt for AI Agents
In @contracts/hardhat.config.ts at line 12, Remove the duplicate import of
"hardhat-deploy-tenderly" — there are two identical import statements for that
module (one at the top and the duplicate shown in the diff); delete the
redundant import so only a single import of "hardhat-deploy-tenderly" remains in
contracts/hardhat.config.ts.


PR-Codex overview
This PR introduces support for syncing and tagging contracts with the
Tenderlyplatform. It adds a new script for synchronization and enhances the configuration for managing deployments.Detailed summary
hardhat-deploy-tenderlyimport incontracts/hardhat.config.ts.sync-tenderlyscript incontracts/package.json.syncToTenderly.tsscript with:Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.