-
Notifications
You must be signed in to change notification settings - Fork 81
Add legacy Crypto identifier to linter
#2238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Pull request overview
This PR adds support for the legacy Crypto identifier in the Cadence linter by enabling proper resolution of Crypto contract imports. The implementation follows the same pattern used for other standard library imports like Test and BlockchainHelpers.
- Adds handling for
stdlib.CryptoContractLocationin the import resolver - Includes test coverage for Crypto contract imports across different contexts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/cadence/linter.go | Adds case handling for CryptoContractLocation to parse and check the Crypto contract when imported |
| internal/cadence/lint_test.go | Adds test case and test file to verify Crypto import resolution works correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Build contract name -> address mapping per network | ||
| for _, network := range *networks { | ||
| checkerAddr, err := l.state.ContractAddress(checkerContract, network) | ||
| if err != nil || checkerAddr == nil { | ||
| continue | ||
| contractNameToAddress := make(map[string]flowGo.Address) | ||
|
|
||
| // Add aliases first | ||
| contracts := l.state.Contracts() | ||
| if contracts != nil { | ||
| for _, contract := range *contracts { | ||
| if alias := contract.Aliases.ByNetwork(network.Name); alias != nil { | ||
| contractNameToAddress[contract.Name] = alias.Address | ||
| } | ||
| } | ||
| } |
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.
This only resolved deployment contract addresses, but did not properly resolve dependencies. Noticed when testing against sample repo.
Closes #2242
Description
For contributor use:
masterbranchFiles changedin the Github PR explorer