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

feat: airplane mode (non-exact compiler version match) [APE-1161] #114

Merged
merged 8 commits into from
Sep 6, 2023

Conversation

wakamex
Copy link
Contributor

@wakamex wakamex commented Jul 5, 2023

What I did

make lazy compiler match

fixes: #

How I did it

use the built-in match function of the pragma_spec to check if an existing (downloaded) solidity spec is a match, and if so use it. this avoids trying to download new solc versions very aggresively, which makes it impossible to compile using ape on an airplane.

How to verify it

turn off your wifi and try to compile anything, without and with this PR.

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

@vany365 vany365 changed the title feat: airplane mode (non-exact compiler version match) feat: airplane mode (non-exact compiler version match) [APE-1161] Jul 5, 2023
@wakamex
Copy link
Contributor Author

wakamex commented Jul 5, 2023

this may not be the best way to go about this. maybe it should be in _get_best_version, perhaps with a setting to toggle between matching behaviors. looks like current is "exact then most recent" whereas this does "oldest version that satisfies the pragma spec" (idea being maximum compatibility here, to minimize fucking anything up, since we're allowing less-exact matches using the oldest match minimizes the difference in versions between something like ^0.8.0 and what it's compiled with. in my example case this PR compiles with 0.8.19 instead of 0.8.20).

motivation is letting me use 🦧 on a plane (there's some mf'ing 🐍s on this mf'ing plane)

I've been meaning to create a test to verify what triggers an attempted download on every compile.

I think the ^0.8.0 in my codebase doesn't find an exact match, and tries to download it every time?

w/ this PR I get this behavior:

DEBUG: compiling /Users/mihai/code/hyperdrive/contracts/.cache/OpenZeppelin/v4.9.0/token/ERC20/extensions/ERC20Pausable.sol (^0.8.0) with 0.8.19

@antazoey
Copy link
Member

antazoey commented Jul 5, 2023

Thank you! I am always running into problems when I have no internet as well
Edit: I am thinking

@antazoey
Copy link
Member

antazoey commented Jul 5, 2023

@wakamex For future reference, you can set the solidity version in your ape-config to 0.8.19 to avoid even trying to check for more compat versions

@fubuloubu
Copy link
Member

@wakamex For future reference, you can set the solidity version in your ape-config to 0.8.19 to avoid even trying to check for more compat versions

Maybe that should be the suggestion with the warning?

@fubuloubu
Copy link
Member

I like the idea of the warning if you're not connected to the internet, and then it using the most recent version that's installed and matches pragma

I also like the idea of it suggesting to lock your compiler version via config file if the Pragma is wider than just one version

@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 5, 2023
@fubuloubu fubuloubu removed the stale label Aug 5, 2023
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label, add a comment, or make a new commit, otherwise this PR will be closed in 5 days.

@github-actions github-actions bot added the stale label Sep 5, 2023
@fubuloubu fubuloubu removed the stale label Sep 5, 2023
fubuloubu
fubuloubu previously approved these changes Sep 6, 2023
ape_solidity/compiler.py Outdated Show resolved Hide resolved
ape_solidity/compiler.py Outdated Show resolved Hide resolved
Co-authored-by: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com>
antazoey
antazoey previously approved these changes Sep 6, 2023
ape_solidity/compiler.py Outdated Show resolved Hide resolved
Co-authored-by: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com>
@antazoey antazoey merged commit 7757892 into ApeWorX:main Sep 6, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants