Closed Subway2023 closed 1 month ago
3. Compile normaly
solc --bin-runtime C.sol
The output here does not match what I'm seeing on my machine. It's not the same as case 2 (that would definitely be a weird bug). It's still different than case 1, but has the same size. This indicates that just metadata hash differs. Indeed, without metadata hash both generate the same runtime bytecode. So this is essentially the same problem as already covered by #14986.
And yeah, the hash can affect the state of memory. Your contract C
is deploying a copy of D
, which means it has to copy it to memory. Since that copy of D
has metadata hash embedded in it, you'll definitely see some differences if you dump memory.
Description
When I compile a specific Solidity program and execute it using --import-ast, there is a situation of inconsistent memory. However, if I add --metadata-hash none, this issue does not occur.
Why does metadata-hash affect memory? I understand that metadata-hash can affect the length of the generated bytecode 14986
Environment
Steps to Reproduce
1. Compile from external AST
2. Compile from external AST without metadata-hash
3. Compile normaly
The bytecode is the same as in 2.
4. Run in EVM
6b59084d: the selector of function test1
5. Memory result
Compile from external AST
Compile normally
Memory data in 196 are different.