-
Notifications
You must be signed in to change notification settings - Fork 83
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
ci: fix sdk build failure #377
Conversation
WalkthroughThe changes involve updating the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (3)
package.json
is excluded by!**/*.json
packages/sdk/package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
,!**/*.yaml
Files selected for processing (2)
- .github/workflows/ci.yml (1 hunks)
- .github/workflows/test.yml (1 hunks)
Additional comments not posted (4)
.github/workflows/test.yml (3)
Line range hint
1-72
: Overall workflow structure and best practicesThe workflow file is well-structured and follows GitHub Actions best practices. The pnpm version upgrade is the only change, and it's appropriately placed within the workflow.
A few points to note:
- The workflow uses a custom runner group and labels, which is good for specific infrastructure requirements.
- It properly sets up and caches dependencies for Go, Node.js, and pnpm.
- The Foundry installation uses a specific nightly version, which ensures consistency but may need periodic updates.
- The
OP_E2E_DISABLE_PARALLEL
environment variable is set tofalse
for the test step, which could impact test execution speed and resource usage.These aspects of the workflow are not directly related to the pnpm version change but are worth keeping in mind for future optimizations or troubleshooting.
31-31
: Upgrade of pnpm version from 8 to 9This change aligns with the PR objective to fix the SDK build failure. Upgrading pnpm could potentially resolve dependency-related issues.
To ensure compatibility and to catch any potential issues early, please run the following verification steps:
After running these checks, please ensure that:
- All workflow files use the same pnpm version (9).
- Any pnpm-related scripts in package.json are compatible with version 9.
- If a pnpm-lock.yaml file exists, regenerate it using pnpm 9 to ensure compatibility.
Line range hint
40-47
: Consider potential impact on pnpm cacheThe pnpm version upgrade might affect the contents of the pnpm-lock.yaml file. If this file changes, it could impact the effectiveness of the caching step.
To ensure the cache is working as expected after the upgrade, please run the following verification steps:
If the pnpm-lock.yaml file has changed or if you notice cache misses in recent runs, consider:
- Regenerating the pnpm-lock.yaml file with pnpm 9.
- Updating the cache key in the workflow if necessary.
- Running the workflow again to verify that the cache is working as expected.
Verification successful
Consider potential impact on pnpm cache
The pnpm version upgrade might affect the contents of the
pnpm-lock.yaml
file, potentially impacting the caching step. Recent workflow logs show both cache hits and misses, indicating that while the cache is functioning, there may be room for optimization. Please ensure that thepnpm-lock.yaml
file is up-to-date and consider reviewing the cache key strategy if cache misses persist.
- Cache hits were observed, indicating that the caching mechanism is working.
- Cache misses suggest potential areas for improvement in cache configuration.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify pnpm-lock.yaml and cache effectiveness # Test: Check if pnpm-lock.yaml has changed echo "Checking if pnpm-lock.yaml has changed:" git diff --name-only origin/main -- pnpm-lock.yaml # Test: Look for cache hit/miss logs in recent workflow runs echo "Checking recent workflow runs for cache hit/miss:" gh run list --workflow=test.yml --limit=5 --json conclusion,databaseId --jq '.[] | "Run ID: \(.databaseId), Conclusion: \(.conclusion)"' echo "Please manually check the logs of these runs for cache hit/miss information."Length of output: 791
Script:
#!/bin/bash # Description: Verify pnpm-lock.yaml changes and cache effectiveness # Test: Check if pnpm-lock.yaml exists and its last modification time echo "Checking if pnpm-lock.yaml exists and its last modification time:" if [ -f pnpm-lock.yaml ]; then stat pnpm-lock.yaml else echo "pnpm-lock.yaml does not exist." fi # Test: Attempt to extract cache hit/miss information from recent workflow logs echo "Attempting to extract cache hit/miss information from recent workflow logs:" gh run list --workflow=test.yml --limit=5 --json databaseId --jq '.[] | .databaseId' | while read -r run_id; do echo "Checking logs for Run ID: $run_id" gh run view "$run_id" --log | grep -i "cache hit\|cache miss" doneLength of output: 6320
.github/workflows/ci.yml (1)
44-44
: Approve pnpm version update to 9This change aligns with the PR objective to fix the SDK build failure. The update from pnpm 8 to 9 might resolve dependency resolution issues or introduce new features that could fix the build process.
To ensure this change doesn't introduce any new issues, please verify the following:
- The build process completes successfully for all components (Node, Validator, Batcher) with the new pnpm version.
- The pnpm-lock.yaml file has been updated to reflect this version change.
You can use the following script to check for other workflow files that might need updating:
If other workflow files are found using different pnpm versions, consider updating them for consistency across the project.
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
Outside diff range, codebase verification and nitpick comments (7)
packages/sdk/src/type-extensions.ts (1)
1-2
: Consider grouping imports.For better organization, consider grouping the imports by their source. You can separate third-party imports from local imports and sort them alphabetically.
Here's a suggested reorganization:
-import 'hardhat/types/runtime' -import { DeploymentsExtension } from 'hardhat-deploy/types' +import 'hardhat/types/runtime'; + +import { DeploymentsExtension } from 'hardhat-deploy/types';packages/sdk/hardhat.config.ts (1)
3-4
: LGTM! Consider grouping related imports.The reorganization of imports improves code structure and readability.
Consider grouping related imports together. You could move the
@nomiclabs/hardhat-ethers
import next tohardhat-deploy
for better organization:import { HardhatUserConfig } from 'hardhat/types' -import '@nomiclabs/hardhat-ethers' import 'hardhat-deploy' +import '@nomiclabs/hardhat-ethers'packages/sdk/src/tasks/initiate-withdrawal.ts (5)
Line range hint
1-14
: Consider reorganizing imports for better readability.The current import structure mixes Node.js built-ins, external libraries, and local imports. Consider grouping them as follows:
- Node.js built-ins
- External libraries
- Local imports
This organization can improve code readability and maintainability.
Here's a suggested reorganization:
import { promises as fs } from 'fs' import { Wallet, providers, utils } from 'ethers' import { task, types } from 'hardhat/config' import { HardhatRuntimeEnvironment } from 'hardhat/types' import '@nomiclabs/hardhat-ethers' import 'hardhat-deploy' import { CONTRACT_ADDRESSES, ContractsLike, CrossChainMessenger, DEFAULT_L2_CONTRACT_ADDRESSES, assert, } from '../'
Line range hint
21-38
: Consider extracting default values and using constants.The task definition uses some magic strings and numbers. It's generally a good practice to extract these into named constants, especially for values that might be used in multiple places or could change in the future.
Consider defining constants for default values:
const DEFAULT_L1_PROVIDER_URL = 'http://localhost:8545' const DEFAULT_AMOUNT = '1' // Then use these in the task definition .addParam( 'l1ProviderUrl', 'L1 Provider URL', DEFAULT_L1_PROVIDER_URL, types.string ) // ... const amount = parseEther(args.amount ?? DEFAULT_AMOUNT)
Line range hint
41-43
: Enhance error messages for better debugging.The current assertions use basic error messages. Consider providing more context in these messages to aid in debugging.
Improve error messages:
assert(signers.length > 0, 'No configured signers found in the Hardhat Runtime Environment') // ... assert(balance.gt(0), `Signer ${address} has no balance`)
Line range hint
1-108
: Consider breaking down the task action into smaller functions.The task action is quite long and handles multiple concerns. Consider breaking it down into smaller, more focused functions to improve readability and maintainability.
You could extract logic into functions like:
getContractAddresses(hre, l1ContractsJsonPath)
setupMessenger(l1Signer, signer, chainId, contractAddrs)
performWithdrawal(messenger, amount, to)
This would make the main task action more concise and easier to understand at a glance.
6-6
: Inconsistent use ofHardhatRuntimeEnvironment
type annotation in task files.The following task files do not use the
HardhatRuntimeEnvironment
type annotation for thehre
parameter, leading to inconsistency in type safety practices:
packages/sdk/src/tasks/register-erc20.ts
packages/sdk/src/tasks/deposit-erc20.ts
Consider updating these files to include the
HardhatRuntimeEnvironment
type annotation for improved type safety and consistency across the codebase.Analysis chain
Improved type safety with HardhatRuntimeEnvironment.
The addition of the
HardhatRuntimeEnvironment
type for thehre
parameter enhances type safety and code clarity. This is a good practice that should be applied consistently across the codebase.To ensure consistency, let's check if other task files in the SDK use the same type annotation:
If this script returns results, consider updating those files for consistency.
Also applies to: 39-39
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if other task files use HardhatRuntimeEnvironment type annotation # Test: Search for task definitions without HardhatRuntimeEnvironment type annotation # Expect: No results, indicating all task files use the type annotation rg --type typescript 'setAction\(async \(.*\) =>' packages/sdk/src/tasks/ | rg -v 'hre: HardhatRuntimeEnvironment'Length of output: 151
Script:
#!/bin/bash # Description: Check if other task files use HardhatRuntimeEnvironment type annotation # Test: Search for task definitions without HardhatRuntimeEnvironment type annotation # Expect: No results, indicating all task files use the type annotation rg 'setAction\(async \(.*\) =>' --glob '**/*.ts' packages/sdk/src/tasks/ | rg -v 'hre: HardhatRuntimeEnvironment'Length of output: 268
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
packages/sdk/tsconfig.json
is excluded by!**/*.json
Files selected for processing (5)
- packages/sdk/.eslintrc.js (1 hunks)
- packages/sdk/hardhat.config.ts (2 hunks)
- packages/sdk/src/tasks/deposit-eth.ts (2 hunks)
- packages/sdk/src/tasks/initiate-withdrawal.ts (2 hunks)
- packages/sdk/src/type-extensions.ts (1 hunks)
Additional comments not posted (4)
packages/sdk/src/type-extensions.ts (1)
1-8
: LGTM! New file for extending Hardhat runtime environment.The new file correctly extends the Hardhat runtime environment with deployment functionalities. This is a good practice for adding custom capabilities to Hardhat.
packages/sdk/.eslintrc.js (1)
Line range hint
1-44
: Removal ofignorePatterns
propertyThe AI-generated summary mentions the removal of the
ignorePatterns
property, which previously excludedhardhat.config.ts
from linting. This change is not visible in the provided code, but it's an important modification to note.To verify the impact of this change, please run the following script:
This script will help verify if
hardhat.config.ts
is now being linted and if there are any ESLint disable comments in the file.Existing configuration review
The current ESLint configuration follows good practices:
- It extends a base configuration from the root of the project.
- It includes specific overrides for TypeScript files in the
src
directory.- The list of restricted imports helps maintain a clean dependency structure.
packages/sdk/hardhat.config.ts (1)
17-17
: Verify project structure changes.The update of the 'sources' path from './test/contracts' to './src' is approved.
This change suggests a shift in the project structure. Please ensure that:
- All contract source files have been moved from './test/contracts' to './src'.
- Any import statements in other files referencing these contracts have been updated.
- Other configuration files or scripts that might reference the old path have been updated.
Run the following script to verify these changes:
packages/sdk/src/tasks/deposit-eth.ts (1)
52-52
: Improved type safety forhre
parameterThe explicit type annotation
HardhatRuntimeEnvironment
for thehre
parameter enhances type safety and improves code clarity. This change aligns with TypeScript best practices and will provide better IDE support and catch potential type-related errors earlier in the development process.
No description provided.