Skip to content
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

Fix fetching of dependencies #1717

Merged
merged 1 commit into from
Aug 29, 2024
Merged

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Aug 29, 2024

Fixes #1716

Description

When using a flow.json configuration file with dependencies that point to Testnet, then the dependency manager currently implicitly fetches the service account contract 8c5303eaa26202d6.FlowContractAudits, which has not been updated to Cadence 1.0:

❌ Error processing dependency: failed to parse program: Parsing failed:
error: `pub` is no longer a valid access keyword
 --> :1:0
  |
1 | pub contract FlowContractAudits {
  | ^^^

This happens if a dependency directly or indirectly depends on a contract in the same account.

This is because currently, when the dependency manager is asked to fetch a dependency (and recursively its dependencies), the manager always fetches all contracts of the account and parses them all, even though only one dependency is requested.

Unless I'm missing something, there is no need to fetch and parse all account contracts, and it is actually incorrect to fail adding a dependency because an unrelated contract in the same account happens to be broken.

Simply fetch the account's contracts, and only parse the requested contract (if it exists).


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

do not parse all contracts in account, only get the requested contract
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 15.00000% with 17 lines in your changes missing coverage. Please review.

Project coverage is 34.11%. Comparing base (b291db8) to head (86d02cb).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
internal/dependencymanager/dependencyinstaller.go 15.00% 11 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1717      +/-   ##
==========================================
- Coverage   34.32%   34.11%   -0.22%     
==========================================
  Files         100      100              
  Lines        6368     6384      +16     
==========================================
- Hits         2186     2178       -8     
- Misses       3894     3922      +28     
+ Partials      288      284       -4     
Flag Coverage Δ
unittests 34.11% <15.00%> (-0.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@turbolent turbolent merged commit 716b706 into master Aug 29, 2024
7 checks passed
@turbolent turbolent deleted the bastian/fix-dependency-installer branch August 29, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants