You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think I have found a bug in the way the compiler maps sources. The sources in the artifact produced by the build are different than the source paths in the verify json output. I noticed this issue when trying to verify an existing smart contract. I figured out that the reason that the verification was failing was because the standard_json_input compilation was using a different source which was a slightly different version of openzeppelin-contracts. It appears that it was using a version of openzeppelin-contracts that was within another dependency instead of the openzeppelin-contracts that existed in the root of the lib directory.
I would love to take a crack at fixing this myself and opening a PR, but I wanted to start a conversation beforehand to check in on if this outcome is expected for any reason.
The text was updated successfully, but these errors were encountered:
Hello,
I think I have found a bug in the way the compiler maps sources. The sources in the artifact produced by the build are different than the source paths in the verify json output. I noticed this issue when trying to verify an existing smart contract. I figured out that the reason that the verification was failing was because the
standard_json_input
compilation was using a different source which was a slightly different version ofopenzeppelin-contracts
. It appears that it was using a version of openzeppelin-contracts that was within another dependency instead of the openzeppelin-contracts that existed in the root of the lib directory.Source Pathing Example
Build source paths (
compile
)src/Test.sol
lib/PBT/src/PBTSimple.sol
lib/PBT/lib/openzeppelin-contracts/contracts/access/Ownable.sol
lib/PBT/lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol
Verify source paths (
standard_json_input
)src/Test.sol
lib/PBT/src/PBTSimple.sol
lib/openzeppelin-contracts/contracts/access/Ownable.sol
lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol
Minimal steps to reproduce
forge init
forge install OpenZeppelin/openzeppelin-contracts@v4.7.0
forge install chiru-labs/PBT
Test.sol
forge build
forge verify-contract \ --verifier etherscan --show-standard-json-input \ --constructor-args $(cast abi-encode "constructor(string,string)" "Test" "Test") \ 0x000000000000000000000000000000000000dEaD src/Test.sol:Test
Versions & Other details
forge 0.2.0 (63fff3510 2024-04-21T21:59:02.827682000Z)
The text was updated successfully, but these errors were encountered: