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

Install (and download) missing dependencies automatically #2098

Closed
shekhirin opened this issue Jun 23, 2022 · 4 comments · Fixed by #2617
Closed

Install (and download) missing dependencies automatically #2098

shekhirin opened this issue Jun 23, 2022 · 4 comments · Fixed by #2617
Assignees
Labels
C-forge Command: forge Cmd-forge-build Command: forge build T-feature Type: feature

Comments

@shekhirin
Copy link
Contributor

Component

Forge

Describe the feature you would like

I tried to run tests for the repo I've just cloned and it failed due to missing dependencies:

mev-example git:(curve20220521) ✗ forge test --fork-url $ETH_RPC_URL --fork-block-number 14811888 -vvv
[⠊] Compiling...
Error:
Failed to resolve file: "/Users/shekhirin/Projects/mev-example/lib/forge-std/src/Test.sol": No such file or directory (os error 2).
 Check configured remappings.

After installing them, all worked as expected:

mev-example git:(curve20220521) ✗ forge installmev-example git:(curve20220521) forge test --fork-url $ETH_RPC_URL --fork-block-number 14811888 -vvv
[⠒] Compiling...
[⠔] Compiling 16 files with 0.8.14
[⠒] Solc 0.8.14 finished in 1.35s
Compiler run successful

Running 1 test for test/MEV.t.sol:MEVSimulation
[PASS] testMEV() (gas: 2043432)
Test result: ok. 1 passed; 0 failed; finished in 476.13ms

I think there's two ways we can improve it:

  1. Improve error message because current tells us only about remappings check.
  2. Install and download missing dependencies behind the scenes like cargo does it:
    image

Additional context

No response

@shekhirin shekhirin added the T-feature Type: feature label Jun 23, 2022
@onbjerg onbjerg added this to Foundry Jun 23, 2022
@onbjerg onbjerg moved this to Todo in Foundry Jun 23, 2022
@onbjerg onbjerg added C-forge Command: forge Cmd-forge-build Command: forge build labels Jun 23, 2022
@mattsse
Copy link
Member

mattsse commented Jun 23, 2022

Improve error message because current tells us only about remappings check.

definitely

Install and download missing dependencies behind the scenes like cargo does it:

this will require a bit of work, basically managing a registry, but would be huge, getting rid of git submodules entirely would be amazing.

this would require

  • dependency section in foundry.toml
  • registry model for ~/.foundry/registry/...
  • some libgit2 utils to create checkouts, used some of cargo's code for that in the binder create already
  • ...

@shekhirin
Copy link
Contributor Author

shekhirin commented Jun 23, 2022

this will require a bit of work, basically managing a registry

i think forge install invocation before every command that may require deps would work as an MVP? if it doesn't take too much time of course

@onbjerg
Copy link
Member

onbjerg commented Jun 24, 2022

If we end up doing a dependency section in foundry.toml I'd ask if we could design it in a way where git is one way to install (the only supported way currently) so we can expand it later if needed. There's been quite a few issues/discussions about doing an alternative to Git submodules, so allowing for that in a dependencies section would future proof us a bit

@onbjerg
Copy link
Member

onbjerg commented Aug 4, 2022

@shekhirin Opened a PR for the quickfix in #2617, moved the discussion around better package management into #2618

Repository owner moved this from In Progress to Done in Foundry Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-build Command: forge build T-feature Type: feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants