Open
Description
Description
In Standard JSON library addresses for linking require providing a source unit name and a library name as two separate components. For linking, these two parts are joined with a colon so even if the source unit name is empty, the colon is there.
This is different from the CLI where you can provide both L
and :L
in the --libraries
option and for the former will let you match a reference without a colon.
I don't see a good way to support unqualified library names in the current Standard JSON structure so maybe we should just disallow unqualified library names in linkersymbol()
. This would be a breaking change though.
Environment
- Compiler version: 0.8.9 (
develop
)
Steps to Reproduce
input.json
:
{
"language": "Yul",
"sources": {
"contract.sol": {"content": "{ sstore(0, linkersymbol(\"L\")) }"}
},
"settings": {
"outputSelection": {"*": {"*": ["evm.bytecode"]}},
"libraries": {
"": {
"L": "0x1234567890123456789012345678901234567890"
}
}
}
}
solc --json-indent 4 --standard-json input.json
Output:
{
"contracts":
{
"contract.sol":
{
"object":
{
"evm":
{
"bytecode":
{
"functionDebugData": {},
"generatedSources": [],
"linkReferences":
{
"":
{
"L":
[
{
"length": 20,
"start": 1
}
]
}
},
"object": "73__$8aa64f937099b65a4febc243a5ae0f2d64$__600055",
"opcodes": "PUSH20 0x0 PUSH1 0x0 SSTORE ",
"sourceMap": "12:17:0:-:0;9:1;2:28"
}
}
}
}
}
}
If you change linkersymbol("L"))
in the input to linkersymbol(":L"))
, the unlinked reference disappears.