The `experimental` flag in CBOR metadata is not set when targeting experimental EVM versions
Description
Our CBOR metadata includes an experimental flag. Currently we set it when compiling Generic Solidity code (pragma experimental solidity) and when using the EOF backend:
https://github.com/ethereum/solidity/blob/03ad799ebbbca35aa8301797a96ac2c3dd027572/libsolidity/interface/CompilerStack.cpp#L1932-L1933
However, those are not the only cases where the output of the compiler is experimental though. Most notably, compilation to yet unreleased EVM versions like Prague, Osaka or Amsterdam is always considered experimental. The flag should be set in such cases as well.
Note that just like for EOF, the functionality should be covered with a test (#15663).
Environment
- Compiler version: 0.8.28
Steps to Reproduce
echo 'contract C {}' | solc/solc - --evm-version prague --bin
Then inspect the CBOR data included at the end of the binary.
@kuzdogan Does sourcify make any use of this flag?
I wonder why it's even in CBOR metadata and not in the JSON metadata.
@cameel No particular use case from our side. And good point, this should've been in the metadata.json too.
Added the point to https://github.com/ethereum/sourcify/issues/1523
Another situation where we should be setting the flag is AST import, which is still considered experimental. Ideally we'd do that for EVM assembly import as well, but there we use the CBOR metadata provided from the outside (though, since the flag is in CBOR rather than JSON, it would be technically feasible to still set it in this mode if we really wanted to).