-
Notifications
You must be signed in to change notification settings - Fork 79
Tron deployments #1303
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
Tron deployments #1303
Conversation
|
Warning Rate limit exceeded@ezynda3 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 4 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughAdds Tron support across the repo: network configs, deployment tooling, CLI utilities (TronCast), and deployment metadata. Introduces Tron deployment scripts (deploy/register facets and periphery), a Tron contract deployer, health-check integration, config additions for Symbiosis/AllBridge, env-var utilities, CI/script updates, and new deployment JSONs. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 11
🔭 Outside diff range comments (1)
script/deploy/tron/TronContractDeployer.ts (1)
1-467: Replace console.log with consola for consistent loggingAccording to the coding guidelines, all TypeScript scripts must use
consolafor consistent logging. This file usesconsole.log,console.warn, andconsole.errorthroughout.Import consola at the beginning of the file:
import { TronWeb } from 'tronweb' +import consola from 'consola' import type {Then replace all console methods with consola equivalents throughout the file. For example:
console.log→consola.infoorconsola.logconsole.warn→consola.warnconsole.error→consola.error
🧹 Nitpick comments (5)
script/deploy/tron/types.ts (1)
30-30: Consider stronger typing for transaction objects.The
deploymentTransactionandreceiptfields useanytype. Consider defining more specific interfaces for these Tron-specific objects to improve type safety and developer experience.- deploymentTransaction: any - receipt: any + deploymentTransaction: TronTransaction + receipt: TronTransactionReceiptYou could define these interfaces based on TronWeb's transaction structure.
script/deploy/tron/deploy-core-facets.ts (2)
190-191: Address the TODO for constructor arguments encoding.The TODO comment indicates incomplete constructor argument encoding. This could cause issues during deployment logging and verification.
Would you like me to help implement proper constructor argument encoding for Tron? The encoding should convert the owner address and DiamondCutFacet address into the appropriate hex format for logging purposes.
53-56: Consider extracting magic numbers to constants.The configuration values like
safetyMargin: 1.5,maxRetries: 3, andconfirmationTimeout: 120000could be extracted to named constants for better maintainability.+const DEFAULT_SAFETY_MARGIN = 1.5 +const DEFAULT_MAX_RETRIES = 3 +const DEFAULT_CONFIRMATION_TIMEOUT = 120000 const config: ITronDeploymentConfig = { fullHost: network, privateKey, verbose, dryRun, - safetyMargin: 1.5, - maxRetries: 3, - confirmationTimeout: 120000, + safetyMargin: DEFAULT_SAFETY_MARGIN, + maxRetries: DEFAULT_MAX_RETRIES, + confirmationTimeout: DEFAULT_CONFIRMATION_TIMEOUT, }script/deploy/tron/TronContractDeployer.ts (2)
175-175: Make default energy value configurableThe hardcoded fallback value of 50000 for energy estimation should be configurable or at least documented.
Consider making this a configurable constant:
+const DEFAULT_ENERGY_ESTIMATE = 50000 // Default energy units for failed estimations + private async estimateEnergyConsumption( // ... ): Promise<number> { try { // ... - return result.energy_required || result.energy_used || 50000 + return result.energy_required || result.energy_used || DEFAULT_ENERGY_ESTIMATE } catch (error: any) { throw new Error(`Energy estimation failed: ${error.message}`) } }
213-219: Document or make energy factor thresholds configurableThe bytecode complexity thresholds are hardcoded without explanation.
Add constants with documentation:
+// Energy factor thresholds based on bytecode complexity +const ENERGY_FACTOR_HIGH_COMPLEXITY_THRESHOLD = 50000 // ~25KB bytecode +const ENERGY_FACTOR_MEDIUM_COMPLEXITY_THRESHOLD = 20000 // ~10KB bytecode +const ENERGY_FACTOR_HIGH = 0.5 +const ENERGY_FACTOR_MEDIUM = 0.3 +const ENERGY_FACTOR_LOW = 0.1 + private getEnergyFactor(bytecode: string): number { const complexity = bytecode.length / 2 - if (complexity > 50000) return 0.5 - if (complexity > 20000) return 0.3 - return 0.1 + if (complexity > ENERGY_FACTOR_HIGH_COMPLEXITY_THRESHOLD) return ENERGY_FACTOR_HIGH + if (complexity > ENERGY_FACTOR_MEDIUM_COMPLEXITY_THRESHOLD) return ENERGY_FACTOR_MEDIUM + return ENERGY_FACTOR_LOW }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
config/networks.json(1 hunks)package.json(1 hunks)script/deploy/tron/TronContractDeployer.ts(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)script/deploy/tron/types.ts(1 hunks)script/deploy/tron/utils.ts(1 hunks)tsconfig.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All TypeScript scripts must follow the rules defined in.eslintrc.cjs.
All TypeScript scripts must use async/await for asynchronous operations.
All TypeScript scripts must usecittyfor CLI argument parsing.
All TypeScript scripts must useconsolafor consistent logging.
Environment variables in TypeScript scripts should be validated usinggetEnvVar()helper.
TypeScript scripts should exit with appropriate exit codes (0 for success, 1 for error).
All scripts should usebunx tsxfor TypeScript execution.
Files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/types.tsscript/deploy/tron/TronContractDeployer.tsscript/deploy/tron/utils.ts
🧬 Code Graph Analysis (2)
script/deploy/tron/TronContractDeployer.ts (2)
script/deploy/tron/types.ts (4)
ITronDeploymentConfig(1-12)IForgeArtifact(40-64)ITronDeploymentResult(27-38)ITronCostEstimate(14-25)script/deploy/tron/utils.ts (4)
DEFAULT_SAFETY_MARGIN(8-8)ENERGY_PRICE(6-6)BANDWIDTH_PRICE(7-7)calculateTransactionBandwidth(202-219)
script/deploy/tron/utils.ts (2)
script/deploy/tron/types.ts (1)
IForgeArtifact(40-64)script/helperFunctions.sh (1)
error(2730-2732)
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (15)
package.json (1)
125-125: tronweb dependency version and security verified
- The project’s package.json specifies
"tronweb": "^6.0.3".- Confirmed via npm registry that 6.0.3 is the latest stable release.
- No known security advisories found for TronWeb in the NPM ecosystem.
config/networks.json (1)
1133-1133: Tron Mainnet Chain ID Confirmed
The chain ID728126428is correct for Tron mainnet (hex0x2b6653dcper RPC)[4][9]. No update required.tsconfig.json (1)
19-21: LGTM! TypeScript configuration properly updated for Bun support.The addition of "bun" to the types array correctly enables Bun runtime types for the new Tron deployment scripts, and the formatting change to the include array maintains functionality. These changes appropriately support the new TypeScript files under
script/deploy/tron/.script/deploy/tron/types.ts (2)
1-12: Well-designed deployment configuration interface.The
ITronDeploymentConfiginterface provides comprehensive configuration options with appropriate optional parameters and sensible defaults implied. The structure supports both production and development workflows effectively.
40-64: Comprehensive Forge artifact interface definition.The
IForgeArtifactinterface accurately represents the structure of compiled Solidity artifacts from Forge, including all necessary metadata for deployment and verification. The nested structure properly captures compiler output format.script/deploy/tron/deploy-core-facets.ts (4)
1-4: LGTM! Proper script setup following coding guidelines.The script correctly uses
#!/usr/bin/env bunshebang and importsconsolafor logging as required by the coding guidelines for TypeScript scripts.
34-45: Excellent private key and environment handling.The script properly handles environment-specific private key retrieval with clear error messages and graceful failure. The error handling provides helpful guidance to users about which environment variable to set.
80-92: Good safety measures for production deployments.The deployment warnings and delays for production/staging environments provide important safeguards against accidental deployments. The different timeouts (10s for production, 5s for staging) are well-thought-out.
258-259: LGTM! Proper script execution pattern.The script correctly uses
import.meta.mainto detect direct execution and includes proper error handling withconsola.erroras required by the coding guidelines.script/deploy/tron/TronContractDeployer.ts (3)
44-100: Well-structured deployment method with proper error handlingThe deployment method follows a clear sequence with proper separation of concerns and comprehensive error handling.
255-277: Proper balance validation with clear error messagesThe balance validation correctly checks for sufficient funds and provides clear error messages.
363-414: Well-implemented transaction confirmation with proper retry logicThe confirmation polling logic includes timeout handling, configurable retries, and proper error detection for failed transactions.
script/deploy/tron/utils.ts (3)
113-139: Well-implemented contract address persistenceThe function properly handles file creation and updates with appropriate error handling.
173-197: Good implementation of version extraction with multiple path handlingThe function properly searches multiple paths and extracts version information with clear error messages.
199-219: Correct implementation of Tron bandwidth calculationThe function properly implements Tron's bandwidth calculation with appropriate protocol constants.
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: 12
♻️ Duplicate comments (4)
script/deploy/tron/TronContractDeployer.ts (4)
20-42: Private key validation and logging issues remain unaddressedThe previous review comments about private key validation and secure logging are still applicable to this code.
118-123: Energy factor calculation clarity issue remainsThe previous review comment about the energy factor calculation formula is still applicable.
321-323: Transaction ID extraction validation issue remainsThe previous review comment about validating the transaction ID extraction is still applicable.
339-339: Mock transaction ID format issue remainsThe previous review comment about removing the '0x' prefix from Tron transaction IDs is still applicable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
script/deploy/tron/TronContractDeployer.ts(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)script/deploy/tron/utils.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- script/deploy/tron/deploy-core-facets.ts
- script/deploy/tron/utils.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All TypeScript scripts must follow the rules defined in.eslintrc.cjs.
All TypeScript scripts must use async/await for asynchronous operations.
All TypeScript scripts must usecittyfor CLI argument parsing.
All TypeScript scripts must useconsolafor consistent logging.
Environment variables in TypeScript scripts should be validated usinggetEnvVar()helper.
TypeScript scripts should exit with appropriate exit codes (0 for success, 1 for error).
All scripts should usebunx tsxfor TypeScript execution.
Files:
script/deploy/tron/TronContractDeployer.ts
🧬 Code Graph Analysis (1)
script/deploy/tron/TronContractDeployer.ts (2)
script/deploy/tron/types.ts (4)
ITronDeploymentConfig(1-12)IForgeArtifact(40-64)ITronDeploymentResult(27-38)ITronCostEstimate(14-25)script/deploy/tron/utils.ts (4)
DEFAULT_SAFETY_MARGIN(8-8)ENERGY_PRICE(6-6)BANDWIDTH_PRICE(7-7)calculateTransactionBandwidth(202-219)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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
♻️ Duplicate comments (16)
script/deploy/tron/TronContractDeployer.ts (16)
1-2: Add missingconsolaimportThe file uses console for logging but should use
consolaper coding guidelines. Add the import statement.import { TronWeb } from 'tronweb' +import { consola } from 'consola'
22-44: Add private key validation and use consola for loggingThe constructor should validate the private key format and use consola instead of console.log.
public constructor(config: ITronDeploymentConfig) { + // Validate private key format (strip optional 0x prefix) + const rawKey = config.privateKey?.replace(/^0x/i, '') + if (!rawKey || !/^[0-9a-fA-F]{64}$/.test(rawKey)) { + throw new Error('Invalid Tron private key format') + } + this.config = { safetyMargin: DEFAULT_SAFETY_MARGIN, maxRetries: 3, confirmationTimeout: 60000, verbose: false, dryRun: false, userFeePercentage: 100, originEnergyLimit: 0, ...config, + privateKey: rawKey, } this.tronWeb = new TronWeb({ fullHost: this.config.fullHost, privateKey: this.config.privateKey, }) if (this.config.verbose) - console.log('🔧 TronWeb initialized:', { + consola.info('🔧 TronWeb initialized:', { network: this.config.fullHost, - address: this.tronWeb.defaultAddress.base58, + address: `${this.tronWeb.defaultAddress.base58.slice(0, 6)}...${this.tronWeb.defaultAddress.base58.slice(-4)}`, }) }
57-62: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log('💰 Estimated deployment cost:', { + consola.info('💰 Estimated deployment cost:', { energy: costEstimate.energy, bandwidth: costEstimate.bandwidth, totalTrx: costEstimate.totalTrx.toFixed(4), })
125-134: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log('📊 Fee calculation:', { + consola.info('📊 Fee calculation:', { estimatedEnergy, estimatedBandwidth, energyCost: `${energyCost} TRX`, bandwidthCost: `${bandwidthCost} TRX`, totalCost: `${totalCost} TRX`, feeLimitSun: `${feeLimitSun} SUN (integer)`, })
190-191: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log('🔍 Estimating energy using triggerConstantContract...') + consola.info('🔍 Estimating energy using triggerConstantContract...')
230-239: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) { - console.log( + consola.info( '📡 Calling triggerconstantcontract API for energy estimation...' ) - console.log( + consola.info( 'Bytecode size:', artifact.bytecode.object.length / 2, 'bytes' ) }
267-268: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log(`📊 Estimated energy usage: ${result.energy_used}`) + consola.info(`📊 Estimated energy usage: ${result.energy_used}`)
274-278: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log( + consola.info( `📊 Energy with ${safetyMargin}x safety margin: ${estimatedEnergy}` )
284-287: Useconsolainstead ofconsole.errorReplace console.error with consola for consistent logging.
- console.error( + consola.error( '❌ Failed to estimate energy via triggerConstantContract:', error.message )
309-310: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log(`✅ Balance check passed: ${balanceTrx} TRX available`) + consola.info(`✅ Balance check passed: ${balanceTrx} TRX available`)
325-325: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
- if (this.config.verbose) console.log('🚀 Deploying contract...') + if (this.config.verbose) consola.info('🚀 Deploying contract...')
359-361: Ensure transaction ID is properly extractedThe transaction ID extraction tries multiple locations but doesn't validate the result.
+ const transactionId = broadcastResult.txid || broadcastResult.transaction?.txID + if (!transactionId) { + throw new Error('Transaction ID not found in broadcast result') + } + return { contractAddress, - transactionId: - broadcastResult.txid || broadcastResult.transaction?.txID, + transactionId, deploymentTransaction: signedTx, costEstimate, }
379-385: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
- console.log('🧪 DRY RUN - Simulated deployment:', { + consola.info('🧪 DRY RUN - Simulated deployment:', { contractAddress: mockAddress, transactionId: mockTxId, estimatedCost: costEstimate.totalTrx.toFixed(4) + ' TRX', energy: costEstimate.energy, bandwidth: costEstimate.bandwidth, })
420-421: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log(`⏳ Waiting for transaction confirmation: ${transactionId}`) + consola.info(`⏳ Waiting for transaction confirmation: ${transactionId}`)
433-438: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log('✅ Transaction confirmed:', { + consola.success('✅ Transaction confirmed:', { blockNumber: receipt.blockNumber, energyUsed: receipt.receipt?.energy_usage_total || 0, result: receipt.result, })
450-453: Useconsolainstead ofconsole.logReplace console.log with consola for consistent logging.
if (this.config.verbose) - console.log( + consola.warn( `⚠️ Retry ${retries}/${maxRetries} for transaction receipt` )
🧹 Nitpick comments (1)
script/deploy/tron/deploy-core-facets.ts (1)
377-377: Address the TODO for encoding constructor argumentsThe TODO comment indicates that constructor arguments encoding is not implemented. This could be important for deployment verification and logging.
Would you like me to help implement the proper encoding of constructor arguments for the deployment log?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
config/networks.json(1 hunks)deployments/_deployments_log_file.json(48 hunks)deployments/tron.json(1 hunks)script/deploy/tron/TronContractDeployer.ts(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)script/deploy/tron/utils.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- deployments/tron.json
🚧 Files skipped from review as they are similar to previous changes (2)
- config/networks.json
- script/deploy/tron/utils.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
🧠 Learnings (73)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1169
File: script/deploy/zksync/DeployFeeCollector.zksync.s.sol:32-37
Timestamp: 2025-05-27T12:00:43.940Z
Learning: The lifinance/contracts repository has deployment scripts that perform validation checks (including zero-address validation) before executing individual deploy scripts, making runtime validation checks in the deploy scripts themselves redundant.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-04T09:10:17.997Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-04T09:17:19.275Z
Learning: In the `lifinance/contracts` repository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must reside in `script/deploy/facets/` for base deployments and `script/deploy/zksync/` for ZKSync-specific scripts.
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1453-1483
Timestamp: 2024-11-21T08:24:53.059Z
Learning: In `script/deploy/_targetState.json`, for the `abstract` network configuration, `ReceiverStargateV2` is correctly set to version `1.0.1`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Include proper logging for debugging and monitoring in TypeScript scripts.
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:46-46
Timestamp: 2024-12-02T08:19:07.783Z
Learning: In our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in Node.js version 18 or newer, so global `fetch` is available without importing.
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use environment variables for configuration in TypeScript scripts.
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: script/demoScripts/utils/lib/cowShedSdk.ts:0-0
Timestamp: 2025-06-05T14:50:17.275Z
Learning: For demo scripts and example code, ezynda3 prefers to keep the code simple and focused on demonstrating the core functionality rather than adding extensive input validation or defensive programming measures.
📚 Learning: deployment log files like `deployments/_deployments_log_file.json` are historical records that docum...
Learnt from: mirooon
PR: lifinance/contracts#1170
File: deployments/_deployments_log_file.json:28060-28072
Timestamp: 2025-05-28T17:33:33.959Z
Learning: Deployment log files like `deployments/_deployments_log_file.json` are historical records that document the actual versions deployed at specific times. They should not be updated to match current contract versions - they must accurately reflect what was deployed when the deployment occurred.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in `deployments/_deployments_log_file.json`, duplicate deployment entries for the same version and a...
Learnt from: 0xDEnYO
PR: lifinance/contracts#832
File: deployments/_deployments_log_file.json:23712-23720
Timestamp: 2024-12-04T01:59:34.045Z
Learning: In `deployments/_deployments_log_file.json`, duplicate deployment entries for the same version and address may occur because they correspond to deployments on different networks. These entries are acceptable and should not be flagged as duplicates in future reviews.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: updates to _deployments_log_file.json can represent backfilling of historical deployment data, not j...
Learnt from: ezynda3
PR: lifinance/contracts#914
File: deployments/_deployments_log_file.json:26902-26916
Timestamp: 2025-01-09T04:17:46.190Z
Learning: Updates to _deployments_log_file.json can represent backfilling of historical deployment data, not just new deployments. Such updates don't require new audits.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: deployment log files (like `_deployments_log_file.json`) are historical records that should not be u...
Learnt from: mirooon
PR: lifinance/contracts#1170
File: deployments/_deployments_log_file.json:28706-28717
Timestamp: 2025-05-28T17:33:10.529Z
Learning: Deployment log files (like `_deployments_log_file.json`) are historical records that should not be updated to match current contract versions. They should accurately reflect the versions that were actually deployed at specific timestamps.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: duplicate entries in `deployments/_deployments_log_file.json` that are outdated do not require chang...
Learnt from: 0xDEnYO
PR: lifinance/contracts#812
File: deployments/_deployments_log_file.json:1914-1927
Timestamp: 2024-10-09T03:47:21.269Z
Learning: Duplicate entries in `deployments/_deployments_log_file.json` that are outdated do not require changes.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: when analyzing deployment prs in the lifinance/contracts repository, carefully verify that target st...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
deployments/_deployments_log_file.jsonscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: for deployment prs updating contract addresses (like relayfacet on worldchain), verify the presence ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
deployments/_deployments_log_file.jsonscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: for deployment prs involving address updates like the relayfacet to worldchain, verify the actual pr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in deployment json files that contain "diamond" in their filename (located in the deployments folder...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in config/networks.json for the ronin network (chainid 2020), there is a problematic mismatch betwee...
Learnt from: mirooon
PR: lifinance/contracts#1283
File: config/networks.json:837-839
Timestamp: 2025-07-17T11:31:50.058Z
Learning: In config/networks.json for the Ronin network (chainId 2020), there is a problematic mismatch between verificationType ("blockscout") and explorerApiUrl ("https://sourcify.roninchain.com/server"). This inconsistency can lead to verification issues and should be flagged when networks.json is modified in future PRs.
Applied to files:
deployments/_deployments_log_file.jsonscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the 'worldchain' network, the addresses `0x50d5a8acfae13dceb217e9a071f6c6bd5bdb4155`, `0x8f023b41...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: config/dexs.json:748-752
Timestamp: 2024-11-21T08:39:29.530Z
Learning: In the 'worldchain' network, the addresses `0x50D5a8aCFAe13Dceb217E9a071F6c6Bd5bDB4155`, `0x8f023b4193a6b18C227B4a755f8e28B3D30Ef9a1`, and `0x603a538477d44064eA5A5d8C345b4Ff6fca1142a` are used as DEXs and should be included in `config/dexs.json`.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and ve...
Learnt from: 0xDEnYO
PR: lifinance/contracts#812
File: deployments/polygon.diamond.json:4-11
Timestamp: 2024-09-27T07:10:15.586Z
Learning: In `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and versions when specified by the developer.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: applies to src/facets/*facet.sol : facet contracts must reside in `src/facets/` and names must inclu...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to src/Facets/*Facet.sol : Facet contracts must reside in `src/Facets/` and names must include "Facet".
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: the bsca network intentionally maintains different facet versions between staging and production env...
Learnt from: mirooon
PR: lifinance/contracts#985
File: script/deploy/_targetState.json:0-0
Timestamp: 2025-02-12T09:44:12.961Z
Learning: The bsca network intentionally maintains different facet versions between staging and production environments, specifically:
1. CalldataVerificationFacet: v1.1.1 in staging vs v1.1.2 in production
2. EmergencyPauseFacet: present only in production
3. Permit2Proxy: present only in production
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: version differences in `calldataverificationfacet` between staging and production are acceptable and...
Learnt from: ezynda3
PR: lifinance/contracts#807
File: script/deploy/_targetState.json:164-164
Timestamp: 2024-12-03T11:01:57.084Z
Learning: Version differences in `CalldataVerificationFacet` between staging and production are acceptable and not an issue.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: version inconsistencies of 'genericswapfacetv3' across deployment configurations are acceptable if t...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/worldchain.diamond.json:40-43
Timestamp: 2024-11-26T01:16:27.721Z
Learning: Version inconsistencies of 'GenericSwapFacetV3' across deployment configurations are acceptable if they are only due to differences in Solidity pragma directives.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: for the cronos network configuration in `script/deploy/_targetstate.json`, the absence of bridge fac...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1364-1390
Timestamp: 2024-11-21T08:25:26.214Z
Learning: For the Cronos network configuration in `script/deploy/_targetState.json`, the absence of bridge facets such as `StargateFacet`, `AcrossFacet`, `HopFacet`, and `SymbiosisFacet` is acceptable and expected.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: the owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `diamondcutfacet` address `0x...
Learnt from: ezynda3
PR: lifinance/contracts#806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in `deployments/cronos.diamond.json`, both `genericswapfacet` and `genericswapfacetv3` are distinct ...
Learnt from: ezynda3
PR: lifinance/contracts#846
File: deployments/cronos.diamond.json:28-31
Timestamp: 2024-11-01T11:53:57.162Z
Learning: In `deployments/cronos.diamond.json`, both `GenericSwapFacet` and `GenericSwapFacetV3` are distinct facets that should be included together, as they serve different purposes.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: fixed gas amounts in test files (e.g., chainflipfacet.t.sol) don't require extensive documentation o...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: test/solidity/Facets/ChainflipFacet.t.sol:269-269
Timestamp: 2025-02-21T09:05:22.118Z
Learning: Fixed gas amounts in test files (e.g., ChainflipFacet.t.sol) don't require extensive documentation or configuration as they are only used for testing purposes.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: hyphenfacet v1.0.0 is intentionally included in the bsc staging environment and should not be remove...
Learnt from: ezynda3
PR: lifinance/contracts#807
File: script/deploy/_targetState.json:181-181
Timestamp: 2024-12-03T11:02:14.195Z
Learning: HyphenFacet v1.0.0 is intentionally included in the BSC staging environment and should not be removed even if not present in production environments.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: applies to **/*.sol : all solidity files must use the evm and solidity version defined in `foundry.t...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to **/*.sol : All Solidity files must use the EVM and Solidity version defined in `foundry.toml` unless networks require lower versions.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in `src/facets/emergencypausefacet.sol`, the `emergencypause` and `emergencyunpause` functions are c...
Learnt from: 0xDEnYO
PR: lifinance/contracts#829
File: deployments/optimism.diamond.staging.json:4-7
Timestamp: 2024-10-09T07:06:25.731Z
Learning: In `src/Facets/EmergencyPauseFacet.sol`, the `emergencyPause` and `emergencyUnpause` functions are correctly implemented and present.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in the `deployments/cronos.diamond.json` file, the `permit2proxy` address is intentionally left empt...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/cronos.diamond.json:67-67
Timestamp: 2024-11-26T01:17:13.212Z
Learning: In the `deployments/cronos.diamond.json` file, the `Permit2Proxy` address is intentionally left empty because `Permit2Proxy` is not deployed on the Cronos network.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: demo scripts in this codebase can use hardcoded gas limits and other simplified values, as they prio...
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: script/demoScripts/demoPatcherDest.ts:0-0
Timestamp: 2025-06-05T14:50:40.886Z
Learning: Demo scripts in this codebase can use hardcoded gas limits and other simplified values, as they prioritize demonstration clarity over production robustness.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in the testbase.sol file, the optimism network constants are set correctly with: - address_uniswap_o...
Learnt from: mirooon
PR: lifinance/contracts#1086
File: test/solidity/utils/TestBase.sol:195-205
Timestamp: 2025-04-04T07:21:52.878Z
Learning: In the TestBase.sol file, the Optimism network constants are set correctly with:
- ADDRESS_UNISWAP_OPTIMISM: 0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2 (Uniswap V2 Router)
- ADDRESS_USDC_OPTIMISM: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 (Native USDC)
- USDC.e (bridged USDC from Ethereum) on Optimism has address 0x7f5c764cbc14f9669b88837ca1490cca17c31607
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in the lifinance/contracts repository, 0xdenyo prefers to keep '0x0' as a fallback address in gas es...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:627-628
Timestamp: 2025-07-17T04:21:26.825Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep '0x0' as a fallback address in gas estimation calls rather than throwing errors when the wallet account address is not available, prioritizing code simplicity over strict validation.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: ensure that scripts used for codebase verification produce valid and accurate results before reporti...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/polygon.json:0-0
Timestamp: 2024-10-09T03:47:21.269Z
Learning: Ensure that scripts used for codebase verification produce valid and accurate results before reporting issues, especially when checking Ethereum address checksums in `deployments/polygon.json`.
Applied to files:
deployments/_deployments_log_file.jsonscript/deploy/tron/TronContractDeployer.ts
📚 Learning: duplicate deployment entries for the same contract address in deployment logs are acceptable in this...
Learnt from: ezynda3
PR: lifinance/contracts#827
File: deployments/_deployments_log_file.json:0-0
Timestamp: 2024-11-22T08:50:48.798Z
Learning: Duplicate deployment entries for the same contract address in deployment logs are acceptable in this project.
Applied to files:
deployments/_deployments_log_file.jsonscript/deploy/tron/TronContractDeployer.ts
📚 Learning: duplicate contract names (e.g., erc20proxy, executor, etc.) in _targetstate.json are expected when t...
Learnt from: 0xDEnYO
PR: lifinance/contracts#992
File: script/deploy/_targetState.json:25-32
Timestamp: 2025-02-13T03:04:19.306Z
Learning: Duplicate contract names (e.g., ERC20Proxy, Executor, etc.) in _targetState.json are expected when they appear across different network configurations, as they represent the same contract type deployed on multiple networks.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: the user mirooon prefers to maintain both dexmanagerfacet and whitelistmanagerfacet entries in stagi...
Learnt from: mirooon
PR: lifinance/contracts#1193
File: deployments/base.staging.json:6-6
Timestamp: 2025-08-01T22:11:04.478Z
Learning: The user mirooon prefers to maintain both DexManagerFacet and WhitelistManagerFacet entries in staging deployment configurations during migration periods, even when the DexManagerFacet contract no longer exists in the codebase. This approach allows for backward compatibility testing and rollback capabilities in the staging environment.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: in files with "staging" in their filename, such as `deployments/bsc.diamond.staging.json`, it is acc...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: deployments/bsc.diamond.staging.json:4-7
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In files with "staging" in their filename, such as `deployments/bsc.diamond.staging.json`, it is acceptable for facets to have empty "Name" and "Version" fields. Do not flag missing facet information in such files during reviews.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: for test utility contracts like testwhitelistmanagerbase, it's acceptable and preferred to have rela...
Learnt from: mirooon
PR: lifinance/contracts#1193
File: test/solidity/utils/TestWhitelistManagerBase.sol:11-19
Timestamp: 2025-06-15T13:22:56.249Z
Learning: For test utility contracts like TestWhitelistManagerBase, it's acceptable and preferred to have relaxed access controls (external functions without modifiers) to make testing more flexible and convenient, rather than mirroring production access control patterns.
Applied to files:
deployments/_deployments_log_file.json
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must reside ...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must reside in `script/deploy/facets/` for base deployments and `script/deploy/zksync/` for ZKSync-specific scripts.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must inherit...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: the deploy_new_network_mode flag in deployment scripts is required during initial contract deploymen...
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in lifi's deployment scripts, the `deploy` method in `deployscriptbase` handles the concatenation of...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/DeployReceiverStargateV2.s.sol:19-21
Timestamp: 2025-01-28T14:27:50.689Z
Learning: In LiFi's deployment scripts, the `deploy` method in `DeployScriptBase` handles the concatenation of constructor arguments with the contract's creation code, so child contracts don't need to concatenate the arguments explicitly.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in deployment scripts like `deploygaszipfacet.s.sol`, do not report issues suggesting adding error h...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipFacet.s.sol:22-35
Timestamp: 2024-09-23T01:42:03.075Z
Learning: In deployment scripts like `DeployGasZipFacet.s.sol`, do not report issues suggesting adding error handling for missing configuration files or unexpected JSON structures, as the script will fail if the file is missing.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: task scripts in script/tasks/ directory (like diamondsyncwhitelistedaddresses.sh) define functions t...
Learnt from: mirooon
PR: lifinance/contracts#1145
File: script/tasks/diamondSyncWhitelistedAddresses.sh:208-209
Timestamp: 2025-06-05T10:00:01.583Z
Learning: Task scripts in script/tasks/ directory (like diamondSyncWhitelistedAddresses.sh) define functions that are sourced by deployAllContracts.sh and called from there, rather than executing directly. They don't need to call their own functions at the end of the file.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: deployment scripts rely on external automation (pre-script checks) to validate constructor arguments...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1207
File: script/deploy/facets/DeployPioneerFacet.s.sol:17-27
Timestamp: 2025-06-13T08:30:28.665Z
Learning: Deployment scripts rely on external automation (pre-script checks) to validate constructor arguments such as non-zero addresses, so adding explicit `require` guards inside the Foundry deployment scripts is generally unnecessary.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : update scripts must inherit `up...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in nod...
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:46-46
Timestamp: 2024-12-02T08:19:07.783Z
Learning: In our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in Node.js version 18 or newer, so global `fetch` is available without importing.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in deployment scripts, do not suggest adding error handling to catch and report deployment failures,...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipPeriphery.s.sol:13-20
Timestamp: 2024-09-23T01:42:55.475Z
Learning: In deployment scripts, do not suggest adding error handling to catch and report deployment failures, as errors will be displayed by Foundry in the output.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/safe/safe-utils.ts, 0xdenyo prefers to keep the getcontractnamefromdeploymentlog fu...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/safe-utils.ts:1096-1142
Timestamp: 2025-07-17T04:38:42.425Z
Learning: In script/deploy/safe/safe-utils.ts, 0xDEnYO prefers to keep the getContractNameFromDeploymentLog function without explicit JSON structure validation, prioritizing code simplicity over comprehensive validation for deployment log parsing.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `fundnewwalletonallchains.ts` script, the gas estimation code involving `publicclient.estimat...
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:156-164
Timestamp: 2024-11-04T03:47:47.465Z
Learning: In the `fundNewWalletOnAllChains.ts` script, the gas estimation code involving `publicClient.estimateGas()` is intentionally commented out and should remain that way unless specified otherwise.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: when setting up new network deployments, it's expected that contract addresses in the deployment jso...
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifinance/contracts repository, 0xdenyo prefers not to add private key format validation in d...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifinance/contracts repository, 0xdenyo prefers to keep private key processing simple in scri...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:334-334
Timestamp: 2025-07-17T04:21:55.549Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep private key processing simple in scripts like execute-pending-timelock-tx.ts without adding format validation, prioritizing code simplicity over strict validation in controlled environments.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imp...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the deploy scripts (e.g., `script/deploy/zksync/deploypermit2proxy.s.sol`), complex error handlin...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: script/deploy/zksync/DeployPermit2Proxy.s.sol:22-61
Timestamp: 2024-11-25T13:49:40.464Z
Learning: In the deploy scripts (e.g., `script/deploy/zksync/DeployPermit2Proxy.s.sol`), complex error handling and address validation are not necessary. The team prefers to keep deploy scripts simple without extensive error handling.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/add-owners-to-safe.ts`, runtime validation for network configuration using zo...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:22:38.484Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, runtime validation for network configuration using Zod is not required; type assertions are acceptable.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the script `script/deploy/safe/add-owners-to-safe.ts`, additional defensive checks for network co...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:48-48
Timestamp: 2024-11-21T08:23:50.099Z
Learning: In the script `script/deploy/safe/add-owners-to-safe.ts`, additional defensive checks for network configuration may be unnecessary because the script will fail anyway when the network configuration is missing.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/deploy-safe.ts`, 0xdenyo intentionally changed the `allowoverride` flag defau...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1184
File: script/deploy/safe/deploy-safe.ts:0-0
Timestamp: 2025-07-03T07:34:47.349Z
Learning: In `script/deploy/safe/deploy-safe.ts`, 0xDEnYO intentionally changed the `allowOverride` flag default from `false` to `true` to allow overwriting existing Safe addresses by default in deployment workflows.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: the suggestion to modify `builddiamondcut` function in `updatescriptbase.sol` to handle selectors fr...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/utils/UpdateScriptBase.sol:112-178
Timestamp: 2025-01-28T14:29:00.823Z
Learning: The suggestion to modify `buildDiamondCut` function in `UpdateScriptBase.sol` to handle selectors from multiple old facets differently was deemed unnecessary by the maintainer.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: when `libasset.maxapproveerc20` is used with `type(uint256).max`, the team acknowledges and accepts ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Periphery/GasZipPeriphery.sol:49-53
Timestamp: 2024-09-23T02:04:16.323Z
Learning: When `LibAsset.maxApproveERC20` is used with `type(uint256).max`, the team acknowledges and accepts the associated security risks. In future reviews, avoid flagging this as a concern.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `withdrawableperiphery.sol` contract, when transferring ether in the `withdrawtoken` function...
Learnt from: 0xDEnYO
PR: lifinance/contracts#831
File: src/Helpers/WithdrawablePeriphery.sol:26-30
Timestamp: 2024-10-14T08:23:38.076Z
Learning: In the `WithdrawablePeriphery.sol` contract, when transferring Ether in the `withdrawToken` function, prefer using `SafeTransferLib.safeTransferETH` instead of low-level `call` for safer Ether transfers.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `gaszipperiphery.sol`, `libutil` and `validatable` are used, so ensure not to suggest their remov...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Periphery/GasZipPeriphery.sol:4-14
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In `GasZipPeriphery.sol`, `LibUtil` and `Validatable` are used, so ensure not to suggest their removal in future reviews.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifi codebase, basic error details in console.error are sufficient for transaction failures, ...
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptHelpers.ts:618-654
Timestamp: 2025-01-28T11:59:27.898Z
Learning: In the LiFi codebase, basic error details in console.error are sufficient for transaction failures, without the need for gas estimation or detailed error object destructuring.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the typescript file `script/utils/fetch-missing-deployments.ts`, the existing regex pattern `/\/\...
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:0-0
Timestamp: 2024-12-04T12:57:56.493Z
Learning: In the TypeScript file `script/utils/fetch-missing-deployments.ts`, the existing regex pattern `/\/\/\/\s*@custom:version\s*([\d.]+)/` used for version extraction is sufficient and does not require modification.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `script/tasks/fundnewwalletonallchains.ts` file, adding a timeout to the transaction confirma...
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:179-187
Timestamp: 2024-11-04T03:50:06.443Z
Learning: In the `script/tasks/fundNewWalletOnAllChains.ts` file, adding a timeout to the transaction confirmation wait using `publicClient.waitForTransactionReceipt` is not required.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to test/solidity/**/*.t.sol : all tests that verify a successful execution must be prefixed ...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to test/solidity/**/*.t.sol : All tests that verify a successful execution must be prefixed with: `test_`.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : use `consola` for consistent logging across typescript scripts....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use `consola` for consistent logging across TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : include proper logging for debugging and monitoring in typescript script...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Include proper logging for debugging and monitoring in TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/healthcheck.ts`, handling the case when `networkconfig` is undefined is unnecessar...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/healthCheck.ts:387-388
Timestamp: 2024-11-21T08:24:22.802Z
Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/healthcheck.ts, synchronous operations like execsync are acceptable and preferred o...
Learnt from: mirooon
PR: lifinance/contracts#1292
File: script/deploy/healthCheck.ts:140-143
Timestamp: 2025-07-24T08:38:32.976Z
Learning: In script/deploy/healthCheck.ts, synchronous operations like execSync are acceptable and preferred over async alternatives, as confirmed by maintainer mirooon. This is an exception to the general coding guideline requiring async/await for TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : all scripts must use `citty` for cli argument parsing....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : All scripts must use `citty` for CLI argument parsing.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/update-deployment-logs.ts, the user prefers to keep the isvalidjsonstructure method...
Learnt from: ezynda3
PR: lifinance/contracts#1230
File: script/deploy/update-deployment-logs.ts:205-211
Timestamp: 2025-06-24T07:10:15.839Z
Learning: In script/deploy/update-deployment-logs.ts, the user prefers to keep the isValidJsonStructure method simple with minimal validation rather than implementing comprehensive nested structure validation, as they consider thorough upfront validation to be overkill for their deployment logging needs.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: for staging files in deployments, avoid making comments regarding incomplete contract deployments or...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: deployments/bsc.staging.json:28-28
Timestamp: 2024-10-09T03:47:21.269Z
Learning: For staging files in deployments, avoid making comments regarding incomplete contract deployments or missing bytecode, as these comments are not necessary.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : handle errors appropriately with try/catch blocks in typescript scripts....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Handle errors appropriately with try/catch blocks in TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: always consult the conventions.md file for the latest rules and conventions when reviewing prs or co...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: the permit2proxy contract must not be deployed with zero addresses for its critical dependencies (li...
Learnt from: 0xDEnYO
PR: lifinance/contracts#988
File: script/deploy/facets/DeployPermit2Proxy.s.sol:33-37
Timestamp: 2025-02-11T10:33:52.791Z
Learning: The Permit2Proxy contract must not be deployed with zero addresses for its critical dependencies (LiFiDiamond, permit2Address, safeAddress). This is enforced by passing `false` to `_getConfigContractAddress` function.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
🔇 Additional comments (48)
deployments/_deployments_log_file.json (48)
1016-1026: Confirm address format for Tron entriesThe new Tron entries use Base58‐check addresses (e.g. “TVo2…”) whereas deployment tooling for other EVM networks consistently stores 0x-prefixed hex addresses.
Please double-check that every consumer ofdeployments/_deployments_log_file.json(scripts, dashboards, verifiers) can parse both formats; otherwise, convert the Tron addresses to their 0x hex representation for consistency.
2046-2058: No issues detected in this segment.
4393-4405: No issues detected in this segment.
19692-19701: No issues detected in this segment.
19738-19748: No issues detected in this segment.
19776-19785: No issues detected in this segment.
19801-19810: No issues detected in this segment.
19849-19858: No issues detected in this segment.
19874-19883: No issues detected in this segment.
19911-19920: No issues detected in this segment.
19936-19945: No issues detected in this segment.
29767-29775: No issues detected in this segment.
29790-29799: No issues detected in this segment.
29851-29859: No issues detected in this segment.
29889-29897: No issues detected in this segment.
29947-29955: No issues detected in this segment.
29985-29993: No issues detected in this segment.
30057-30065: No issues detected in this segment.
30091-30099: No issues detected in this segment.
30161-30169: No issues detected in this segment.
30207-30215: No issues detected in this segment.
30259-30267: No issues detected in this segment.
30303-30311: No issues detected in this segment.
30361-30369: No issues detected in this segment.
30409-30417: No issues detected in this segment.
30959-30967: No issues detected in this segment.
31085-31093: No issues detected in this segment.
31111-31120: No issues detected in this segment.
32071-32074: No issues detected in this segment.
34489-34490: No issues detected in this segment.
35757-35765: No issues detected in this segment.
35781-35789: No issues detected in this segment.
35807-35813: No issues detected in this segment.
35845-35850: No issues detected in this segment.
35867-35875: No issues detected in this segment.
35919-35927: No issues detected in this segment.
35945-35951: No issues detected in this segment.
35967-35975: No issues detected in this segment.
36009-36012: No issues detected in this segment.
36055-36061: No issues detected in this segment.
36079-36085: No issues detected in this segment.
36103-36109: No issues detected in this segment.
36127-36133: No issues detected in this segment.
36151-36157: No issues detected in this segment.
36409-36414: No issues detected in this segment.
36493-36498: No issues detected in this segment.
36517-36526: No issues detected in this segment.
38658-38700: No issues detected in the WhitelistManagerFacet / Patcher additions; entries appear consistent with prior staging-facet patterns.
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (50)
deployments/_deployments_log_file.json(45 hunks)deployments/arbitrum.diamond.json(1 hunks)deployments/arbitrum.diamond.staging.json(1 hunks)deployments/arbitrum.json(2 hunks)deployments/arbitrum.staging.json(1 hunks)deployments/aurora.diamond.json(1 hunks)deployments/aurora.json(1 hunks)deployments/avalanche.diamond.json(1 hunks)deployments/avalanche.json(1 hunks)deployments/base.diamond.json(2 hunks)deployments/base.json(2 hunks)deployments/base.staging.json(1 hunks)deployments/blast.diamond.json(1 hunks)deployments/blast.json(1 hunks)deployments/bob.diamond.json(1 hunks)deployments/bob.json(1 hunks)deployments/bsc.diamond.json(2 hunks)deployments/bsc.json(3 hunks)deployments/celo.diamond.json(1 hunks)deployments/celo.json(2 hunks)deployments/cronos.diamond.json(1 hunks)deployments/cronos.json(1 hunks)deployments/gravity.diamond.json(1 hunks)deployments/gravity.json(1 hunks)deployments/linea.diamond.json(1 hunks)deployments/linea.json(1 hunks)deployments/mainnet.diamond.json(2 hunks)deployments/mainnet.json(2 hunks)deployments/mantle.diamond.json(1 hunks)deployments/mantle.json(1 hunks)deployments/mode.json(1 hunks)deployments/optimism.diamond.json(1 hunks)deployments/optimism.json(1 hunks)deployments/plume.diamond.json(1 hunks)deployments/plume.json(1 hunks)deployments/polygon.diamond.json(3 hunks)deployments/polygon.json(2 hunks)deployments/scroll.diamond.json(1 hunks)deployments/scroll.json(1 hunks)deployments/sonic.diamond.json(1 hunks)deployments/sonic.json(1 hunks)deployments/taiko.diamond.json(1 hunks)deployments/taiko.json(1 hunks)deployments/tron.diamond.json(1 hunks)deployments/tron.json(1 hunks)deployments/xlayer.diamond.json(1 hunks)deployments/xlayer.json(1 hunks)deployments/zksync.diamond.json(1 hunks)deployments/zksync.json(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)
✅ Files skipped from review due to trivial changes (44)
- deployments/base.json
- deployments/arbitrum.json
- deployments/aurora.diamond.json
- deployments/avalanche.diamond.json
- deployments/mantle.diamond.json
- deployments/arbitrum.staging.json
- deployments/polygon.json
- deployments/aurora.json
- deployments/base.staging.json
- deployments/celo.diamond.json
- deployments/cronos.json
- deployments/arbitrum.diamond.json
- deployments/celo.json
- deployments/sonic.json
- deployments/linea.json
- deployments/gravity.diamond.json
- deployments/mode.json
- deployments/taiko.json
- deployments/plume.json
- deployments/bob.json
- deployments/sonic.diamond.json
- deployments/optimism.diamond.json
- deployments/linea.diamond.json
- deployments/blast.diamond.json
- deployments/cronos.diamond.json
- deployments/zksync.json
- deployments/bob.diamond.json
- deployments/xlayer.diamond.json
- deployments/gravity.json
- deployments/taiko.diamond.json
- deployments/optimism.json
- deployments/tron.diamond.json
- deployments/avalanche.json
- deployments/plume.diamond.json
- deployments/scroll.json
- deployments/blast.json
- deployments/xlayer.json
- deployments/zksync.diamond.json
- deployments/scroll.diamond.json
- deployments/mantle.json
- deployments/bsc.diamond.json
- deployments/mainnet.diamond.json
- deployments/polygon.diamond.json
- deployments/base.diamond.json
🚧 Files skipped from review as they are similar to previous changes (1)
- deployments/_deployments_log_file.json
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/deploy-core-facets.ts
🧠 Learnings (53)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1169
File: script/deploy/zksync/DeployFeeCollector.zksync.s.sol:32-37
Timestamp: 2025-05-27T12:00:43.940Z
Learning: The lifinance/contracts repository has deployment scripts that perform validation checks (including zero-address validation) before executing individual deploy scripts, making runtime validation checks in the deploy scripts themselves redundant.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-04T09:10:17.997Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-04T09:17:19.275Z
Learning: In the `lifinance/contracts` repository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must reside in `script/deploy/facets/` for base deployments and `script/deploy/zksync/` for ZKSync-specific scripts.
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1453-1483
Timestamp: 2024-11-21T08:24:53.059Z
Learning: In `script/deploy/_targetState.json`, for the `abstract` network configuration, `ReceiverStargateV2` is correctly set to version `1.0.1`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Include proper logging for debugging and monitoring in TypeScript scripts.
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:46-46
Timestamp: 2024-12-02T08:19:07.783Z
Learning: In our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in Node.js version 18 or newer, so global `fetch` is available without importing.
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use environment variables for configuration in TypeScript scripts.
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: script/demoScripts/utils/lib/cowShedSdk.ts:0-0
Timestamp: 2025-06-05T14:50:17.275Z
Learning: For demo scripts and example code, ezynda3 prefers to keep the code simple and focused on demonstrating the core functionality rather than adding extensive input validation or defensive programming measures.
📚 Learning: when setting up new network deployments, it's expected that contract addresses in the deployment jso...
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: for deployment prs updating contract addresses (like relayfacet on worldchain), verify the presence ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsonscript/deploy/tron/deploy-core-facets.tsdeployments/arbitrum.diamond.staging.jsondeployments/tron.json
📚 Learning: for deployment prs involving address updates like the relayfacet to worldchain, verify the actual pr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/arbitrum.diamond.staging.jsondeployments/tron.json
📚 Learning: in deployment json files that contain "diamond" in their filename (located in the deployments folder...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/arbitrum.diamond.staging.jsondeployments/tron.json
📚 Learning: in the `deployments/*.diamond.json` and `deployments/*.json` files, the `lifidexaggregator` contract...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `deployments/*.diamond.json` and `deployments/*.json` files, the `LiFiDEXAggregator` contract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: in deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: the bsca network intentionally maintains different facet versions between staging and production env...
Learnt from: mirooon
PR: lifinance/contracts#985
File: script/deploy/_targetState.json:0-0
Timestamp: 2025-02-12T09:44:12.961Z
Learning: The bsca network intentionally maintains different facet versions between staging and production environments, specifically:
1. CalldataVerificationFacet: v1.1.1 in staging vs v1.1.2 in production
2. EmergencyPauseFacet: present only in production
3. Permit2Proxy: present only in production
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: when analyzing deployment prs in the lifinance/contracts repository, carefully verify that target st...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsonscript/deploy/tron/deploy-core-facets.tsdeployments/arbitrum.diamond.staging.jsondeployments/tron.json
📚 Learning: for the cronos network configuration in `script/deploy/_targetstate.json`, the absence of bridge fac...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1364-1390
Timestamp: 2024-11-21T08:25:26.214Z
Learning: For the Cronos network configuration in `script/deploy/_targetState.json`, the absence of bridge facets such as `StargateFacet`, `AcrossFacet`, `HopFacet`, and `SymbiosisFacet` is acceptable and expected.
Applied to files:
deployments/bsc.json
📚 Learning: version inconsistencies of 'genericswapfacetv3' across deployment configurations are acceptable if t...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/worldchain.diamond.json:40-43
Timestamp: 2024-11-26T01:16:27.721Z
Learning: Version inconsistencies of 'GenericSwapFacetV3' across deployment configurations are acceptable if they are only due to differences in Solidity pragma directives.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: in src/facets/allbridgefacet.sol, the team has decided that explicit validation for address downcast...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1275
File: src/Facets/AllBridgeFacet.sol:164-164
Timestamp: 2025-07-16T01:03:08.106Z
Learning: In src/Facets/AllBridgeFacet.sol, the team has decided that explicit validation for address downcasting from `_bridgeData.sendingAssetId` to `bytes32(uint256(uint160(_bridgeData.sendingAssetId)))` is not required, accepting the potential risk of silent overflow from unsafe downcasting.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: in `debridgedlnfacet.sol`, direct access to the `debridgechainid` mapping is acceptable, and using t...
Learnt from: ezynda3
PR: lifinance/contracts#827
File: src/Facets/DeBridgeDlnFacet.sol:0-0
Timestamp: 2024-11-22T08:49:35.205Z
Learning: In `DeBridgeDlnFacet.sol`, direct access to the `deBridgeChainId` mapping is acceptable, and using the `getDeBridgeChainId` function is not necessary in these instances.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: the cbridgefacetpacked and cbridge addresses in addtokenapprovalstocbridgefacetpacked.s.sol must not...
Learnt from: 0xDEnYO
PR: lifinance/contracts#988
File: script/tasks/solidity/AddTokenApprovalsToCBridgeFacetPacked.s.sol:17-21
Timestamp: 2025-02-11T10:35:03.536Z
Learning: The CBridgeFacetPacked and cBridge addresses in AddTokenApprovalsToCBridgeFacetPacked.s.sol must not be zero addresses as they are required for token approvals to function properly.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: in allbridgefacet.sol, zero fee validation is not required at the contract level because the backend...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1275
File: src/Facets/AllBridgeFacet.sol:175-175
Timestamp: 2025-07-16T01:04:11.083Z
Learning: In AllBridgeFacet.sol, zero fee validation is not required at the contract level because the backend system ensures that calldata and msg.value are properly aligned before transactions reach the contract.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: the `relayfacet` contract, when missing from the source code but referenced in deployment configurat...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: script/deploy/_targetState.json:49-49
Timestamp: 2024-11-25T09:05:03.917Z
Learning: The `RelayFacet` contract, when missing from the source code but referenced in deployment configurations, should be treated the same way as `OpBNBBridgeFacet` and can be ignored in code reviews.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: in the `relayfacet` contract (`src/facets/relayfacet.sol`), within the `_startbridge` function, low-...
Learnt from: ezynda3
PR: lifinance/contracts#843
File: src/Facets/RelayFacet.sol:165-170
Timestamp: 2024-10-31T09:09:38.568Z
Learning: In the `RelayFacet` contract (`src/Facets/RelayFacet.sol`), within the `_startBridge` function, low-level `call` is intentionally used to transfer tokens so that extra bytes can be added to the calldata, as required for integrating with Relay Protocol.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: errors about the missing `opbnbbridgefacet` contract are expected when it is referenced in the targe...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: script/deploy/_targetState.json:143-143
Timestamp: 2024-11-25T09:04:55.880Z
Learning: Errors about the missing `OpBNBBridgeFacet` contract are expected when it is referenced in the target state but not yet merged into the main branch.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: in debridgedlnfacet, chain id mappings are hardcoded and not designed to be dynamically updated, so ...
Learnt from: mirooon
PR: lifinance/contracts#975
File: test/solidity/Facets/DeBridgeDlnFacet.t.sol:0-0
Timestamp: 2025-02-17T07:59:54.979Z
Learning: In DeBridgeDlnFacet, chain ID mappings are hardcoded and not designed to be dynamically updated, so tests for mapping updates are not needed.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: lifidiamond contains generic withdrawal logic, so individual facet contracts (e.g., pioneerfacet) do...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1207
File: deployments/_deployments_log_file.json:34037-34080
Timestamp: 2025-06-13T08:30:26.220Z
Learning: LiFiDiamond contains generic withdrawal logic, so individual facet contracts (e.g., PioneerFacet) do not need their own Ether-withdraw functions.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: in the lifi contract architecture, "lifidiamond" is the diamond proxy contract that connects all fac...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: deployments/abstract.json:2-4
Timestamp: 2025-01-28T14:30:06.911Z
Learning: In the LiFi contract architecture, "LiFiDiamond" is the diamond proxy contract that connects all facets into a cohesive system. The facets are individual contracts that provide specific functionality, and the diamond proxy delegates calls to these facets.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: in `deployments/cronos.diamond.json`, both `genericswapfacet` and `genericswapfacetv3` are distinct ...
Learnt from: ezynda3
PR: lifinance/contracts#846
File: deployments/cronos.diamond.json:28-31
Timestamp: 2024-11-01T11:53:57.162Z
Learning: In `deployments/cronos.diamond.json`, both `GenericSwapFacet` and `GenericSwapFacetV3` are distinct facets that should be included together, as they serve different purposes.
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: applies to src/facets/*facet.sol : facet contracts must reside in `src/facets/` and names must inclu...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to src/Facets/*Facet.sol : Facet contracts must reside in `src/Facets/` and names must include "Facet".
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: the chainflipdata struct in chainflipfacet has three fields: 1. uint32 dsttoken - the destination to...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: docs/ChainflipFacet.md:0-0
Timestamp: 2025-02-13T08:57:00.095Z
Learning: The ChainflipData struct in ChainflipFacet has three fields:
1. uint32 dstToken - The destination token identifier in Chainflip
2. bytes32 nonEvmAddress - The non-EVM destination address
3. bytes cfParameters - Additional parameters for Chainflip protocol
Applied to files:
deployments/bsc.jsondeployments/mainnet.jsondeployments/tron.json
📚 Learning: in the 'worldchain' network, the addresses `0x50d5a8acfae13dceb217e9a071f6c6bd5bdb4155`, `0x8f023b41...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: config/dexs.json:748-752
Timestamp: 2024-11-21T08:39:29.530Z
Learning: In the 'worldchain' network, the addresses `0x50D5a8aCFAe13Dceb217E9a071F6c6Bd5bDB4155`, `0x8f023b4193a6b18C227B4a755f8e28B3D30Ef9a1`, and `0x603a538477d44064eA5A5d8C345b4Ff6fca1142a` are used as DEXs and should be included in `config/dexs.json`.
Applied to files:
deployments/bsc.jsondeployments/mainnet.json
📚 Learning: in the `lifinance/contracts` repository, `receiverstargatev2` may not be deployed to all networks, a...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-04T09:10:17.997Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Applied to files:
deployments/bsc.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: in the lifinance/contracts repository, it's normal and expected for periphery contracts to have empt...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Applied to files:
deployments/bsc.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: in periphery contracts like receiverchainflip, the receive function can be left open without access ...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: src/Periphery/ReceiverChainflip.sol:162-162
Timestamp: 2025-02-24T06:51:03.551Z
Learning: In periphery contracts like ReceiverChainflip, the receive function can be left open without access control as it's part of the intended design.
Applied to files:
deployments/bsc.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: contract address validations for periphery contracts like receiverchainflip are handled in deploymen...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: src/Periphery/ReceiverChainflip.sol:48-62
Timestamp: 2025-02-24T09:35:34.908Z
Learning: Contract address validations for periphery contracts like ReceiverChainflip are handled in deployment scripts rather than in the constructor.
Applied to files:
deployments/bsc.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: when contracts are redeployed, they receive new addresses. permit2proxy addresses in deployment file...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1140
File: deployments/fantom.diamond.json:97-105
Timestamp: 2025-06-25T06:27:38.873Z
Learning: When contracts are redeployed, they receive new addresses. Permit2Proxy addresses in deployment files reflect the actual deployed contract addresses for each network, not a standardized address across all networks.
Applied to files:
deployments/mainnet.json
📚 Learning: in the `lifinance/contracts` repository, it's acceptable to retain references to the old `lifuelfeec...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/base.diamond.json:123-123
Timestamp: 2024-10-04T09:01:56.514Z
Learning: In the `lifinance/contracts` repository, it's acceptable to retain references to the old `LiFuelFeeCollector` address (`0xc4f7A34b8d283f66925eF0f5CCdFC2AF3030DeaE`) in deployment files when updating them is not necessary.
Applied to files:
deployments/mainnet.json
📚 Learning: in `deployments/_deployments_log_file.json`, duplicate deployment entries for the same version and a...
Learnt from: 0xDEnYO
PR: lifinance/contracts#832
File: deployments/_deployments_log_file.json:23712-23720
Timestamp: 2024-12-04T01:59:34.045Z
Learning: In `deployments/_deployments_log_file.json`, duplicate deployment entries for the same version and address may occur because they correspond to deployments on different networks. These entries are acceptable and should not be flagged as duplicates in future reviews.
Applied to files:
deployments/mainnet.jsondeployments/arbitrum.diamond.staging.json
📚 Learning: the `cfparameters` field in chainflipfacet's chainflipdata struct is not used in the current impleme...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: test/solidity/Facets/ChainflipFacet.t.sol:81-87
Timestamp: 2025-02-21T09:09:15.973Z
Learning: The `cfParameters` field in ChainflipFacet's ChainflipData struct is not used in the current implementation and serves as a placeholder.
Applied to files:
deployments/mainnet.jsondeployments/tron.json
📚 Learning: the `lifidexaggregator` contract does not include a `swapandcompare` function....
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/bsc.json:48-48
Timestamp: 2024-10-04T09:00:06.744Z
Learning: The `LiFiDEXAggregator` contract does not include a `swapAndCompare` function.
Applied to files:
deployments/mainnet.json
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must reside ...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must reside in `script/deploy/facets/` for base deployments and `script/deploy/zksync/` for ZKSync-specific scripts.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must inherit...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Applied to files:
script/deploy/tron/deploy-core-facets.tsdeployments/tron.json
📚 Learning: the deploy_new_network_mode flag in deployment scripts is required during initial contract deploymen...
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in lifi's deployment scripts, the `deploy` method in `deployscriptbase` handles the concatenation of...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/DeployReceiverStargateV2.s.sol:19-21
Timestamp: 2025-01-28T14:27:50.689Z
Learning: In LiFi's deployment scripts, the `deploy` method in `DeployScriptBase` handles the concatenation of constructor arguments with the contract's creation code, so child contracts don't need to concatenate the arguments explicitly.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in deployment scripts like `deploygaszipfacet.s.sol`, do not report issues suggesting adding error h...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipFacet.s.sol:22-35
Timestamp: 2024-09-23T01:42:03.075Z
Learning: In deployment scripts like `DeployGasZipFacet.s.sol`, do not report issues suggesting adding error handling for missing configuration files or unexpected JSON structures, as the script will fail if the file is missing.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: task scripts in script/tasks/ directory (like diamondsyncwhitelistedaddresses.sh) define functions t...
Learnt from: mirooon
PR: lifinance/contracts#1145
File: script/tasks/diamondSyncWhitelistedAddresses.sh:208-209
Timestamp: 2025-06-05T10:00:01.583Z
Learning: Task scripts in script/tasks/ directory (like diamondSyncWhitelistedAddresses.sh) define functions that are sourced by deployAllContracts.sh and called from there, rather than executing directly. They don't need to call their own functions at the end of the file.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: deployment scripts rely on external automation (pre-script checks) to validate constructor arguments...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1207
File: script/deploy/facets/DeployPioneerFacet.s.sol:17-27
Timestamp: 2025-06-13T08:30:28.665Z
Learning: Deployment scripts rely on external automation (pre-script checks) to validate constructor arguments such as non-zero addresses, so adding explicit `require` guards inside the Foundry deployment scripts is generally unnecessary.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : update scripts must inherit `up...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in deployment scripts, do not suggest adding error handling to catch and report deployment failures,...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipPeriphery.s.sol:13-20
Timestamp: 2024-09-23T01:42:55.475Z
Learning: In deployment scripts, do not suggest adding error handling to catch and report deployment failures, as errors will be displayed by Foundry in the output.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in script/deploy/safe/safe-utils.ts, 0xdenyo prefers to keep the getcontractnamefromdeploymentlog fu...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/safe-utils.ts:1096-1142
Timestamp: 2025-07-17T04:38:42.425Z
Learning: In script/deploy/safe/safe-utils.ts, 0xDEnYO prefers to keep the getContractNameFromDeploymentLog function without explicit JSON structure validation, prioritizing code simplicity over comprehensive validation for deployment log parsing.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in nod...
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:46-46
Timestamp: 2024-12-02T08:19:07.783Z
Learning: In our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in Node.js version 18 or newer, so global `fetch` is available without importing.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in `deployments/bsc.diamond.staging.json`, the trailing comma after the last property in the `periph...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: deployments/bsc.diamond.staging.json:100-101
Timestamp: 2024-10-24T06:17:25.211Z
Learning: In `deployments/bsc.diamond.staging.json`, the trailing comma after the last property in the `Periphery` object is acceptable and should not be flagged as a JSON formatting error.
Applied to files:
deployments/arbitrum.diamond.staging.json
📚 Learning: in `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and ve...
Learnt from: 0xDEnYO
PR: lifinance/contracts#812
File: deployments/polygon.diamond.json:4-11
Timestamp: 2024-09-27T07:10:15.586Z
Learning: In `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and versions when specified by the developer.
Applied to files:
deployments/arbitrum.diamond.staging.jsondeployments/tron.json
📚 Learning: the patcher contract in src/periphery/patcher.sol is designed to be used in conjunction with an api ...
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: src/Periphery/Patcher.sol:76-82
Timestamp: 2025-06-05T14:31:33.404Z
Learning: The Patcher contract in src/Periphery/Patcher.sol is designed to be used in conjunction with an API and is never meant to hold user funds or user approvals. This architectural design makes the arbitrary delegatecall functionality less risky as the contract operates in a stateless/ephemeral manner.
Applied to files:
deployments/arbitrum.diamond.staging.json
📚 Learning: in src/periphery/patcher.sol, the unlimited token approval to finaltarget in depositandexecutewithdy...
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: src/Periphery/Patcher.sol:160-167
Timestamp: 2025-06-05T14:48:58.816Z
Learning: In src/Periphery/Patcher.sol, the unlimited token approval to finalTarget in depositAndExecuteWithDynamicPatches and depositAndExecuteWithMultiplePatches functions is intentional behavior, as confirmed by ezynda3. This design choice aligns with the contract's stateless/ephemeral architecture.
Applied to files:
deployments/arbitrum.diamond.staging.json
📚 Learning: in `deployments/*.diamond.json` configuration files, facets that are part of an open pr and not yet ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/arbitrum.diamond.json:148-150
Timestamp: 2024-11-26T01:01:18.499Z
Learning: In `deployments/*.diamond.json` configuration files, facets that are part of an open PR and not yet merged into the main branch may have missing `Name` and `Version` fields.
Applied to files:
deployments/tron.json
📚 Learning: deployment log files like `deployments/_deployments_log_file.json` are historical records that docum...
Learnt from: mirooon
PR: lifinance/contracts#1170
File: deployments/_deployments_log_file.json:28060-28072
Timestamp: 2025-05-28T17:33:33.959Z
Learning: Deployment log files like `deployments/_deployments_log_file.json` are historical records that document the actual versions deployed at specific times. They should not be updated to match current contract versions - they must accurately reflect what was deployed when the deployment occurred.
Applied to files:
deployments/tron.json
📚 Learning: in `deployments/*.diamond.json` files, it's acceptable for facets to have empty `name` and `version`...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/fantom.diamond.json:92-94
Timestamp: 2024-11-26T01:04:16.637Z
Learning: In `deployments/*.diamond.json` files, it's acceptable for facets to have empty `Name` and `Version` fields, and these should not be flagged as issues.
Applied to files:
deployments/tron.json
📚 Learning: the owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `diamondcutfacet` address `0x...
Learnt from: ezynda3
PR: lifinance/contracts#806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.
Applied to files:
deployments/tron.json
🪛 Gitleaks (8.27.2)
deployments/arbitrum.diamond.staging.json
182-182: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
deployments/tron.json
2-2: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🔇 Additional comments (16)
deployments/arbitrum.diamond.staging.json (1)
180-181: Confirm new periphery entries & checksum-case before mergingNice to see
RelayerCelerIMandPatcherrolled out to Arbitrum staging.
Please double-check before merge:
Are the two addresses EIP-55 checksummed exactly as deployed?
(Example quick check:npx eth-sig-util --is-checksum-address <addr>).
An incorrect checksum ends up in flaky monitoring & off-chain tooling.Has
script/deploy/_targetState.json(and any network-specific target-state files) been updated accordingly? Deploy tooling relies on those files to keep staging ↔ prod in sync.If these contracts are meant to exist in production as well, remember to replicate the entries in
deployments/arbitrum.diamond.json(non-staging) or note why they are staging-only.Gitleaks flags these hex strings as “generic API keys”; that’s a false positive for EVM addresses and can be ignored once the checksum verification is done.
deployments/tron.json (1)
1-14: LGTM! Tron deployment configuration is correctly structured.The JSON configuration follows the established pattern for deployment files, with proper Tron address format (base58 starting with 'T'). All core facets and LiFiDiamond are properly mapped.
Note: The static analysis warning about a "Generic API Key" on line 2 is a false positive - these are legitimate Tron blockchain addresses in base58 format.
script/deploy/tron/deploy-core-facets.ts (8)
1-18: LGTM! Proper setup and imports following project conventions.The script correctly uses Bun as runtime, imports required dependencies, and follows the established pattern for TypeScript deployment scripts with proper logging and utility imports.
27-44: Good error handling for network configuration.The environment detection and network configuration loading includes proper error handling with informative messages and graceful exits.
61-73: Well-configured deployment parameters.The deployment configuration includes appropriate safety margins, retry logic, and timeout settings for Tron network deployment.
97-121: Excellent safety measures for production deployments.The confirmation prompts differentiate between production and staging environments with appropriate defaults, providing good protection against accidental production deployments.
183-237: Proper handling of constructor arguments with address format conversion.The logic correctly handles different facet types requiring constructor arguments, with proper conversion between Tron address formats (hex ↔ base58) for ABI encoding compatibility.
273-288: Good error recovery strategy.The deployment continues after individual facet failures, tracking failed deployments for later review rather than halting the entire process. This is appropriate for batch deployments.
494-505: Excellent post-deployment reporting.The summary provides clear feedback on failed deployments with actionable guidance for remediation.
517-518: Proper script execution pattern.Uses the correct pattern for direct script execution with proper error handling.
deployments/bsc.json (3)
48-48: LiFiDEXAggregator address update LGTMChecksum-cased address present; no further action required.
31-31: AllBridgeFacet version bump & target-state sync verifiedBoth the deployment and target-state entries for AllBridgeFacet have been updated to version 2.1.0:
- deployments/bsc.diamond.json:
"Name": "AllBridgeFacet", "Version": "2.1.0"- script/deploy/_targetState.json:
Multiple network entries all list"AllBridgeFacet": "2.1.0"No further changes required.
51-51: No update needed in_targetState.jsonfor GasZipPeripheryThe
_targetState.jsonfile inscript/deployholds version identifiers (e.g.,"1.0.1") rather than contract addresses. You’ve already updated the new GasZipPeriphery address in:
deployments/bsc.jsondeployments/bsc.diamond.jsonNo further propagation to
_targetState.jsonis required.Likely an incorrect or invalid review comment.
deployments/mainnet.json (3)
58-58: LiFiDEXAggregator address update LGTMThe aggregator address is updated to
0x8189AFcC5B73Dc90600FeE92e5267Aff1D192884.
No further issues spotted; note that identical addresses across networks are acceptable per past decisions.
64-64: Confirm GasZipPeriphery update is reflected in diamond & target-state filesPlease ensure the new periphery address
0x7339d0d71DD79FE3Bc4A2650F7E025ffeac170FAis also present in:
deployments/mainnet.diamond.json- Any Trent-specific target-state entries touched in this PR
41-41: Confirm AllBridgeFacet address propagation and EIP-55 checksumThe new main-net address
0xAE5325C02b87ff1D3752a1d3100Ec82537605B72has been applied consistently in:
- deployments/mainnet.json
- deployments/mainnet.diamond.json
- deployments/_deployments_log_file.json
Note:
script/deploy/_targetState.jsonuses version mappings (e.g."AllBridgeFacet": "2.1.0") and does not require address entries.Please verify that
0xAE5325C02b87ff1D3752a1d3100Ec82537605B72conforms to the EIP-55 checksum (via your preferred tooling or a block explorer).
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: 4
♻️ Duplicate comments (1)
script/deploy/tron/deploy-core-facets.ts (1)
424-425: TODO: Properly encode constructor arguments.The constructor arguments encoding is incomplete and needs to be implemented.
🧹 Nitpick comments (7)
script/deploy/tron/deploy-and-register-periphery.ts (3)
101-102: Consider making the balance threshold configurable.The hardcoded 100 TRX threshold might be insufficient for mainnet deployments. Consider making this configurable or calculating it based on expected deployment costs.
- if (networkInfo.balance < 100) + const MIN_BALANCE_TRX = Number(getEnvVar('MIN_DEPLOYMENT_BALANCE_TRX', '500')) + if (networkInfo.balance < MIN_BALANCE_TRX) - consola.warn('Low balance detected. Deployment may fail.') + consola.warn(`Low balance detected (${networkInfo.balance} TRX). Minimum recommended: ${MIN_BALANCE_TRX} TRX. Deployment may fail.`)
558-579: Simplify wrapped native address validation.The wrapped native address is validated twice with different approaches. Consolidate the validation logic.
- // Check if wrapped native address is valid (not zero address) - const wrappedNativeBase58Check = tronConfig.wrappedNativeAddress - const wrappedNativeHexCheck = wrappedNativeBase58Check - ? '0x' + tronWeb.address.toHex(wrappedNativeBase58Check).substring(2) - : '0x0000000000000000000000000000000000000000' - - if ( - wrappedNativeHexCheck === '0x0000000000000000000000000000000000000000' - ) { + // Check if wrapped native address is valid + const wrappedNativeBase58 = tronConfig.wrappedNativeAddress + if (!wrappedNativeBase58 || wrappedNativeBase58 === 'T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb') { + // T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb is Tron's zero address in base58 consola.warn( ' Wrapped native address is zero address. Skipping TokenWrapper deployment.' )
784-784: Extract magic values as constants.Hardcoded values should be extracted as named constants for better maintainability.
At the top of the file, add:
const TRON_ZERO_ADDRESS = '410000000000000000000000000000000000000000' const REGISTRATION_FEE_LIMIT = 1_000_000_000 // 1000 TRX in SUNThen use them:
- registered !== '410000000000000000000000000000000000000000' + registered !== TRON_ZERO_ADDRESS - feeLimit: 1_000_000_000, // 1000 TRX + feeLimit: REGISTRATION_FEE_LIMIT,Also applies to: 818-818
script/deploy/tron/register-facets-to-diamond.ts (1)
295-295: Extract hardcoded values as constants.Hardcoded values for TRX requirements and fee limits should be extracted as constants.
Add at the top of the file:
const MIN_REQUIRED_TRX = 5 // Minimum TRX balance required for deployment const DIAMOND_CUT_FEE_LIMIT_SUN = 5_000_000_000 // 5 TRX in SUNThen use them:
- const requiredTRX = 5 // Based on actual usage, need at least 5 TRX + const requiredTRX = MIN_REQUIRED_TRX - const feeLimitInSun = 5_000_000_000 // 5 TRX in SUN + const feeLimitInSun = DIAMOND_CUT_FEE_LIMIT_SUNAlso applies to: 325-325
script/deploy/tron/deploy-core-facets.ts (2)
193-197: Reuse TronWeb instance to avoid redundant instantiations.The code creates multiple TronWeb instances throughout the file. Create a single instance and reuse it.
At the beginning of the function, after getting the private key:
// Initialize TronWeb once const { TronWeb } = await import('tronweb') const tronWeb = new TronWeb({ fullHost: network, privateKey, })Then reuse
tronWebthroughout the function instead of creating new instances.Also applies to: 218-222, 383-387
88-89: Consider making the balance threshold configurable.Similar to the periphery deployment script, the hardcoded 100 TRX threshold might be insufficient for mainnet deployments.
- if (networkInfo.balance < 100) + const MIN_BALANCE_TRX = Number(getEnvVar('MIN_DEPLOYMENT_BALANCE_TRX', '500')) + if (networkInfo.balance < MIN_BALANCE_TRX) - consola.warn('Low balance detected. Deployment may fail.') + consola.warn(`Low balance detected (${networkInfo.balance} TRX). Minimum recommended: ${MIN_BALANCE_TRX} TRX. Deployment may fail.`)script/deploy/tron/TronContractDeployer.ts (1)
40-44: Consider masking the address in verbose logging for security.While the consola usage is correct, logging the full address in verbose mode could expose sensitive information. Consider masking it:
if (this.config.verbose) consola.debug('TronWeb initialized:', { network: this.config.fullHost, - address: this.tronWeb.defaultAddress.base58, + address: this.tronWeb.defaultAddress.base58.slice(0, 6) + '...' + this.tronWeb.defaultAddress.base58.slice(-4), })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
config/networks.json(1 hunks)script/deploy/tron/TronContractDeployer.ts(1 hunks)script/deploy/tron/deploy-and-register-periphery.ts(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)script/deploy/tron/register-facets-to-diamond.ts(1 hunks)script/deploy/tron/utils.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- config/networks.json
- script/deploy/tron/utils.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
🧠 Learnings (58)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1169
File: script/deploy/zksync/DeployFeeCollector.zksync.s.sol:32-37
Timestamp: 2025-05-27T12:00:43.940Z
Learning: The lifinance/contracts repository has deployment scripts that perform validation checks (including zero-address validation) before executing individual deploy scripts, making runtime validation checks in the deploy scripts themselves redundant.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/boba.diamond.json:68-68
Timestamp: 2024-10-04T09:10:17.997Z
Learning: In the `lifinance/contracts` repository, `ReceiverStargateV2` may not be deployed to all networks, and it's acceptable for its address to remain empty in deployment files when it is not deployed. PRs unrelated to `ReceiverStargateV2` should not raise comments about its absence.
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `lifinance/contracts` repository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1453-1483
Timestamp: 2024-11-21T08:24:53.059Z
Learning: In `script/deploy/_targetState.json`, for the `abstract` network configuration, `ReceiverStargateV2` is correctly set to version `1.0.1`.
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/_targetState.json:1364-1390
Timestamp: 2024-11-21T08:25:26.214Z
Learning: For the Cronos network configuration in `script/deploy/_targetState.json`, the absence of bridge facets such as `StargateFacet`, `AcrossFacet`, `HopFacet`, and `SymbiosisFacet` is acceptable and expected.
Learnt from: ezynda3
PR: lifinance/contracts#1124
File: script/demoScripts/utils/lib/cowShedSdk.ts:0-0
Timestamp: 2025-06-05T14:50:17.275Z
Learning: For demo scripts and example code, ezynda3 prefers to keep the code simple and focused on demonstrating the core functionality rather than adding extensive input validation or defensive programming measures.
📚 Learning: the suggestion to modify `builddiamondcut` function in `updatescriptbase.sol` to handle selectors fr...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/utils/UpdateScriptBase.sol:112-178
Timestamp: 2025-01-28T14:29:00.823Z
Learning: The suggestion to modify `buildDiamondCut` function in `UpdateScriptBase.sol` to handle selectors from multiple old facets differently was deemed unnecessary by the maintainer.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must reside ...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must reside in `script/deploy/facets/` for base deployments and `script/deploy/zksync/` for ZKSync-specific scripts.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.ts
📚 Learning: for deployment prs involving address updates like the relayfacet to worldchain, verify the actual pr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: in `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and ve...
Learnt from: 0xDEnYO
PR: lifinance/contracts#812
File: deployments/polygon.diamond.json:4-11
Timestamp: 2024-09-27T07:10:15.586Z
Learning: In `deployments/polygon.diamond.json`, it's acceptable for certain facets to have empty names and versions when specified by the developer.
Applied to files:
script/deploy/tron/register-facets-to-diamond.ts
📚 Learning: applies to src/facets/*facet.sol : facet contracts must reside in `src/facets/` and names must inclu...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to src/Facets/*Facet.sol : Facet contracts must reside in `src/Facets/` and names must include "Facet".
Applied to files:
script/deploy/tron/register-facets-to-diamond.ts
📚 Learning: in deployment scripts like `deploygaszipfacet.s.sol`, do not report issues suggesting adding error h...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipFacet.s.sol:22-35
Timestamp: 2024-09-23T01:42:03.075Z
Learning: In deployment scripts like `DeployGasZipFacet.s.sol`, do not report issues suggesting adding error handling for missing configuration files or unexpected JSON structures, as the script will fail if the file is missing.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: the deploy_new_network_mode flag in deployment scripts is required during initial contract deploymen...
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: task scripts in script/tasks/ directory (like diamondsyncwhitelistedaddresses.sh) define functions t...
Learnt from: mirooon
PR: lifinance/contracts#1145
File: script/tasks/diamondSyncWhitelistedAddresses.sh:208-209
Timestamp: 2025-06-05T10:00:01.583Z
Learning: Task scripts in script/tasks/ directory (like diamondSyncWhitelistedAddresses.sh) define functions that are sourced by deployAllContracts.sh and called from there, rather than executing directly. They don't need to call their own functions at the end of the file.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.ts
📚 Learning: in `deployments/cronos.diamond.json`, both `genericswapfacet` and `genericswapfacetv3` are distinct ...
Learnt from: ezynda3
PR: lifinance/contracts#846
File: deployments/cronos.diamond.json:28-31
Timestamp: 2024-11-01T11:53:57.162Z
Learning: In `deployments/cronos.diamond.json`, both `GenericSwapFacet` and `GenericSwapFacetV3` are distinct facets that should be included together, as they serve different purposes.
Applied to files:
script/deploy/tron/register-facets-to-diamond.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : deployment scripts must inherit...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Deployment scripts must inherit `DeployScriptBase` and use JSON config with `stdJson`.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: for deployment prs updating contract addresses (like relayfacet on worldchain), verify the presence ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
script/deploy/tron/register-facets-to-diamond.tsscript/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in lifi's deployment scripts, the `deploy` method in `deployscriptbase` handles the concatenation of...
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/DeployReceiverStargateV2.s.sol:19-21
Timestamp: 2025-01-28T14:27:50.689Z
Learning: In LiFi's deployment scripts, the `deploy` method in `DeployScriptBase` handles the concatenation of constructor arguments with the contract's creation code, so child contracts don't need to concatenate the arguments explicitly.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the deploy scripts (e.g., `script/deploy/zksync/deploypermit2proxy.s.sol`), complex error handlin...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: script/deploy/zksync/DeployPermit2Proxy.s.sol:22-61
Timestamp: 2024-11-25T13:49:40.464Z
Learning: In the deploy scripts (e.g., `script/deploy/zksync/DeployPermit2Proxy.s.sol`), complex error handling and address validation are not necessary. The team prefers to keep deploy scripts simple without extensive error handling.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: when analyzing deployment prs in the lifinance/contracts repository, carefully verify that target st...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: parameter validation for deployment scripts in the lifi contracts is handled by pre-deployment scrip...
Learnt from: 0xDEnYO
PR: lifinance/contracts#963
File: script/deploy/zksync/DeploySymbiosisFacet.zksync.s.sol:21-34
Timestamp: 2025-01-30T02:51:43.006Z
Learning: Parameter validation for deployment scripts in the LiFi contracts is handled by pre-deployment scripts, making additional validation within individual deployment scripts unnecessary.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: contract address validations for periphery contracts like receiverchainflip are handled in deploymen...
Learnt from: ezynda3
PR: lifinance/contracts#984
File: src/Periphery/ReceiverChainflip.sol:48-62
Timestamp: 2025-02-24T09:35:34.908Z
Learning: Contract address validations for periphery contracts like ReceiverChainflip are handled in deployment scripts rather than in the constructor.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: in the lifinance/contracts repository, it's normal and expected for periphery contracts to have empt...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: in deployment json files that contain "diamond" in their filename (located in the deployments folder...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.ts
📚 Learning: in deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contr...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: the permit2proxy contract must not be deployed with zero addresses for its critical dependencies (li...
Learnt from: 0xDEnYO
PR: lifinance/contracts#988
File: script/deploy/facets/DeployPermit2Proxy.s.sol:33-37
Timestamp: 2025-02-11T10:33:52.791Z
Learning: The Permit2Proxy contract must not be deployed with zero addresses for its critical dependencies (LiFiDiamond, permit2Address, safeAddress). This is enforced by passing `false` to `_getConfigContractAddress` function.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `deployments/*.diamond.json` and `deployments/*.json` files, the `lifidexaggregator` contract...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `deployments/*.diamond.json` and `deployments/*.json` files, the `LiFiDEXAggregator` contract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: when reviewing pull requests, only point out missing contract addresses in `deployments/.di...
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/scroll.diamond.json:111-111
Timestamp: 2024-11-26T01:03:43.597Z
Learning: When reviewing pull requests, only point out missing contract addresses in `deployments/<network>.diamond.json` if the contract's address is present in `deployments/<network>.json` but missing in `deployments/<network>.diamond.json`. If the contract is not deployed on a network (i.e., not present in `deployments/<network>.json`), then no action is needed.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: duplicate deployment entries for the same contract address in deployment logs are acceptable in this...
Learnt from: ezynda3
PR: lifinance/contracts#827
File: deployments/_deployments_log_file.json:0-0
Timestamp: 2024-11-22T08:50:48.798Z
Learning: Duplicate deployment entries for the same contract address in deployment logs are acceptable in this project.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/safe/safe-utils.ts, 0xdenyo prefers to keep the getcontractnamefromdeploymentlog fu...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/safe-utils.ts:1096-1142
Timestamp: 2025-07-17T04:38:42.425Z
Learning: In script/deploy/safe/safe-utils.ts, 0xDEnYO prefers to keep the getContractNameFromDeploymentLog function without explicit JSON structure validation, prioritizing code simplicity over comprehensive validation for deployment log parsing.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: deployment scripts rely on external automation (pre-script checks) to validate constructor arguments...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1207
File: script/deploy/facets/DeployPioneerFacet.s.sol:17-27
Timestamp: 2025-06-13T08:30:28.665Z
Learning: Deployment scripts rely on external automation (pre-script checks) to validate constructor arguments such as non-zero addresses, so adding explicit `require` guards inside the Foundry deployment scripts is generally unnecessary.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: the lifinance/contracts repository has deployment scripts that perform validation checks (including ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1169
File: script/deploy/zksync/DeployFeeCollector.zksync.s.sol:32-37
Timestamp: 2025-05-27T12:00:43.940Z
Learning: The lifinance/contracts repository has deployment scripts that perform validation checks (including zero-address validation) before executing individual deploy scripts, making runtime validation checks in the deploy scripts themselves redundant.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: in deployment scripts, do not suggest adding error handling to catch and report deployment failures,...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipPeriphery.s.sol:13-20
Timestamp: 2024-09-23T01:42:55.475Z
Learning: In deployment scripts, do not suggest adding error handling to catch and report deployment failures, as errors will be displayed by Foundry in the output.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : update scripts must inherit `up...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to {script/deploy/facets/*.sol,script/deploy/zksync/*.sol} : Update scripts must inherit `UpdateScriptBase` and use `update("{ContractName}")`.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: in `script/deploy/healthcheck.ts`, handling the case when `networkconfig` is undefined is unnecessar...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/healthCheck.ts:387-388
Timestamp: 2024-11-21T08:24:22.802Z
Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imp...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifinance/contracts repository, 0xdenyo prefers not to add private key format validation in d...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/add-owners-to-safe.ts`, runtime validation for network configuration using zo...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:22:38.484Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, runtime validation for network configuration using Zod is not required; type assertions are acceptable.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `fundnewwalletonallchains.ts` script, the gas estimation code involving `publicclient.estimat...
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:156-164
Timestamp: 2024-11-04T03:47:47.465Z
Learning: In the `fundNewWalletOnAllChains.ts` script, the gas estimation code involving `publicClient.estimateGas()` is intentionally commented out and should remain that way unless specified otherwise.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifi contracts codebase, constructor arguments in solidity deployment scripts do not need val...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1207
File: script/deploy/zksync/DeployPioneerFacet.zksync.s.sol:29-37
Timestamp: 2025-06-16T09:28:18.027Z
Learning: In the LIFI contracts codebase, constructor arguments in Solidity deployment scripts do not need validation because they are already validated by bash scripts in combination with the deployRequirements.json file. The deployRequirements.json file contains validation rules like "allowToDeployWithZeroAddress": false to prevent invalid constructor arguments during deployment.
Applied to files:
script/deploy/tron/deploy-core-facets.ts
📚 Learning: ensure that scripts used for codebase verification produce valid and accurate results before reporti...
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/polygon.json:0-0
Timestamp: 2024-10-04T09:21:59.708Z
Learning: Ensure that scripts used for codebase verification produce valid and accurate results before reporting issues, especially when checking Ethereum address checksums in `deployments/polygon.json`.
Applied to files:
script/deploy/tron/deploy-core-facets.tsscript/deploy/tron/TronContractDeployer.ts
📚 Learning: when setting up new network deployments, it's expected that contract addresses in the deployment jso...
Learnt from: mirooon
PR: lifinance/contracts#985
File: deployments/bsca.json:0-0
Timestamp: 2025-02-12T09:44:10.963Z
Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `script/deploy/safe/deploy-safe.ts`, 0xdenyo intentionally changed the `allowoverride` flag defau...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1184
File: script/deploy/safe/deploy-safe.ts:0-0
Timestamp: 2025-07-03T07:34:47.349Z
Learning: In `script/deploy/safe/deploy-safe.ts`, 0xDEnYO intentionally changed the `allowOverride` flag default from `false` to `true` to allow overwriting existing Safe addresses by default in deployment workflows.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifinance/contracts repository, 0xdenyo prefers to keep private key processing simple in scri...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:334-334
Timestamp: 2025-07-17T04:21:55.549Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep private key processing simple in scripts like execute-pending-timelock-tx.ts without adding format validation, prioritizing code simplicity over strict validation in controlled environments.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the script `script/deploy/safe/add-owners-to-safe.ts`, additional defensive checks for network co...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:48-48
Timestamp: 2024-11-21T08:23:50.099Z
Learning: In the script `script/deploy/safe/add-owners-to-safe.ts`, additional defensive checks for network configuration may be unnecessary because the script will fail anyway when the network configuration is missing.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: when `libasset.maxapproveerc20` is used with `type(uint256).max`, the team acknowledges and accepts ...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Periphery/GasZipPeriphery.sol:49-53
Timestamp: 2024-09-23T02:04:16.323Z
Learning: When `LibAsset.maxApproveERC20` is used with `type(uint256).max`, the team acknowledges and accepts the associated security risks. In future reviews, avoid flagging this as a concern.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `withdrawableperiphery.sol` contract, when transferring ether in the `withdrawtoken` function...
Learnt from: 0xDEnYO
PR: lifinance/contracts#831
File: src/Helpers/WithdrawablePeriphery.sol:26-30
Timestamp: 2024-10-14T08:23:38.076Z
Learning: In the `WithdrawablePeriphery.sol` contract, when transferring Ether in the `withdrawToken` function, prefer using `SafeTransferLib.safeTransferETH` instead of low-level `call` for safer Ether transfers.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in `gaszipperiphery.sol`, `libutil` and `validatable` are used, so ensure not to suggest their remov...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: src/Periphery/GasZipPeriphery.sol:4-14
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In `GasZipPeriphery.sol`, `LibUtil` and `Validatable` are used, so ensure not to suggest their removal in future reviews.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the lifi codebase, basic error details in console.error are sufficient for transaction failures, ...
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptHelpers.ts:618-654
Timestamp: 2025-01-28T11:59:27.898Z
Learning: In the LiFi codebase, basic error details in console.error are sufficient for transaction failures, without the need for gas estimation or detailed error object destructuring.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the typescript file `script/utils/fetch-missing-deployments.ts`, the existing regex pattern `/\/\...
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:0-0
Timestamp: 2024-12-04T12:57:56.493Z
Learning: In the TypeScript file `script/utils/fetch-missing-deployments.ts`, the existing regex pattern `/\/\/\/\s*@custom:version\s*([\d.]+)/` used for version extraction is sufficient and does not require modification.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `script/tasks/fundnewwalletonallchains.ts` file, adding a timeout to the transaction confirma...
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:179-187
Timestamp: 2024-11-04T03:50:06.443Z
Learning: In the `script/tasks/fundNewWalletOnAllChains.ts` file, adding a timeout to the transaction confirmation wait using `publicClient.waitForTransactionReceipt` is not required.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in config/networks.json for the ronin network (chainid 2020), there is a problematic mismatch betwee...
Learnt from: mirooon
PR: lifinance/contracts#1283
File: config/networks.json:837-839
Timestamp: 2025-07-17T11:31:50.058Z
Learning: In config/networks.json for the Ronin network (chainId 2020), there is a problematic mismatch between verificationType ("blockscout") and explorerApiUrl ("https://sourcify.roninchain.com/server"). This inconsistency can lead to verification issues and should be flagged when networks.json is modified in future PRs.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to test/solidity/**/*.t.sol : all tests that verify a successful execution must be prefixed ...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to test/solidity/**/*.t.sol : All tests that verify a successful execution must be prefixed with: `test_`.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : use `consola` for consistent logging across typescript scripts....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use `consola` for consistent logging across TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : include proper logging for debugging and monitoring in typescript script...
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Include proper logging for debugging and monitoring in TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in nod...
Learnt from: ezynda3
PR: lifinance/contracts#875
File: script/utils/fetch-missing-deployments.ts:46-46
Timestamp: 2024-12-02T08:19:07.783Z
Learning: In our codebase, scripts like `script/utils/fetch-missing-deployments.ts` are intended to run in Node.js version 18 or newer, so global `fetch` is available without importing.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/healthcheck.ts, synchronous operations like execsync are acceptable and preferred o...
Learnt from: mirooon
PR: lifinance/contracts#1292
File: script/deploy/healthCheck.ts:140-143
Timestamp: 2025-07-24T08:38:32.976Z
Learning: In script/deploy/healthCheck.ts, synchronous operations like execSync are acceptable and preferred over async alternatives, as confirmed by maintainer mirooon. This is an exception to the general coding guideline requiring async/await for TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : all scripts must use `citty` for cli argument parsing....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : All scripts must use `citty` for CLI argument parsing.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in script/deploy/update-deployment-logs.ts, the user prefers to keep the isvalidjsonstructure method...
Learnt from: ezynda3
PR: lifinance/contracts#1230
File: script/deploy/update-deployment-logs.ts:205-211
Timestamp: 2025-06-24T07:10:15.839Z
Learning: In script/deploy/update-deployment-logs.ts, the user prefers to keep the isValidJsonStructure method simple with minimal validation rather than implementing comprehensive nested structure validation, as they consider thorough upfront validation to be overkill for their deployment logging needs.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: for staging files in deployments, avoid making comments regarding incomplete contract deployments or...
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: deployments/bsc.staging.json:28-28
Timestamp: 2024-09-23T02:08:02.297Z
Learning: For staging files in deployments, avoid making comments regarding incomplete contract deployments or missing bytecode, as these comments are not necessary.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: applies to script/**/*.ts : handle errors appropriately with try/catch blocks in typescript scripts....
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Handle errors appropriately with try/catch blocks in TypeScript scripts.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: in the `script/deploy/safe/add-owners-to-safe.ts` script, explicit error handling for missing networ...
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:48-48
Timestamp: 2024-11-21T08:23:39.984Z
Learning: In the `script/deploy/safe/add-owners-to-safe.ts` script, explicit error handling for missing network configuration is not required because the script will fail anyway if the network is not configured.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
📚 Learning: always consult the conventions.md file for the latest rules and conventions when reviewing prs or co...
Learnt from: 0xDEnYO
PR: lifinance/contracts#1237
File: conventions.md:56-60
Timestamp: 2025-07-03T01:44:43.968Z
Learning: Always consult the conventions.md file for the latest rules and conventions when reviewing PRs or code changes in the lifinance/contracts repository. Make suggestions when code changes do not match the documented conventions in this file.
Applied to files:
script/deploy/tron/TronContractDeployer.ts
🔇 Additional comments (6)
script/deploy/tron/register-facets-to-diamond.ts (1)
372-389: Add error handling for file operations.File read operations should have proper error handling with descriptive error messages.
- const deploymentPath = path.join(process.cwd(), 'deployments', 'tron.json') - - if (!fs.existsSync(deploymentPath)) - throw new Error( - 'deployments/tron.json not found. Please deploy contracts first.' - ) - - const deployments = JSON.parse(fs.readFileSync(deploymentPath, 'utf8')) + const deploymentPath = path.join(process.cwd(), 'deployments', 'tron.json') + + let deployments: Record<string, string> + try { + if (!fs.existsSync(deploymentPath)) { + throw new Error('File not found') + } + const content = fs.readFileSync(deploymentPath, 'utf8') + deployments = JSON.parse(content) + } catch (error: any) { + throw new Error( + `Failed to load deployments/tron.json: ${error.message}. Please deploy contracts first.` + ) + }⛔ Skipped due to learnings
Learnt from: 0xDEnYO PR: lifinance/contracts#807 File: script/deploy/facets/DeployGasZipFacet.s.sol:22-35 Timestamp: 2024-09-23T01:42:03.075Z Learning: In deployment scripts like `DeployGasZipFacet.s.sol`, do not report issues suggesting adding error handling for missing configuration files or unexpected JSON structures, as the script will fail if the file is missing.Learnt from: 0xDEnYO PR: lifinance/contracts#1109 File: deployments/worldchain.json:28-28 Timestamp: 2025-04-21T03:17:53.443Z Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.Learnt from: ezynda3 PR: lifinance/contracts#953 File: script/deploy/zksync/utils/UpdateScriptBase.sol:32-50 Timestamp: 2025-03-05T14:41:05.791Z Learning: In the LiFi contracts repository, explicit error handling for file operations and address validation in deployment scripts like UpdateScriptBase.sol is not considered necessary by the maintainer.Learnt from: 0xDEnYO PR: lifinance/contracts#1266 File: script/deploy/safe/safe-utils.ts:1096-1142 Timestamp: 2025-07-17T04:38:42.425Z Learning: In script/deploy/safe/safe-utils.ts, 0xDEnYO prefers to keep the getContractNameFromDeploymentLog function without explicit JSON structure validation, prioritizing code simplicity over comprehensive validation for deployment log parsing.Learnt from: 0xDEnYO PR: lifinance/contracts#1109 File: deployments/worldchain.diamond.json:84-85 Timestamp: 2025-04-21T03:15:12.236Z Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.Learnt from: 0xDEnYO PR: lifinance/contracts#1266 File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129 Timestamp: 2025-07-17T04:21:50.790Z Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.Learnt from: 0xDEnYO PR: lifinance/contracts#1109 File: deployments/worldchain.json:28-28 Timestamp: 2025-04-21T03:17:53.443Z Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.Learnt from: 0xDEnYO PR: lifinance/contracts#782 File: script/deploy/zksync/DeployPermit2Proxy.s.sol:22-61 Timestamp: 2024-11-25T13:49:40.464Z Learning: In the deploy scripts (e.g., `script/deploy/zksync/DeployPermit2Proxy.s.sol`), complex error handling and address validation are not necessary. The team prefers to keep deploy scripts simple without extensive error handling.Learnt from: 0xDEnYO PR: lifinance/contracts#1256 File: deployments/zksync.diamond.json:81-87 Timestamp: 2025-07-04T08:59:08.108Z Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.Learnt from: 0xDEnYO PR: lifinance/contracts#782 File: deployments/scroll.diamond.json:111-111 Timestamp: 2024-11-26T01:03:43.597Z Learning: When reviewing pull requests, only point out missing contract addresses in `deployments/<network>.diamond.json` if the contract's address is present in `deployments/<network>.json` but missing in `deployments/<network>.diamond.json`. If the contract is not deployed on a network (i.e., not present in `deployments/<network>.json`), then no action is needed.Learnt from: mirooon PR: lifinance/contracts#985 File: deployments/bsca.json:0-0 Timestamp: 2025-02-12T09:44:10.963Z Learning: When setting up new network deployments, it's expected that contract addresses in the deployment JSON files (e.g., bsca.json, bscb.json) may not have deployed code initially, as these files serve as target configurations for future deployments.Learnt from: ezynda3 PR: lifinance/contracts#861 File: script/deploy/safe/add-owners-to-safe.ts:8-13 Timestamp: 2024-11-21T08:24:05.881Z Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.Learnt from: ezynda3 PR: lifinance/contracts#861 File: script/deploy/safe/add-owners-to-safe.ts:48-48 Timestamp: 2024-11-21T08:23:39.984Z Learning: In the `script/deploy/safe/add-owners-to-safe.ts` script, explicit error handling for missing network configuration is not required because the script will fail anyway if the network is not configured.Learnt from: 0xDEnYO PR: lifinance/contracts#1207 File: script/deploy/facets/DeployPioneerFacet.s.sol:17-27 Timestamp: 2025-06-13T08:30:28.665Z Learning: Deployment scripts rely on external automation (pre-script checks) to validate constructor arguments such as non-zero addresses, so adding explicit `require` guards inside the Foundry deployment scripts is generally unnecessary.Learnt from: 0xDEnYO PR: lifinance/contracts#988 File: script/deploy/facets/DeployPermit2Proxy.s.sol:33-37 Timestamp: 2025-02-11T10:33:52.791Z Learning: The Permit2Proxy contract must not be deployed with zero addresses for its critical dependencies (LiFiDiamond, permit2Address, safeAddress). This is enforced by passing `false` to `_getConfigContractAddress` function.Learnt from: ezynda3 PR: lifinance/contracts#861 File: script/deploy/healthCheck.ts:387-388 Timestamp: 2024-11-21T08:24:22.802Z Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.Learnt from: ezynda3 PR: lifinance/contracts#861 File: script/deploy/safe/add-owners-to-safe.ts:8-13 Timestamp: 2024-11-21T08:22:38.484Z Learning: In `script/deploy/safe/add-owners-to-safe.ts`, runtime validation for network configuration using Zod is not required; type assertions are acceptable.script/deploy/tron/TronContractDeployer.ts (5)
1-22: LGTM! Imports and class structure follow coding guidelines.The file correctly imports
consolafor logging and uses proper TypeScript typing. The class structure is well-organized with appropriate access modifiers.
50-95: LGTM! Main deployment method follows coding guidelines well.The method properly uses async/await, includes comprehensive error handling with try-catch blocks, uses consola for logging, and follows a logical deployment workflow.
100-292: LGTM! Cost estimation methods are well-implemented.The cost estimation methods properly:
- Use consola for consistent logging throughout
- Include comprehensive error handling with try-catch blocks
- Implement detailed energy estimation using Tron's API
- Provide thorough verbose logging for debugging and monitoring
The implementation follows coding guidelines and provides accurate cost estimates for deployment.
297-367: LGTM! Validation and execution methods follow coding guidelines.The methods properly:
- Use consola for consistent logging
- Include comprehensive error handling with try-catch blocks
- Validate account balance before deployment
- Handle deployment execution with proper transaction management
The transaction ID extraction logic handles multiple possible response formats from the Tron network appropriately.
372-509: LGTM! Utility methods are well-implemented and follow guidelines.The utility methods properly:
- Use consola for consistent logging across all methods
- Include comprehensive error handling and retry logic
- Provide essential functionality like dry-run simulation and transaction confirmation
- Use async/await appropriately for asynchronous operations
- Include proper timeout and retry mechanisms
The implementation provides a robust foundation for contract deployment operations.
…amond script Replace manual process.argv parsing with citty's defineCommand and runMain - Add citty imports (defineCommand, runMain) - Define command with boolean arguments dryRun and split - Move existing logic to async run function - Use args.dryRun and args.split instead of manual parsing - Replace direct execution with runMain(main) call 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <noreply@opencode.ai>
…oyment scripts 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode <noreply@opencode.ai>
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 (12)
script/deploy/tron/utils.ts (12)
168-185: Confirm helperFunctions.sh invocation style; switch back to sourcing if functions aren’t exported as CLIs.Current command assumes
script/helperFunctions.shis an executable with alogDeploymentsubcommand. Historically, these are shell functions that must be sourced, then invoked (e.g.,logContractDeploymentInfo). If not an exported CLI, this will no-op or fail.Proposed change (keeps your argument escaping and avoids injection):
- const logCommand = [ - 'script/helperFunctions.sh', - 'logDeployment', - escapeShellArg(contract), - escapeShellArg(network), - escapeShellArg(timestamp), - escapeShellArg(version), - '"200"', - escapeShellArg(constructorArgs), - escapeShellArg(environmentString), - escapeShellArg(address), - escapeShellArg(String(verified)), - escapeShellArg(''), - escapeShellArg('0.8.17'), - escapeShellArg('cancun'), // Using EVM version from foundry.toml, though Tron actually uses TVM - escapeShellArg(''), - ].join(' ') + const args = [ + escapeShellArg(contract), + escapeShellArg(network), + escapeShellArg(timestamp), + escapeShellArg(version), + '"200"', + escapeShellArg(constructorArgs), + escapeShellArg(environmentString), + escapeShellArg(address), + escapeShellArg(String(verified)), + "''", + '"0.8.17"', + escapeShellArg('cancun'), // foundry.toml EVM config + "''" + ].join(' ') + + const logCommand = `source script/config.sh && source script/helperFunctions.sh && logContractDeploymentInfo ${args}`If
helperFunctions.shtruly exposes a CLI, ignore this refactor—please just confirm the subcommand name and semantics.
12-18: Deduplicate protocol constants; import from ./constants instead of redefining.
DATA_HEX_PROTOBUF_EXTRA,MAX_RESULT_SIZE_IN_TX, andA_SIGNATUREare defined in./constantsbut re-declared locally incalculateTransactionBandwidth. Centralize to prevent drift.Apply:
@@ DIAMOND_CUT_ENERGY_MULTIPLIER, ZERO_ADDRESS, MIN_BALANCE_REGISTRATION, DEFAULT_FEE_LIMIT_TRX, MIN_BALANCE_WARNING, + DATA_HEX_PROTOBUF_EXTRA, + MAX_RESULT_SIZE_IN_TX, + A_SIGNATURE, } from './constants'-export function calculateTransactionBandwidth(transaction: any): number { - const DATA_HEX_PROTOBUF_EXTRA = 3 - const MAX_RESULT_SIZE_IN_TX = 64 - const A_SIGNATURE = 67 +export function calculateTransactionBandwidth(transaction: any): number {Also applies to: 316-331
245-273: Use the provided diamond address or drop the param.
_diamondAddressis unused. Either remove it or persist it in the JSON for traceability.Apply:
export async function saveDiamondDeployment( network: SupportedChain, _diamondAddress: string, facets: Record<string, { address: string; version: string }> ): Promise<void> { @@ const diamondData = { LiFiDiamond: { + address: _diamondAddress, Facets: {} as Record<string, { Name: string; Version: string }>, Periphery: {} as Record<string, string>, }, }
380-392: Add braces to nested conditional for clarity and maintenance safety.The double-nested
ifwithout braces is error-prone and harder to follow.Apply:
- for (const address in facets) - if (facets[address].Name === facetName) - if (address === facetAddress) { + for (const address in facets) { + if (facets[address].Name === facetName) { + if (address === facetAddress) { consola.info(`${facetName} already exists in ${network}.diamond.json`) return - } else { + } else { // Same facet name but different address - update it consola.info( `Updating ${facetName} address in ${network}.diamond.json` ) delete facets[address] break - } + } + } + }
479-482: Fix hard-coded filename in log message (use dynamic network).Message says
tron.diamond.jsoneven whennetwork !== 'tron'.Apply:
- consola.info(`${entry.name} already exists in tron.diamond.json`) + consola.info(`${entry.name} already exists in ${network}.diamond.json`)
788-803: Avoid non-ABI “fallback” encoding for constructor args.The fallback concatenates UTF‑8/hex, which is not ABI-compliant and can confuse logs. Prefer returning
0xand logging the issue.Apply:
- } catch (error) { - consola.warn('Failed to encode constructor args, using fallback:', error) - // Fallback to simple hex encoding - return ( - '0x' + - args - .map((arg) => { - if (typeof arg === 'string' && arg.startsWith('0x')) - return arg.slice(2) - - return Buffer.from(String(arg)).toString('hex') - }) - .join('') - ) - } + } catch (error) { + consola.warn( + 'Failed to ABI-encode constructor args — logging empty args instead.', + error + ) + return '0x' + }Optional: accept a pre-initialized
tronWeb(orutils) parameter to avoid constructing a new instance here.
113-126: Include stderr in shell error messages for faster debugging.Currently, failures lose stderr details.
Apply:
export async function executeShellCommand(command: string): Promise<string> { const proc = Bun.spawn(['bash', '-c', command], { cwd: process.cwd(), env: process.env, }) - const output = await new Response(proc.stdout).text() - const exitCode = await proc.exited + const [stdout, stderr, exitCode] = await Promise.all([ + new Response(proc.stdout).text(), + new Response(proc.stderr).text(), + proc.exited, + ]) - if (exitCode !== 0) - throw new Error(`Command failed with exit code ${exitCode}: ${command}`) + if (exitCode !== 0) + throw new Error( + `Command failed with exit code ${exitCode}: ${command}\n${stderr.trim()}` + ) - return output.trim() + return stdout.trim() }
278-284: Narrow parameter type to SupportedChain.Function only makes sense for known networks; using the shared
SupportedChainimproves type-safety.Apply:
-export function getNetworkConfig(networkName: string): any { +export function getNetworkConfig(networkName: SupportedChain): any {
1075-1085: Ensure numeric comparison for balance check.
tronWeb.fromSunmay return a string; coerce to number before comparisons.Apply:
- const balanceTrx = tronWeb.fromSun(balance) + const balanceTrx = Number(tronWeb.fromSun(balance))
973-991: Normalize transaction ID logging/return value.
diamond.diamondCut(...).send()can return an object; logging it directly is noisy. ExtracttxIDif present.Apply:
- consola.success(`Registration transaction successful: ${tx}`) + const txId = typeof tx === 'string' ? tx : (tx?.txID ?? String(tx)) + consola.success(`Registration transaction successful: ${txId}`) @@ - return { success: true, transactionId: tx } + return { success: true, transactionId: txId }
94-101: Return an explicit boolean.Make the intent clear and avoid leaking non-boolean values.
Apply:
- const contractInfo = await tronWeb.trx.getContract(tronAddress) - return contractInfo && contractInfo.contract_address + const contractInfo = await tronWeb.trx.getContract(tronAddress) + return Boolean(contractInfo?.contract_address)
1364-1374: Tighten base58 address regex and add braces around push.Base58 excludes ambiguous chars; current
[A-Za-z0-9]is too permissive. Also, add braces for clarity.Apply:
- const facetRegex = /\[([T][A-Za-z0-9]{33})\s+\[((?:0x[a-fA-F0-9]+\s*)*)\]\]/g + // Base58: 1-9A-HJ-NP-Za-km-z (Tron addresses start with T and are 34 chars) + const facetRegex = /\[(T[1-9A-HJ-NP-Za-km-z]{33})\s+\[((?:0x[a-fA-F0-9]+\s*)*)\]\]/g @@ - if (address) - facets.push([address, selectors]) - + if (address) { + facets.push([address, selectors]) + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
script/deploy/healthCheck.ts(8 hunks)script/deploy/tron/utils.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- script/deploy/healthCheck.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit Inference Engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/utils.ts
🧠 Learnings (40)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use `consola` for consistent logging across TypeScript scripts.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage. Both libraries provide named exports, not default exports.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Include proper logging for debugging and monitoring in TypeScript scripts.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-24T08:38:32.976Z
Learnt from: mirooon
PR: lifinance/contracts#1292
File: script/deploy/healthCheck.ts:140-143
Timestamp: 2025-07-24T08:38:32.976Z
Learning: In script/deploy/healthCheck.ts, synchronous operations like execSync are acceptable and preferred over async alternatives, as confirmed by maintainer mirooon. This is an exception to the general coding guideline requiring async/await for TypeScript scripts.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Environment variables should be validated using `getEnvVar()` helper in TypeScript scripts.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-17T04:21:50.790Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-17T04:21:55.549Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:334-334
Timestamp: 2025-07-17T04:21:55.549Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers to keep private key processing simple in scripts like execute-pending-timelock-tx.ts without adding format validation, prioritizing code simplicity over strict validation in controlled environments.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:10:12.922Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-06-06T16:09:58.692Z
Learnt from: mirooon
PR: lifinance/contracts#1193
File: script/tasks/diamondSyncWhitelistedAddresses.sh:128-128
Timestamp: 2025-06-06T16:09:58.692Z
Learning: In script/tasks/diamondSyncWhitelistedAddresses.sh at line 128, there is an unquoted command substitution `$(getPrivateKey "$NETWORK" "$ENVIRONMENT")` that should be quoted as `"$(getPrivateKey "$NETWORK" "$ENVIRONMENT")"` to prevent word splitting issues. The user mirooon wants to be reminded about this issue in future PRs when this file is touched.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-17T04:38:42.425Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/safe-utils.ts:1096-1142
Timestamp: 2025-07-17T04:38:42.425Z
Learning: In script/deploy/safe/safe-utils.ts, 0xDEnYO prefers to keep the getContractNameFromDeploymentLog function without explicit JSON structure validation, prioritizing code simplicity over comprehensive validation for deployment log parsing.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-26T01:03:43.597Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/scroll.diamond.json:111-111
Timestamp: 2024-11-26T01:03:43.597Z
Learning: When reviewing pull requests, only point out missing contract addresses in `deployments/<network>.diamond.json` if the contract's address is present in `deployments/<network>.json` but missing in `deployments/<network>.diamond.json`. If the contract is not deployed on a network (i.e., not present in `deployments/<network>.json`), then no action is needed.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `deployments/*.diamond.json` and `deployments/*.json` files, the `LiFiDEXAggregator` contract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-04-21T03:15:12.236Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: ezynda3
PR: lifinance/contracts#806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-01-28T14:29:00.823Z
Learnt from: ezynda3
PR: lifinance/contracts#924
File: script/deploy/zksync/utils/UpdateScriptBase.sol:112-178
Timestamp: 2025-01-28T14:29:00.823Z
Learning: The suggestion to modify `buildDiamondCut` function in `UpdateScriptBase.sol` to handle selectors from multiple old facets differently was deemed unnecessary by the maintainer.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-25T09:05:43.045Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-21T08:24:22.802Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/healthCheck.ts:387-388
Timestamp: 2024-11-21T08:24:22.802Z
Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-09-23T01:42:03.075Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#807
File: script/deploy/facets/DeployGasZipFacet.s.sol:22-35
Timestamp: 2024-09-23T01:42:03.075Z
Learning: In deployment scripts like `DeployGasZipFacet.s.sol`, do not report issues suggesting adding error handling for missing configuration files or unexpected JSON structures, as the script will fail if the file is missing.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-04T08:59:08.108Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-05-27T12:36:26.987Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-08T03:42:16.803Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#853
File: .github/workflows/protectSecurityRelevantCode.yml:78-78
Timestamp: 2024-11-08T03:42:16.803Z
Learning: In the `.github/workflows/protectSecurityRelevantCode.yml` file, ensure that any suggested code changes are secure, thoroughly vetted for potential issues, and do not prompt further modifications to previously recommended code.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-06-24T07:35:58.970Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1232
File: script/deploy/_targetState.json:1680-1703
Timestamp: 2025-06-24T07:35:58.970Z
Learning: The user (0xDEnYO) has instructed to never review the target state file (script/deploy/_targetState.json). This file should be excluded from code review analysis.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, understand that _targetState.json tracks contract version numbers (not addresses) and _deployments_log_file.json contains deployment records with addresses that may not be organized in obvious network sections. Always verify the actual file structure before flagging missing entries.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/polygon.json:0-0
Timestamp: 2024-10-09T03:47:21.269Z
Learning: Ensure that scripts used for codebase verification produce valid and accurate results before reporting issues, especially when checking Ethereum address checksums in `deployments/polygon.json`.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: Consola v3.x uses named exports, so `import { consola } from 'consola'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: TronWeb v6.x and later uses named exports, so `import { TronWeb } from 'tronweb'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:02.412Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:636-642
Timestamp: 2025-08-19T05:07:02.412Z
Learning: Consola (npm package) includes a `consola.prompt()` method that supports interactive prompts with options like `type: 'confirm'`, `initial: boolean`, etc. This is a legitimate part of the Consola API, not an invalid usage.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-04T03:47:47.465Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:156-164
Timestamp: 2024-11-04T03:47:47.465Z
Learning: In the `fundNewWalletOnAllChains.ts` script, the gas estimation code involving `publicClient.estimateGas()` is intentionally commented out and should remain that way unless specified otherwise.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2024-11-05T17:15:33.833Z
Learnt from: maxklenk
PR: lifinance/contracts#782
File: script/demoScripts/demoPermit2.ts:100-107
Timestamp: 2024-11-05T17:15:33.833Z
Learning: In demo scripts using testing wallets, passing private keys via command-line arguments is acceptable.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:08:03.344Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:1077-1085
Timestamp: 2025-08-19T05:08:03.344Z
Learning: The consola library v3.x provides a prompt method (consola.prompt) that can be used for interactive CLI prompts in Node.js/Bun applications. This method supports various prompt types including "confirm", "text", "select", and "multiselect". It's already being used successfully throughout the lifinance/contracts repository's deployment scripts.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:07:02.412Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:636-642
Timestamp: 2025-08-19T05:07:02.412Z
Learning: Consola (npm package) includes a `consola.prompt()` method that supports interactive prompts with options like `type: 'confirm'`, `initial: boolean`, etc. This is a legitimate part of the Consola API since version 3.x, powered by the clack library under the hood.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-19T05:08:03.344Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:1077-1085
Timestamp: 2025-08-19T05:08:03.344Z
Learning: The consola library provides a prompt method (consola.prompt) that can be used for interactive CLI prompts in Node.js/Bun applications. This method is available by default and does not require additional setup.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-03T07:34:47.349Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1184
File: script/deploy/safe/deploy-safe.ts:0-0
Timestamp: 2025-07-03T07:34:47.349Z
Learning: In `script/deploy/safe/deploy-safe.ts`, 0xDEnYO intentionally changed the `allowOverride` flag default from `false` to `true` to allow overwriting existing Safe addresses by default in deployment workflows.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-07-03T10:19:21.132Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1140
File: deployments/worldchain.json:28-29
Timestamp: 2025-07-03T10:19:21.132Z
Learning: When reviewing deployment PRs, always perform comprehensive searches for addresses in deployment log files before reporting them as missing. Use multiple search strategies including direct address searches and context-aware searches to avoid false positives about missing entries. Double-check the actual presence of addresses in the deployment logs before flagging inconsistencies.
Applied to files:
script/deploy/tron/utils.ts
📚 Learning: 2025-08-01T05:35:21.121Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1290
File: script/deploy/_targetState.json:20-31
Timestamp: 2025-08-01T05:35:21.121Z
Learning: 0xDEnYO has confirmed that the target state file (script/deploy/_targetState.json) is not important for verification and should not be reviewed in deployment PRs.
Applied to files:
script/deploy/tron/utils.ts
🧬 Code Graph Analysis (1)
script/deploy/tron/utils.ts (4)
script/deploy/tron/types.ts (4)
IForgeArtifact(40-64)IDeploymentResult(66-73)IDiamondRegistrationResult(93-97)INetworkInfo(81-86)script/demoScripts/utils/demoScriptHelpers.ts (1)
getPrivateKeyForEnvironment(896-902)script/common/types.ts (1)
SupportedChain(3-3)script/deploy/tron/constants.ts (8)
DATA_HEX_PROTOBUF_EXTRA(32-32)MAX_RESULT_SIZE_IN_TX(35-35)A_SIGNATURE(38-38)ZERO_ADDRESS(45-45)DIAMOND_CUT_ENERGY_MULTIPLIER(6-6)MIN_BALANCE_REGISTRATION(18-18)DEFAULT_FEE_LIMIT_TRX(10-10)MIN_BALANCE_WARNING(14-14)
🔇 Additional comments (2)
script/deploy/tron/utils.ts (2)
196-203: No double-dot bug—file paths are formatted correctly
The templates${network}.${fileSuffix}jsonand${network}.diamond.${fileSuffix}jsonproduce:
Production (fileSuffix =
''):
deployments/tron.jsondeployments/tron.diamond.jsonStaging (fileSuffix =
'staging.'):
deployments/tron.staging.jsondeployments/tron.diamond.staging.jsonBecause the dot before
${fileSuffix}is only present once and${fileSuffix}is empty in production, there is no accidental double-dot. Please disregard the suggested refactor.Likely an incorrect or invalid review comment.
1271-1313: Validated: TronWeb Price APIs Are Available in v6.0.3We’ve confirmed via the official TronWeb v6.0.3 documentation that both
tronWeb.trx.getEnergyPrices()andtronWeb.trx.getBandwidthPrices()are present and supported APIs:
getEnergyPrices()returns a comma-delimited history of energy prices in SUN (tronweb.network)getBandwidthPrices()likewise returns bandwidth price history (tronweb.network)Because these methods are guaranteed in v6.x, and your existing
try/catchwill catch any unexpected runtime errors and fall back to cache defaults, no additional runtime‐existence checks are strictly necessary. If you do need to support pre-6.0 versions of TronWeb, you can add an optional guard as originally outlined; otherwise, you can safely resolve this suggestion.
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: 4
♻️ Duplicate comments (5)
script/troncast/utils/tronweb.ts (1)
65-83: Wait for a terminal receipt state (SUCCESS/FAILED), not just presenceThe loop returns on any receipt with an id, which can be non-final. Check receipt.receipt.result and throw on FAILED to avoid false positives.
Apply this diff:
while (Date.now() - startTime < timeout) { try { const receipt = await tronWeb.trx.getTransactionInfo(txId) - if (receipt && receipt.id) return receipt + if (receipt?.id) { + const result = receipt?.receipt?.result + if (result === 'SUCCESS') return receipt + if (result === 'FAILED') + throw new Error( + `Transaction ${txId} failed: ${receipt.resMessage || 'Unknown error'}` + ) + // Otherwise keep polling + } } catch (error) { // Transaction not yet confirmed } await new Promise((resolve) => setTimeout(resolve, 2000)) }script/deploy/tron/deploy-and-register-periphery.ts (2)
109-117: Fix “rpcUrl” field: you’re logging the network key, not the endpointrpcUrl should print the actual RPC endpoint, not the string "tron"/"tronshasta".
Apply this diff:
- consola.info('Network Info:', { - network: network.includes('shasta') ? 'Shasta Testnet' : 'Mainnet', - rpcUrl: network, + consola.info('Network Info:', { + network: network.includes('shasta') ? 'Shasta Testnet' : 'Mainnet', + rpcUrl, environment: environment === EnvironmentEnum.production ? 'PRODUCTION' : 'STAGING', address: networkInfo.address, balance: `${networkInfo.balance} TRX`, block: networkInfo.block, })
789-797: TronWeb expects base58 or 41-hex addresses; convert before contract() and sendsPassing 0x-prefixed hex can fail. Normalize both the diamond and periphery addresses to base58.
Apply this diff:
- const diamond = tronWeb.contract( - peripheryRegistryArtifact.abi, - diamondAddress - ) + // Normalize diamond address to base58 + const diamondBase58 = diamondAddress.startsWith('T') + ? diamondAddress + : tronWeb.address.fromHex(diamondAddress.replace(/^0x/, '41')) + const diamond = tronWeb.contract( + peripheryRegistryArtifact.abi, + diamondBase58 + ) @@ - const tx = await diamond - .registerPeripheryContract(name, address) + // Normalize periphery address to base58 + const addrToSend = address.startsWith('T') + ? address + : tronWeb.address.fromHex(address.replace(/^0x/, '41')) + const tx = await diamond + .registerPeripheryContract(name, addrToSend) .send({ feeLimit: 1_000_000_000, // 1000 TRX shouldPollResponse: true, })Also applies to: 839-845
script/deploy/tron/deploy-and-register-allbridge-facet.ts (2)
103-105: displayNetworkInfo: pass rpcUrl, not the network keydisplayNetworkInfo’s 3rd param is the RPC URL; passing "tron"/"tronshasta" breaks the label and printed endpoint.
Apply this diff:
- displayNetworkInfo(networkInfo, environment, network) + displayNetworkInfo(networkInfo, environment, rpcUrl)
188-191: Use resolved network for LiFiDiamond lookup (don’t hardcode 'tron')Hardcoding breaks staging/testnet. Use the network variable to read the correct deployments file.
Apply this diff:
- const diamondAddress = await getContractAddress('tron', 'LiFiDiamond') + const diamondAddress = await getContractAddress(network, 'LiFiDiamond')
🧹 Nitpick comments (3)
script/troncast/utils/tronweb.ts (1)
55-63: parseValue: be case-insensitive and guard NaNCurrent parsing is case-sensitive and will return "NaN" strings on malformed input. Normalize and validate input to avoid surprising results.
Apply this diff:
export function parseValue(value: string): string { - // Handle formats like "0.1tron", "100sun", "1000000" - if (value.endsWith('tron')) { - const amount = parseFloat(value.replace('tron', '')) - return (amount * 1_000_000).toString() // Convert to SUN - } else if (value.endsWith('sun')) return value.replace('sun', '') + // Handle formats like "0.1tron", "100sun", "1000000" (case-insensitive) + const v = value.trim().toLowerCase() + if (v.endsWith('tron')) { + const num = parseFloat(v.replace('tron', '')) + if (!Number.isFinite(num)) throw new Error(`Invalid TRON amount: ${value}`) + return Math.round(num * 1_000_000).toString() // Convert to SUN + } else if (v.endsWith('sun')) { + const sun = v.replace('sun', '') + if (!/^\d+$/.test(sun)) throw new Error(`Invalid SUN amount: ${value}`) + return sun + } return value // Assume it's already in SUN }script/deploy/tron/deploy-and-register-periphery.ts (1)
799-806: Add braces for for/if/else blocks (readability, lint compliance)Multiple single-line control structures reduce clarity and can trip eslint rules. Wrap them with braces.
Apply these diffs:
- for (const [name, address] of Object.entries(deployedContracts)) - if (address && address !== 'FAILED') + for (const [name, address] of Object.entries(deployedContracts)) { + if (address && address !== 'FAILED') { try { @@ - } catch (error: any) { - consola.error(` Failed to register ${name}:`, error.message) - } + } catch (error: any) { + consola.error(` Failed to register ${name}:`, error.message) + } + } + }- for (const name of PERIPHERY_CONTRACTS) - try { + for (const name of PERIPHERY_CONTRACTS) { + try { @@ - } else consola.warn(` ${name}: Not registered`) + } else { + consola.warn(` ${name}: Not registered`) + } } catch (error: any) { consola.error(` Failed to verify ${name}:`, error.message) } + }Also applies to: 861-885
script/deploy/tron/deploy-and-register-allbridge-facet.ts (1)
155-167: Minor: add braces to the else branch for consistencySmall readability nit. Keeps style consistent across the script.
Apply this diff:
- } else - try { + } else { + try { @@ - } catch (error: any) { + } catch (error: any) { consola.error('Failed to deploy AllBridgeFacet:', error.message) @@ - } + } + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (9)
config/networks.json(1 hunks)script/deploy/_targetState.json(1 hunks)script/deploy/healthCheck.ts(8 hunks)script/deploy/tron/deploy-and-register-allbridge-facet.ts(1 hunks)script/deploy/tron/deploy-and-register-periphery.ts(1 hunks)script/deploy/tron/deploy-and-register-symbiosis-facet.ts(1 hunks)script/deploy/tron/deploy-core-facets.ts(1 hunks)script/deploy/tron/register-facets-to-diamond.ts(1 hunks)script/troncast/utils/tronweb.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- script/deploy/tron/deploy-and-register-symbiosis-facet.ts
- script/deploy/_targetState.json
- script/deploy/tron/deploy-core-facets.ts
- script/deploy/tron/register-facets-to-diamond.ts
- script/deploy/healthCheck.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit inference engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/deploy-and-register-periphery.tsscript/troncast/utils/tronweb.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
🧠 Learnings (34)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
📚 Learning: 2025-02-13T03:07:05.721Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#994
File: script/config.example.sh:107-108
Timestamp: 2025-02-13T03:07:05.721Z
Learning: The DEPLOY_NEW_NETWORK_MODE flag in deployment scripts is required during initial contract deployment because ownership hasn't been transferred to SAFE yet. This mode allows direct execution of diamondCut and registerPeriphery transactions by the deployer.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Environment variables should be validated using `getEnvVar()` helper in TypeScript scripts.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-08-19T05:10:12.922Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/troncast/utils/tronweb.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use environment variables for configuration in TypeScript scripts.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-07-24T08:38:32.976Z
Learnt from: mirooon
PR: lifinance/contracts#1292
File: script/deploy/healthCheck.ts:140-143
Timestamp: 2025-07-24T08:38:32.976Z
Learning: In script/deploy/healthCheck.ts, synchronous operations like execSync are acceptable and preferred over async alternatives, as confirmed by maintainer mirooon. This is an exception to the general coding guideline requiring async/await for TypeScript scripts.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-07-04T08:59:08.108Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.tsconfig/networks.json
📚 Learning: 2025-04-21T03:15:12.236Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.diamond.json:84-85
Timestamp: 2025-04-21T03:15:12.236Z
Learning: In deployment JSON files that contain "diamond" in their filename (located in the deployments folder), periphery contracts may have empty string values for their addresses. This indicates that the contract is not deployed on that particular chain and should not be flagged as an issue during code reviews.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-08-07T10:20:01.383Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, understand that _targetState.json tracks contract version numbers (not addresses) and _deployments_log_file.json contains deployment records with addresses that may not be organized in obvious network sections. Always verify the actual file structure before flagging missing entries.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2024-11-25T09:05:43.045Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/base.diamond.json:148-148
Timestamp: 2024-11-25T09:05:43.045Z
Learning: In deployment configuration files (e.g., `deployments/base.diamond.json`), empty addresses for contracts like `Permit2Proxy` may be placeholders and will be updated after approvals are released from the multisig safe.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsconfig/networks.json
📚 Learning: 2025-04-22T09:04:44.244Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1112
File: deployments/soneium.diamond.json:81-81
Timestamp: 2025-04-22T09:04:44.244Z
Learning: In the lifinance/contracts repository, it's normal and expected for periphery contracts to have empty address values in deployment files when they are not deployed on a particular network. This applies to all periphery contracts including ReceiverChainflip, ReceiverStargateV2, and others. PRs should not flag empty periphery contract addresses as issues.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsconfig/networks.json
📚 Learning: 2024-10-04T09:21:59.708Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/polygon.json:0-0
Timestamp: 2024-10-04T09:21:59.708Z
Learning: Ensure that scripts used for codebase verification produce valid and accurate results before reporting issues, especially when checking Ethereum address checksums in `deployments/polygon.json`.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/troncast/utils/tronweb.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage. Both libraries provide named exports, not default exports.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/troncast/utils/tronweb.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: Consola v3.x uses named exports, so `import { consola } from 'consola'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use `consola` for consistent logging across TypeScript scripts.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: TronWeb v6.x and later uses named exports, so `import { TronWeb } from 'tronweb'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/troncast/utils/tronweb.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-17T11:31:50.058Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: config/networks.json:837-839
Timestamp: 2025-07-17T11:31:50.058Z
Learning: In config/networks.json for the Ronin network (chainId 2020), there is a problematic mismatch between verificationType ("blockscout") and explorerApiUrl ("https://sourcify.roninchain.com/server"). This inconsistency can lead to verification issues and should be flagged when networks.json is modified in future PRs.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.tsconfig/networks.json
📚 Learning: 2024-11-21T08:24:22.802Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/healthCheck.ts:387-388
Timestamp: 2024-11-21T08:24:22.802Z
Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-21T08:24:05.881Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.
Applied to files:
script/deploy/tron/deploy-and-register-periphery.tsscript/deploy/tron/deploy-and-register-allbridge-facet.tsconfig/networks.json
📚 Learning: 2025-01-24T14:53:20.703Z
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptChainConfig.ts:17-20
Timestamp: 2025-01-24T14:53:20.703Z
Learning: In the LiFi contracts repository, RPC URLs should be strictly sourced from environment variables without fallback to networks.json configuration.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2024-11-04T03:50:06.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:179-187
Timestamp: 2024-11-04T03:50:06.443Z
Learning: In the `script/tasks/fundNewWalletOnAllChains.ts` file, adding a timeout to the transaction confirmation wait using `publicClient.waitForTransactionReceipt` is not required.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `deployments/*.diamond.json` and `deployments/*.json` files, the `LiFiDEXAggregator` contract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: ezynda3
PR: lifinance/contracts#806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-26T01:03:43.597Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/scroll.diamond.json:111-111
Timestamp: 2024-11-26T01:03:43.597Z
Learning: When reviewing pull requests, only point out missing contract addresses in `deployments/<network>.diamond.json` if the contract's address is present in `deployments/<network>.json` but missing in `deployments/<network>.diamond.json`. If the contract is not deployed on a network (i.e., not present in `deployments/<network>.json`), then no action is needed.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-17T04:21:50.790Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-10-04T09:17:19.275Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-04T09:17:19.275Z
Learning: In the `lifinance/contracts` repository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-05-27T12:36:26.987Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-21T08:34:30.300Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: config/global.json:146-146
Timestamp: 2024-11-21T08:34:30.300Z
Learning: The project is deprecating `safeAddresses` and `safeApiUrls` in `global.json` and moving these configurations to `config/networks.json` for network configurations.
Applied to files:
config/networks.json
📚 Learning: 2025-01-23T02:26:29.900Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#946
File: config/networks.json:260-260
Timestamp: 2025-01-23T02:26:29.900Z
Learning: Each network in the configuration has its own unique wrapped native token address specified in the `wrappedNativeAddress` field. These addresses are network-specific and should not be expected to be the same or available across different networks.
Applied to files:
config/networks.json
📚 Learning: 2025-08-07T06:42:38.555Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1316
File: config/networks.json:0-0
Timestamp: 2025-08-07T06:42:38.555Z
Learning: For zkEVM networks in config/networks.json, it's correct for the `create3Factory` field to be missing entirely rather than set to a placeholder address, as deployment scripts skip CREATE3 factory deployment on zkEVM chains.
Applied to files:
config/networks.json
🧬 Code graph analysis (3)
script/deploy/tron/deploy-and-register-periphery.ts (5)
script/deploy/tron/utils.ts (8)
getEnvironment(131-138)getNetworkConfig(278-284)getContractAddress(221-240)getContractVersion(289-310)loadForgeArtifact(32-53)logDeployment(151-186)saveContractAddress(191-216)updateDiamondJsonPeriphery(534-602)script/helperFunctions.sh (1)
error(2883-2885)script/demoScripts/utils/demoScriptHelpers.ts (2)
getPrivateKeyForEnvironment(896-902)getEnvVar(571-577)script/deploy/tron/types.ts (1)
ITronDeploymentConfig(1-12)script/deploy/tron/TronContractDeployer.ts (1)
TronContractDeployer(18-529)
script/troncast/utils/tronweb.ts (1)
script/troncast/types.ts (1)
Environment(36-36)
script/deploy/tron/deploy-and-register-allbridge-facet.ts (4)
script/deploy/tron/utils.ts (13)
getEnvironment(131-138)getNetworkConfig(278-284)displayNetworkInfo(1176-1201)validateBalance(1070-1085)confirmDeployment(1090-1128)checkExistingDeployment(665-695)getContractVersion(289-310)deployContractWithLogging(699-753)printDeploymentSummary(1133-1171)getContractAddress(221-240)getFacetSelectors(610-660)displayRegistrationInfo(1206-1226)registerFacetToDiamond(880-995)script/demoScripts/utils/demoScriptHelpers.ts (2)
getEnvVar(571-577)getPrivateKeyForEnvironment(896-902)script/deploy/tron/types.ts (2)
ITronDeploymentConfig(1-12)IDeploymentResult(66-73)script/deploy/tron/TronContractDeployer.ts (1)
TronContractDeployer(18-529)
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (5)
script/troncast/utils/tronweb.ts (1)
15-17: Named imports for consola and TronWeb look correctPer repo learnings, both consola and TronWeb are intended to be used as named exports here. No change needed.
script/deploy/tron/deploy-and-register-periphery.ts (1)
190-301: Replace all hardcoded 'tron' occurrences with network for reads/writesMultiple calls to getContractAddress/logDeployment/saveContractAddress are hardcoded to 'tron'. This will corrupt production/staging separation.
Apply this consolidated diff (representative edits; repeat for remaining occurrences in the shown ranges):
- const existingAddress = await getContractAddress('tron', 'ERC20Proxy') + const existingAddress = await getContractAddress(network, 'ERC20Proxy') @@ - await logDeployment( + await logDeployment( 'ERC20Proxy', - 'tron', + network, result.contractAddress, version, '0x', false ) - await saveContractAddress( - 'tron', + await saveContractAddress( + network, 'ERC20Proxy', result.contractAddress )Do the same replacement for:
- Executor: getContractAddress/logDeployment/saveContractAddress
- FeeCollector: getContractAddress/logDeployment/saveContractAddress
- TokenWrapper: getContractAddress/logDeployment/saveContractAddress
Also applies to: 374-389, 390-437, 455-565, 551-565, 606-701, 702-770 <details> <summary>⛔ Skipped due to learnings</summary>Learnt from: 0xDEnYO
PR: #819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In thelifinance/contractsrepository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.Learnt from: 0xDEnYO
PR: #819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-04T09:17:19.275Z
Learning: In thelifinance/contractsrepository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.Learnt from: ezynda3
PR: #1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.Learnt from: 0xDEnYO
PR: #1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.Learnt from: 0xDEnYO
PR: #1140
File: deployments/fantom.diamond.json:97-105
Timestamp: 2025-06-25T06:27:38.873Z
Learning: When contracts are redeployed, they receive new addresses. Permit2Proxy addresses in deployment files reflect the actual deployed contract addresses for each network, not a standardized address across all networks.Learnt from: 0xDEnYO
PR: #1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.Learnt from: 0xDEnYO
PR: #819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In thedeployments/*.diamond.jsonanddeployments/*.jsonfiles, theLiFiDEXAggregatorcontract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.Learnt from: 0xDEnYO
PR: #782
File: deployments/scroll.diamond.json:111-111
Timestamp: 2024-11-26T01:03:43.597Z
Learning: When reviewing pull requests, only point out missing contract addresses indeployments/<network>.diamond.jsonif the contract's address is present indeployments/<network>.jsonbut missing indeployments/<network>.diamond.json. If the contract is not deployed on a network (i.e., not present indeployments/<network>.json), then no action is needed.Learnt from: 0xDEnYO
PR: #782
File: script/deploy/zksync/DeployPermit2Proxy.s.sol:13-20
Timestamp: 2024-11-25T13:50:34.522Z
Learning: Contracts on ZkSync will always have different addresses compared to other EVM networks. Do not highlight address differences for ZkSync when verifying deployment configurations or in log files.Learnt from: 0xDEnYO
PR: #1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.</details> </blockquote></details> <details> <summary>config/networks.json (2)</summary><blockquote> `1175-1183`: **Double-check Shasta wrappedNativeAddress** Please verify that TYsbWxNnyTgsZaTFaue9hqpxkU3Fkco94a is the intended WTRX (or testnet wrapped TRX) on Shasta. A wrong value will cause TokenWrapper constructor to reject or wrap the wrong token. I can cross-check against Tronscan (Shasta) if you want me to fetch references. --- `1155-1163`: **wrappedNativeAddress is correctly set to WTRX** The JSON already uses the TRC-20 Wrapped TRX contract (TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR), as shown by TronScan’s asset list and Tokenview explorer. ([support.tronscan.org](https://support.tronscan.org/hc/en-us/articles/360053169392-TRONSCAN-adjusted-some-APIs?utm_source=chatgpt.com), [trx.tokenview.io](https://trx.tokenview.io/en/address/TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR?utm_source=chatgpt.com)) • The proposed address (T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb) is a burn/black-hole address, not a TRC-20 token contract. No change needed. > Likely an incorrect or invalid review comment. </blockquote></details> <details> <summary>script/deploy/tron/deploy-and-register-allbridge-facet.ts (1)</summary><blockquote> `4-6`: **Named imports for consola and TronWeb look correct** Matches repo practice and current package versions. No change needed. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
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
♻️ Duplicate comments (1)
script/troncast/utils/tronweb.ts (1)
55-73: Wait for a terminal receipt state; surface failures explicitlyReturning on
receipt && receipt.idcan exit before a terminal state is set. Checkreceipt.receipt.resultand throw onFAILED.- while (Date.now() - startTime < timeout) { - try { - const receipt = await tronWeb.trx.getTransactionInfo(txId) - if (receipt && receipt.id) return receipt - } catch (error) { - // Transaction not yet confirmed - } - await new Promise((resolve) => setTimeout(resolve, 2000)) - } + while (Date.now() - startTime < timeout) { + try { + const receipt = await tronWeb.trx.getTransactionInfo(txId) + if (receipt?.id) { + const result = receipt?.receipt?.result + if (result === 'SUCCESS') return receipt + if (result === 'FAILED') + throw new Error(`Transaction ${txId} failed: ${result}`) + // If result is absent, keep waiting + } + } catch { + // Transaction not yet confirmed or not found; keep polling + } + await new Promise((resolve) => setTimeout(resolve, 2000)) + }
🧹 Nitpick comments (3)
script/troncast/utils/tronweb.ts (3)
29-30: Avoid logging full RPC URLs; redact potential secretsRPC URLs can embed tokens. Log a redacted URL (no credentials/query) instead.
- consola.debug(`Initializing TronWeb with ${env} network: ${rpcUrl}`) + // Avoid logging secrets (e.g., API keys) that might be embedded in the URL + const safeUrl = (() => { + try { + const u = new URL(rpcUrl) + u.username = '' + u.password = '' + u.search = '' + return u.toString() + } catch { + // Fallback: strip query if present + return rpcUrl.replace(/\?.*$/, '') + } + })() + consola.debug(`Initializing TronWeb with ${env} network: ${safeUrl}`)
31-34: Optional: Support TronGrid API key via headersIf
TRON_PRO_API_KEY/TRONGRID_API_KEYis set, pass it as a header; TronWeb will include it on requests. Keep it optional to avoid hard requirement.- const tronWeb = new TronWeb({ - fullHost: rpcUrl, - privateKey: privateKey || undefined, - }) + const tronProApiKey = (process.env.TRON_PRO_API_KEY || process.env.TRONGRID_API_KEY || '').trim() + const tronWeb = new TronWeb({ + fullHost: rpcUrl, + privateKey: privateKey || undefined, + headers: tronProApiKey ? { 'TRON-PRO-API-KEY': tronProApiKey } : undefined, + })
36-41: Nit: clarify the comment about the address usedMinor wording fix; it's a known burn address, not “all zeros in base58”.
- // Using a burn address (all zeros in base58 format) + // Use the well-known TRON burn address to satisfy TronWeb's requirement without risking funds
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
script/deploy/tron/deploy-and-register-periphery.ts(1 hunks)script/troncast/utils/tronweb.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- script/deploy/tron/deploy-and-register-periphery.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit inference engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/troncast/utils/tronweb.ts
🧠 Learnings (9)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: TronWeb v6.x and later uses named exports, so `import { TronWeb } from 'tronweb'` is the correct import syntax, not a default import.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage. Both libraries provide named exports, not default exports.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:10:12.922Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-01-24T14:53:20.703Z
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptChainConfig.ts:17-20
Timestamp: 2025-01-24T14:53:20.703Z
Learning: In the LiFi contracts repository, RPC URLs should be strictly sourced from environment variables without fallback to networks.json configuration.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2024-11-04T03:50:06.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:179-187
Timestamp: 2024-11-04T03:50:06.443Z
Learning: In the `script/tasks/fundNewWalletOnAllChains.ts` file, adding a timeout to the transaction confirmation wait using `publicClient.waitForTransactionReceipt` is not required.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Environment variables should be validated using `getEnvVar()` helper in TypeScript scripts.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use environment variables for configuration in TypeScript scripts.
Applied to files:
script/troncast/utils/tronweb.ts
🧬 Code graph analysis (1)
script/troncast/utils/tronweb.ts (2)
script/troncast/types.ts (1)
Environment(36-36)script/demoScripts/utils/demoScriptHelpers.ts (1)
getEnvVar(571-577)
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (4)
script/troncast/utils/tronweb.ts (4)
1-14: Good pre-import guard for TronWeb proto initializationInitializing
globalThis.protobefore importing TronWeb is necessary and correctly scoped. Theimport/firstoverride is justified and re-enabled later.
15-17: Named imports for consola and TronWeb are correct in this repoPer team learnings, both are named exports here. This resolves the earlier bot comment about default import for TronWeb.
18-21: Correct use of repo helpers for env validationUsing
getEnvVar+getRPCEnvVarNamealigns with script guidelines and avoids hardcoded env var names.
23-28: No Action Needed: ‘tronshasta’ Is the Canonical Testnet Key
ThenetworkNamepassed togetRPCEnvVarNamemust match the keys inconfig/networks.json, which defines the testnet as"tronshasta"(no hyphens). Consequently:
- In
script/troncast/utils/tronweb.ts,
const networkName = env === 'mainnet' ? 'tron' : 'tronshasta'
correctly aligns with the network key.config/networks.jsononly contains"tron"and"tronshasta"—there is no"tron-shasta"entry.getRPCEnvVarName(networkName)yieldsETH_NODE_URI_TRONSHASTA, matching the established ENV convention.Since there’s no hyphenated form used anywhere in the codebase or configuration, switching to
"tron-shasta"would introduce inconsistency rather than resolve one.Likely an incorrect or invalid review comment.
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
♻️ Duplicate comments (3)
script/deploy/tron/deploy-and-register-allbridge-facet.ts (3)
4-5: Named imports for consola and TronWeb are correct hereImport style matches our agreed pattern for consola v3.x and TronWeb v6+. Good to go.
96-98: Pass the RPC URL to displayNetworkInfo, not the network keydisplayNetworkInfo’s third param is the RPC URL and it prints it verbatim; passing the network key mislabels the endpoint and can mislead later readers of the logs.
Apply this diff:
- displayNetworkInfo(networkInfo, environment, network) + displayNetworkInfo(networkInfo, environment, rpcUrl)
181-184: Replace all hardcoded ‘tron’ lookups with the resolvednetworkvariableEvery call to
getContractAddress('tron', …)in your TRON deployment scripts should use thenetworkparameter instead of the literal'tron'. Hard‐coding the chain name breaks non-mainnet runs (e.g. Shasta) and can lead to displaying or registering the wrong addresses.Please update the following sites:
- script/deploy/tron/deploy-and-register-allbridge-facet.ts
Line 182- const diamondAddress = await getContractAddress('tron', 'LiFiDiamond')
- const diamondAddress = await getContractAddress(network, 'LiFiDiamond')
- **script/deploy/tron/deploy-and-register-periphery.ts** Line 205 ```diff - const existingAddress = await getContractAddress('tron', 'ERC20Proxy') + const existingAddress = await getContractAddress(network, 'ERC20Proxy')Line 328
- const existingAddress = await getContractAddress('tron', 'Executor') + const existingAddress = await getContractAddress(network, 'Executor')Line 355
- (await getContractAddress('tron', 'ERC20Proxy')) + (await getContractAddress(network, 'ERC20Proxy'))Line 412
- (await getContractAddress('tron', 'ERC20Proxy')) + (await getContractAddress(network, 'ERC20Proxy'))Line 470
- const existingAddress = await getContractAddress('tron', 'FeeCollector') + const existingAddress = await getContractAddress(network, 'FeeCollector')Line 621
- const existingAddress = await getContractAddress('tron', 'TokenWrapper') + const existingAddress = await getContractAddress(network, 'TokenWrapper')This guarantees that both display logic and facet‐registration always use the correct deployment address for the actual network (mainnet, Shasta, staging, etc.) rather than assuming
tron.
🧹 Nitpick comments (3)
script/deploy/tron/deploy-and-register-allbridge-facet.ts (3)
148-176: Wrap the else branch in braces for clarityelse-try without braces is valid but harms readability and has been a recurring nit in this file. Add braces around the else block.
- } else - try { + } else { + try { // Constructor arguments for AllBridgeFacet const constructorArgs = [allBridgeAddress] // Deploy using new utility const result = await deployContractWithLogging( deployer, 'AllBridgeFacet', constructorArgs, dryRun, network ) facetAddress = result.address deploymentResults.push(result) } catch (error: any) { consola.error('Failed to deploy AllBridgeFacet:', error.message) deploymentResults.push({ contract: 'AllBridgeFacet', address: 'FAILED', txId: 'FAILED', cost: 0, version: '0.0.0', status: 'failed', }) printDeploymentSummary(deploymentResults, dryRun) process.exit(1) - } + } + }
109-116: Optionally validate AllBridge address before deployingA quick format check avoids wasting time on a failed deploy if the address in config is malformed.
if (!allBridgeAddress) throw new Error( `AllBridge address not found for ${network} in config/allbridge.json` ) + if (!tronWeb.isAddress(allBridgeAddress)) { + throw new Error( + `Invalid AllBridge address for ${network}: ${allBridgeAddress}` + ) + }
52-56: Minor docstring/comment tweakThis block no longer reads from networks.json. Update the comment to reflect that network selection is derived from EnvironmentEnum and RPC is sourced via environment variables.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
script/deploy/tron/deploy-and-register-allbridge-facet.ts(1 hunks)script/deploy/tron/deploy-and-register-symbiosis-facet.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- script/deploy/tron/deploy-and-register-symbiosis-facet.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit inference engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
🧠 Learnings (19)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/scroll.diamond.json:82-82
Timestamp: 2024-10-09T03:47:21.269Z
Learning: In the `deployments/*.diamond.json` and `deployments/*.json` files, the `LiFiDEXAggregator` contract may intentionally have the same contract address across multiple networks. This is acceptable and should not be flagged as an issue in future code reviews.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-10-09T03:47:21.269Z
Learnt from: ezynda3
PR: lifinance/contracts#806
File: deployments/_deployments_log_file.json:5780-5793
Timestamp: 2024-10-09T03:47:21.269Z
Learning: The owner address `0x11f11121df7256c40339393b0fb045321022ce44` and the `DiamondCutFacet` address `0xd5cf40a2a18b633cfd6a1ae16d1771596498cf83` in the `LiFiDiamond` deployment on `xlayer` are correct and should not be flagged as issues, even if they are not referenced in the Solidity files.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-26T01:03:43.597Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#782
File: deployments/scroll.diamond.json:111-111
Timestamp: 2024-11-26T01:03:43.597Z
Learning: When reviewing pull requests, only point out missing contract addresses in `deployments/<network>.diamond.json` if the contract's address is present in `deployments/<network>.json` but missing in `deployments/<network>.diamond.json`. If the contract is not deployed on a network (i.e., not present in `deployments/<network>.json`), then no action is needed.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-17T04:21:50.790Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1266
File: script/deploy/safe/execute-pending-timelock-tx.ts:129-129
Timestamp: 2025-07-17T04:21:50.790Z
Learning: In the lifinance/contracts repository, 0xDEnYO prefers not to add private key format validation in deployment scripts like execute-pending-timelock-tx.ts, prioritizing code simplicity over strict validation in their controlled environment.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage. Both libraries provide named exports, not default exports.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: Consola v3.x uses named exports, so `import { consola } from 'consola'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use `consola` for consistent logging across TypeScript scripts.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: TronWeb v6.x and later uses named exports, so `import { TronWeb } from 'tronweb'` is the correct import syntax, not a default import.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-08-19T05:10:12.922Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-07-17T11:31:50.058Z
Learnt from: mirooon
PR: lifinance/contracts#1283
File: config/networks.json:837-839
Timestamp: 2025-07-17T11:31:50.058Z
Learning: In config/networks.json for the Ronin network (chainId 2020), there is a problematic mismatch between verificationType ("blockscout") and explorerApiUrl ("https://sourcify.roninchain.com/server"). This inconsistency can lead to verification issues and should be flagged when networks.json is modified in future PRs.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs updating contract addresses (like RelayFacet on Worldchain), verify the presence of entries in all relevant files (worldchain.json, worldchain.diamond.json, _deployments_log_file.json) before reporting inconsistencies. The RelayFacet entry exists in all required deployment files with the correct address.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-21T08:24:22.802Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/healthCheck.ts:387-388
Timestamp: 2024-11-21T08:24:22.802Z
Learning: In `script/deploy/healthCheck.ts`, handling the case when `networkConfig` is undefined is unnecessary because the code will fail anyway.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-10-04T09:17:19.275Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#819
File: deployments/avalanche.diamond.json:105-105
Timestamp: 2024-10-04T09:17:19.275Z
Learning: In the `lifinance/contracts` repository, contracts may have different addresses across networks. Do not check if contracts have the same addresses across all networks in future reviews.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-04-21T03:17:53.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1109
File: deployments/worldchain.json:28-28
Timestamp: 2025-04-21T03:17:53.443Z
Learning: For deployment PRs involving address updates like the RelayFacet to Worldchain, verify the actual presence of entries in files before reporting issues. The RelayFacet exists in the diamond log file and the PR diff already contains the necessary address change.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2024-11-21T08:24:05.881Z
Learnt from: ezynda3
PR: lifinance/contracts#861
File: script/deploy/safe/add-owners-to-safe.ts:8-13
Timestamp: 2024-11-21T08:24:05.881Z
Learning: In `script/deploy/safe/add-owners-to-safe.ts`, validation for network configuration when casting imported JSON data to `NetworksObject` is not required as per the user's preference.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-05-27T12:36:26.987Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#1168
File: script/deploy/_targetState.json:1564-1589
Timestamp: 2025-05-27T12:36:26.987Z
Learning: When reviewing deployment PRs in the lifinance/contracts repository, target state configuration files (like script/deploy/_targetState.json) may be updated for multiple networks even when the PR is focused on deploying to a specific network. The scope should be determined by the PR title and description, not just by all configuration changes present in the files.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
📚 Learning: 2025-01-24T14:53:20.703Z
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptChainConfig.ts:17-20
Timestamp: 2025-01-24T14:53:20.703Z
Learning: In the LiFi contracts repository, RPC URLs should be strictly sourced from environment variables without fallback to networks.json configuration.
Applied to files:
script/deploy/tron/deploy-and-register-allbridge-facet.ts
🧬 Code graph analysis (1)
script/deploy/tron/deploy-and-register-allbridge-facet.ts (4)
script/deploy/tron/utils.ts (12)
getEnvironment(131-138)displayNetworkInfo(1176-1201)validateBalance(1070-1085)confirmDeployment(1090-1128)checkExistingDeployment(665-695)getContractVersion(289-310)deployContractWithLogging(699-753)printDeploymentSummary(1133-1171)getContractAddress(221-240)getFacetSelectors(610-660)displayRegistrationInfo(1206-1226)registerFacetToDiamond(880-995)script/demoScripts/utils/demoScriptHelpers.ts (2)
getEnvVar(571-577)getPrivateKeyForEnvironment(896-902)script/deploy/tron/types.ts (2)
ITronDeploymentConfig(1-12)IDeploymentResult(66-73)script/deploy/tron/TronContractDeployer.ts (1)
TronContractDeployer(18-529)
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (1)
script/deploy/tron/deploy-and-register-allbridge-facet.ts (1)
59-62: Sourcing RPC from validated env var is on-specUsing getRPCEnvVarName() + getEnvVar() aligns with the repository convention (no networks.json fallback). Nice.
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 (2)
.github/workflows/healthCheckForNewNetworkDeployment.yml (2)
108-111: Pass secrets explicitly and mask them to avoid leaking RPC credentials in logs.If
bun run fetch-rpcsreads credentials (e.g., DB URI, provider API keys), wire them via GitHub Secrets and mask them. Otherwise, the step may fail or accidentally echo sensitive values.Apply this diff (replace placeholder secret names with the actual ones used by script/mongoDb/fetch-rpcs.ts):
- - name: Fetch RPCs - if: env.CONTINUE == 'true' && env.SKIP_CHECK != 'true' - run: bun run fetch-rpcs + - name: Fetch RPCs + if: env.CONTINUE == 'true' && env.SKIP_CHECK != 'true' + env: + # TODO: replace with real secret names required by fetch-rpcs + MONGODB_URI: ${{ secrets.MONGODB_URI }} + RPC_PROVIDER_TOKEN: ${{ secrets.RPC_PROVIDER_TOKEN }} + run: | + # Mask secrets defensively in case downstream logs echo them + if [[ -n "${MONGODB_URI}" ]]; then echo "::add-mask::${MONGODB_URI}"; fi + if [[ -n "${RPC_PROVIDER_TOKEN}" ]]; then echo "::add-mask::${RPC_PROVIDER_TOKEN}"; fi + bun run fetch-rpcs
108-111: Minor: add a retry to reduce flakiness for network hiccups.RPC/source backends can momentarily fail. A simple retry around
fetch-rpcswould make CI more resilient.- name: Fetch RPCs if: env.CONTINUE == 'true' && env.SKIP_CHECK != 'true' - run: bun run fetch-rpcs + run: | + set +e + for i in 1 2 3; do + bun run fetch-rpcs && exit 0 + echo "fetch-rpcs attempt $i failed; retrying in 5s..." + sleep 5 + done + echo "fetch-rpcs failed after 3 attempts" + exit 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.github/workflows/healthCheckForNewNetworkDeployment.yml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/*.yml
📄 CodeRabbit inference engine (conventions.md)
.github/workflows/*.yml: Use GitHub Secrets for sensitive data in GitHub workflow files.
Begin GitHub workflow files with a clear description (YAML comments) and include descriptive comments throughout.
Set explicit permissions and include notifications in GitHub workflow files.
Files:
.github/workflows/healthCheckForNewNetworkDeployment.yml
🧠 Learnings (1)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (2)
.github/workflows/healthCheckForNewNetworkDeployment.yml (2)
108-111: Good addition: fetching RPCs before health checks is the right place.This ensures Tron/TronShasta RPCs are populated prior to running network health checks. Nice alignment with the new flow.
112-125: Validate healthCheck.ts reads standardized RPC env var names for Tron networks.Given the repo’s decision to standardize RPC env var naming (hyphens → underscores; e.g., tronshasta → ETH_NODE_URI_TRON_SHASTA), ensure health checks consume names built by
getRPCEnvVarName(networkName)to avoid mismatches, especially for “tronshasta”.Note: This follows the retrieved learning from PR #1303 about standardizing RPC env names using script/utils/network.ts:getRPCEnvVarName(). If needed, I can generate a patch to refactor the health check script to use the helper consistently.
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
♻️ Duplicate comments (2)
script/troncast/utils/tronweb.ts (2)
61-79: Wait for a terminal tx state; return receipt only when executedCurrently returns on any receipt with an id, which may precede execution. Check
receipt.receipt.resultand handle FAILED explicitly.Apply this diff:
while (Date.now() - startTime < timeout) { try { const receipt = await tronWeb.trx.getTransactionInfo(txId) - if (receipt && receipt.id) return receipt + // Confirmed only when we have a terminal result from the execution + const result = receipt?.receipt?.result as string | undefined + if (receipt?.id && result) { + if (result === 'SUCCESS') return receipt + // Surface failures early with details if present + const err = (receipt as any)?.resMessage || (receipt as any)?.contractResult || result + throw new Error(`Transaction ${txId} failed: ${err ?? 'UNKNOWN_ERROR'}`) + } } catch (error) { // Transaction not yet confirmed } await new Promise((resolve) => setTimeout(resolve, 2000)) }If you’d like, we can also make the poll interval configurable (minor).
51-59: Avoid float math for TRX→SUN conversion; use exact integer mathFloating-point introduces precision errors for monetary values. Parse and scale using integer math (BigInt) and validate <=6 decimals.
Apply this diff:
-export function parseValue(value: string): string { - // Handle formats like "0.1tron", "100sun", "1000000" - if (value.endsWith('tron')) { - const amount = parseFloat(value.replace('tron', '')) - return (amount * 1_000_000).toString() // Convert to SUN - } else if (value.endsWith('sun')) return value.replace('sun', '') - - return value // Assume it's already in SUN -} +export function parseValue(value: string): string { + // Accept formats like "0.1tron", "0.1trx", "100sun", or a bare SUN integer string + const v = value.trim().toLowerCase() + const SUN_IN_TRX = 1_000_000n + + // e.g., "100sun" + if (v.endsWith('sun')) { + const n = v.slice(0, -3).trim() + if (!/^\d+$/.test(n)) throw new Error(`Invalid SUN amount: ${value}`) + return n.replace(/^0+(?=\d)/, '') + } + + // e.g., "0.1tron" / "0.1trx" + if (v.endsWith('tron') || v.endsWith('trx')) { + const n = v.replace(/(tron|trx)$/, '').trim() + if (!/^\d+(\.\d+)?$/.test(n)) throw new Error(`Invalid TRX amount: ${value}`) + const [i, fRaw = ''] = n.split('.') + if (fRaw.length > 6) throw new Error('Too many decimal places for TRX (max 6)') + const f = (fRaw + '000000').slice(0, 6) + const sun = BigInt(i) * SUN_IN_TRX + BigInt(f) + return sun.toString() + } + + // Bare SUN integer + if (/^\d+$/.test(v)) return v.replace(/^0+(?=\d)/, '') + + throw new Error(`Invalid value format: ${value}`) +}
🧹 Nitpick comments (2)
script/troncast/utils/tronweb.ts (2)
1-14: Pre-import TronWeb proto bootstrap looks good; simplify the guardThe early proto initialization is appropriate here. You can tighten it and avoid a separate typeof check using nullish coalescing.
Apply this diff:
-if ( - typeof globalThis !== 'undefined' && - typeof globalThis.proto === 'undefined' -) - globalThis.proto = {} +if (typeof globalThis !== 'undefined') { + // Ensure proto exists exactly once before importing TronWeb + ;(globalThis as any).proto ??= {} +}
42-47: Nit: clarify the null/burn address commentThe address
T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwbis the well-known TRON null/burn address (Base58 for 0x000…); it isn’t “all zeros in base58 format”.Apply this diff:
- // This is a dummy address that won't be used for signing + // This is a dummy address that won't be used for signing if (!privateKey) - // Using a burn address (all zeros in base58 format) + // Using the well-known TRON null/burn address (Base58 for 0x000…) tronWeb.setAddress('T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb')
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
deployments/_deployments_log_file.json(18 hunks)script/deploy/healthCheck.ts(8 hunks)script/troncast/utils/tronweb.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- deployments/_deployments_log_file.json
- script/deploy/healthCheck.ts
🧰 Additional context used
📓 Path-based instructions (1)
script/**/*.ts
📄 CodeRabbit inference engine (conventions.md)
script/**/*.ts: All scripts must follow the rules defined in.eslintrc.cjs.
Use async/await for asynchronous operations in TypeScript scripts.
Handle errors appropriately with try/catch blocks in TypeScript scripts.
Include proper logging for debugging and monitoring in TypeScript scripts.
Use environment variables for configuration in TypeScript scripts.
All scripts must usecittyfor CLI argument parsing.
Useconsolafor consistent logging across TypeScript scripts.
Environment variables should be validated usinggetEnvVar()helper in TypeScript scripts.
Scripts should exit with appropriate exit codes (0 for success, 1 for error) in TypeScript scripts.
Files:
script/troncast/utils/tronweb.ts
🧠 Learnings (9)
📓 Common learnings
Learnt from: 0xDEnYO
PR: lifinance/contracts#1256
File: deployments/zksync.diamond.json:81-87
Timestamp: 2025-07-04T08:59:08.108Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: mirooon
PR: lifinance/contracts#1283
File: deployments/ronin.diamond.json:65-68
Timestamp: 2025-08-07T10:20:01.383Z
Learning: When analyzing deployment PRs in the lifinance/contracts repository, carefully verify that target state configuration files (like script/deploy/_targetState.json) and deployment log files have been updated before flagging missing entries. The AI summary section should be consulted to understand all file changes, as manual searches might miss entries due to formatting differences or search limitations.
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
📚 Learning: 2025-08-19T05:07:34.458Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/register-facets-to-diamond.ts:6-9
Timestamp: 2025-08-19T05:07:34.458Z
Learning: TronWeb v6.x and later uses named exports, so `import { TronWeb } from 'tronweb'` is the correct import syntax, not a default import.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:07:19.448Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/deploy/tron/utils.ts:3-5
Timestamp: 2025-08-19T05:07:19.448Z
Learning: In the lifinance/contracts repository, consola and TronWeb should be imported as named exports: `import { consola } from 'consola'` and `import { TronWeb } from 'tronweb'`. Do not flag these as incorrect default export usage. Both libraries provide named exports, not default exports.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-08-19T05:10:12.922Z
Learnt from: ezynda3
PR: lifinance/contracts#1303
File: script/utils/network.ts:27-32
Timestamp: 2025-08-19T05:10:12.922Z
Learning: In the lifinance/contracts repository, the team decided to standardize RPC environment variable naming by converting all hyphens to underscores in network names. For example, "tron-shasta" becomes "ETH_NODE_URI_TRON_SHASTA". The getRPCEnvVarName() helper in script/utils/network.ts implements this standard and should be used consistently across the codebase instead of direct string manipulation.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-01-24T14:53:20.703Z
Learnt from: mirooon
PR: lifinance/contracts#950
File: script/demoScripts/utils/demoScriptChainConfig.ts:17-20
Timestamp: 2025-01-24T14:53:20.703Z
Learning: In the LiFi contracts repository, RPC URLs should be strictly sourced from environment variables without fallback to networks.json configuration.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2024-11-04T03:50:06.443Z
Learnt from: 0xDEnYO
PR: lifinance/contracts#847
File: script/tasks/fundNewWalletOnAllChains.ts:179-187
Timestamp: 2024-11-04T03:50:06.443Z
Learning: In the `script/tasks/fundNewWalletOnAllChains.ts` file, adding a timeout to the transaction confirmation wait using `publicClient.waitForTransactionReceipt` is not required.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Environment variables should be validated using `getEnvVar()` helper in TypeScript scripts.
Applied to files:
script/troncast/utils/tronweb.ts
📚 Learning: 2025-07-28T07:54:14.853Z
Learnt from: CR
PR: lifinance/contracts#0
File: conventions.md:0-0
Timestamp: 2025-07-28T07:54:14.853Z
Learning: Applies to script/**/*.ts : Use environment variables for configuration in TypeScript scripts.
Applied to files:
script/troncast/utils/tronweb.ts
🧬 Code graph analysis (1)
script/troncast/utils/tronweb.ts (2)
script/troncast/types.ts (1)
Environment(36-36)script/demoScripts/utils/demoScriptHelpers.ts (1)
getEnvVar(573-579)
⏰ 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). (1)
- GitHub Check: run-unit-tests
🔇 Additional comments (2)
script/troncast/utils/tronweb.ts (2)
15-17: Named imports for TronWeb and consola are correct (v6+)Good catch using named exports:
import { TronWeb } from 'tronweb'andimport { consola } from 'consola'. This aligns with the repo’s recent decision and TronWeb v6 API. Noting this explicitly because a prior automated comment suggested default import; that advice is outdated here.Note: I used the retrieved learnings for this verification.
18-21: Correct use of repo helpers for environment configImporting and using
getEnvVarandgetRPCEnvVarNamefollows the repository conventions for scripts. This ensures consistent env-var naming and validation.Note: I used the retrieved learnings for this verification.
Which Jira task belongs to this PR?
Why did I implement it this way?
Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)