Closed manuelwedler closed 1 week ago
I tried a few variations of the empty sources given to solc. So in the following every path stands for [path]: { "content": "" }
in the sources of the standard json input. The non-empty sources were always the same as the ones generated by the server for the user's zip file. Everything was compiled with solc 0.8.19.
build-info/
and build-info/build-info/
build-info/
and build-info/build-info/
and build-info/build-info/build-info/
build-info/
and build-info2/
build-info/
build-info/
and empty
build-info/
and empty/
build-info/
and empty1/
and empty2/
Since giving no empty sources also produces the correct bytecode, my guess here is that hardhat didn't add any empty source to the compiler input and the build-info/
folder is just a leftover from the zip file creation. But this is hard to tell without having the original hardhat project.
Unfortunately, the user didn't respond. Without the original hardhat project we cannot debug it further. Closing due to this.
The Solidity issue this problem originates from is here: https://github.com/ethereum/solidity/issues/14494 It should be fixed in newer Solidity versions
Original problem
A user reported an issue when verifying from a hardhat build:
The UI displays the following error:
After debugging, I could figure out that issue comes from the zip being created from a Mac. Mac adds a
__MACOSX
folder to a zip file which is only visible on non-Mac machines. This folder is also not inteded to be read on a non-Mac machine.The follwing happens when uploading the zip file. The server experiences a "extra-file-input-bug", and therefore adds all given source files to the compilation input. The solc compiler simply cannot read the folder and throws the above error.
First fix
I could fix the error message by excluding
__MACOSX
folders in theunzip
function invalidation.ts
of lib-sourcify. We don't want the server to read such folders, so we can simply ignore it when unzipping.Fix: #1534
Unfortunately, the server still cannot verify the contract using the zip after this fix.
Follow up problem: different bytecodes from additional empty sources
I could only verify the contracts after adding another folder level in the zip file (
build-info/build-info/
). This means the input given to solc contains an additional source:"build-info/build-info/": { "content": "" },
This might be an example of the
extra-file-input-bug
. Even though the content of the additional source is empty, the two inputs give different bytecodes.As we can verify the contract with some change to the compiler input, we should investigate this further and make it possible to verify this contract without changing the structure of the zip file.
Tasks
To continue debugging, try the following:
YulException: Variable var_suToken is 1 too deep in the stack
)