After much debugging trying to get the tenderly:verify function to work I've realized that these libraries are incompatible. I kept getting the error:
Error: There are multiple definitions of libraries the contract should use. One is defined in the verify request and the other as an compiler config override. Please remove one of them.
Due to these lines of code in util.js:
if (compiler.settings.libraries !== undefined && compiler.settings.libraries !== null) {
console.log(compiler.settings.libraries);
throw new Error(`There are multiple definitions of libraries the contract should use. One is defined in the verify request and the other as an compiler config override. Please remove one of them.`);
}
After logging the compiler.settings.libraries object I realized a cache buster was getting injected and causing this error to get thrown. Eventually I pinpointed it down to be a result of hardhat-preprocessor injecting this value.
Please consider rethinking how this is handled to avoid others from going down the same rabbit hole I had to 🙏
For context these are the relevant lines in hardhat-preprocessor index.js
for (const compiler of hre.config.solidity.compilers) {
compiler.settings.libraries = compiler.settings.libraries || {};
compiler.settings.libraries[''] = compiler.settings.libraries[''] || {};
compiler.settings.libraries[''] = {
__CACHE_BREAKER__: cacheBreaker,
};
}
content = transform(linePreProcessor.transform, { absolutePath }, content);
After much debugging trying to get the
tenderly:verifyfunction to work I've realized that these libraries are incompatible. I kept getting the error:Error: There are multiple definitions of libraries the contract should use. One is defined in the verify request and the other as an compiler config override. Please remove one of them.Due to these lines of code in util.js:
After logging the compiler.settings.libraries object I realized a cache buster was getting injected and causing this error to get thrown. Eventually I pinpointed it down to be a result of hardhat-preprocessor injecting this value.
Please consider rethinking how this is handled to avoid others from going down the same rabbit hole I had to 🙏
For context these are the relevant lines in hardhat-preprocessor index.js