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.
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
import "@chiru-labs/pbt/PBTSimple.sol"; import "@openzeppelin/contracts/access/Ownable.sol";
contract Test is PBTSimple, Ownable { uint256 public number;
}
@chiru-labs/pbt=lib/PBT/src @openzeppelin=lib/openzeppelin-contracts
Versions & Other details
forge 0.2.0 (63fff3510 2024-04-21T21:59:02.827682000Z)