Closed MattPereira closed 1 month ago
It seems to me that there are three options:
I like the last solution better than the first but I feel like the easiest solution is just to use the correct name for the test from the start. Any reason why we can't do this? If we were saving the files for later diagnosing why it didn't work and such then it would make sense for the file to be marked by the exact contractAddress but otherwise I don't see a need.
Is option 1 suggesting we reach into the test import for the corresponding submitted challenge programatically to change the import statement before running the test?
For option 2 we could ammend install script to yeet any file inside foundry/contracts
which would free up the namespace, but I wonder if multiple submissions happening close together would cause some sort of autorenaming like WrappedETH copy.sol
when the script tries to write the same file name twice
For option 3 I only partially follow. How would the unmodified test have access to the download-<contract_address>.sol
? Or like how would it point at it from within the test without knowing the filename ahead of time?
Might make sense to hop on a call sometime to discuss this one.
@MattPereira Reach out on TG to set up a time to discuss this.
@MattPereira Just wanted you to see how we ended up going about this. https://github.com/BuidlGuidl/eth-tech-tree-challenges/pull/61 Basically we can use
CONTRACT_PATH="download-0x12345..." yarn foundry:test
To target a specific contract each time we run the command.
Overview
We need to figure out how to run the challenge tests against the contract we are fetching from Etherscan during challenge submission.
The foundry tests for challenges may need to be modified in order for it to be possible to import the downloaded contract. The test is currently passing because downloaded repo contains passing contract code, but we need to figure out how to make the test run against the downloaded contract instead of the default contract.
Here is snippet of viable solution used for speedrun ethereum that was built with hardhat