Closed tash-2s closed 6 months ago
Thank you for your review!
I've created a companion PR in foundry with this patch. Also, I have confirmed that the tests in foundry passed successfully.
The workflow test for this PR failed due to a failure in nextest installation. As this issue is unrelated to the changes made, re-running the test should resolve it. https://github.com/foundry-rs/compilers/actions/runs/7331166894/job/19979490471
Amazing work.
Doesn't this PR also address issue https://github.com/foundry-rs/foundry/issues/3507?
@PaulRBerg I haven't looked into it deeply, but it seems like a different matter from this PR and #35, as they don't involve --via-ir
.
Currently, Foundry projects containing Solidity files outside the project root directory face contract verification failures on block explorers. This issue occurs from the Standard JSON including unusable source paths for external files, represented as full absolute paths in their host file systems.
This PR addresses the issue by improving the path conversion process. For files not located under the project root directory, relative parent directory paths (
..
) are used, enabling the compiler to find the files within the json.Steps to reproduce the issue are detailed in the linked issue above. Additionally, a test case representing that scenario has been added.
With this change, the json created in the reproduction scenario will appear as follows:
The source path is now aligned with the project root.
I have successfully deployed and verified the contract on Etherscan using this change.
forge create --rpc-url "wss://ethereum-holesky.publicnode.com" --verify --verifier-url "https://api-holesky.etherscan.io/api" --etherscan-api-key "..." --private-key "..." src/Counter.sol:Counter
https://holesky.etherscan.io/address/0xe08c332706185521fc8bc2b224f67adf814b1880#code