mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10227 from ethereum/cmdline-tests-for-linking
Command-line tests for linking
This commit is contained in:
commit
74339ac0d7
1
test/cmdlineTests/linking_solidity/args
Normal file
1
test/cmdlineTests/linking_solidity/args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--bin --bin-runtime --libraries linking_solidity/input.sol:L:0x1234567890123456789012345678901234567890
|
12
test/cmdlineTests/linking_solidity/input.sol
Normal file
12
test/cmdlineTests/linking_solidity/input.sol
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
pragma solidity >=0.0;
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function foo() public {
|
||||||
|
L.f();
|
||||||
|
}
|
||||||
|
}
|
12
test/cmdlineTests/linking_solidity/output
Normal file
12
test/cmdlineTests/linking_solidity/output
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
======= linking_solidity/input.sol:C =======
|
||||||
|
Binary:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
Binary of the runtime part:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
|
||||||
|
======= linking_solidity/input.sol:L =======
|
||||||
|
Binary:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
Binary of the runtime part:
|
||||||
|
<BYTECODE REMOVED>
|
@ -0,0 +1 @@
|
|||||||
|
--bin --bin-runtime --libraries linking_solidity_unresolved_references/input.sol:L1:0x1234567890123456789012345678901234567890
|
@ -0,0 +1,20 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
pragma solidity >=0.0;
|
||||||
|
|
||||||
|
library L1 {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
library L2 {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function foo() public {
|
||||||
|
L1.f();
|
||||||
|
L2.f();
|
||||||
|
L1.f();
|
||||||
|
L2.f();
|
||||||
|
L1.f();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
======= linking_solidity_unresolved_references/input.sol:C =======
|
||||||
|
Binary:
|
||||||
|
<BYTECODE REMOVED>__$8ef13d1c56d5343bf69cf9444272079aa5$__<BYTECODE REMOVED>__$8ef13d1c56d5343bf69cf9444272079aa5$__<BYTECODE REMOVED>
|
||||||
|
|
||||||
|
// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2
|
||||||
|
// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2
|
||||||
|
Binary of the runtime part:
|
||||||
|
<BYTECODE REMOVED>__$8ef13d1c56d5343bf69cf9444272079aa5$__<BYTECODE REMOVED>__$8ef13d1c56d5343bf69cf9444272079aa5$__<BYTECODE REMOVED>
|
||||||
|
|
||||||
|
// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2
|
||||||
|
// $8ef13d1c56d5343bf69cf9444272079aa5$ -> linking_solidity_unresolved_references/input.sol:L2
|
||||||
|
|
||||||
|
======= linking_solidity_unresolved_references/input.sol:L1 =======
|
||||||
|
Binary:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
Binary of the runtime part:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
|
||||||
|
======= linking_solidity_unresolved_references/input.sol:L2 =======
|
||||||
|
Binary:
|
||||||
|
<BYTECODE REMOVED>
|
||||||
|
Binary of the runtime part:
|
||||||
|
<BYTECODE REMOVED>
|
33
test/cmdlineTests/linking_standard_solidity/input.json
Normal file
33
test/cmdlineTests/linking_standard_solidity/input.json
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"language": "Solidity",
|
||||||
|
"sources": {
|
||||||
|
"A": {
|
||||||
|
"content": "
|
||||||
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
pragma solidity >=0.0;
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function foo() public {
|
||||||
|
L.f();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"libraries": {
|
||||||
|
"contract/test.sol": {
|
||||||
|
"L": "0x1234567890123456789012345678901234567890"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"C": ["evm.bytecode.object", "evm.bytecode.linkReferences"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
test/cmdlineTests/linking_standard_solidity/output.json
Normal file
1
test/cmdlineTests/linking_standard_solidity/output.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"language": "Solidity",
|
||||||
|
"sources": {
|
||||||
|
"A": {
|
||||||
|
"content": "
|
||||||
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
pragma solidity >=0.0;
|
||||||
|
|
||||||
|
library L {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function foo() public {
|
||||||
|
L.f();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"libraries": {
|
||||||
|
"contract/test\"test.sol": {
|
||||||
|
"L": "0x1234567890123456789012345678901234567890"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"C": ["evm.bytecode.object", "evm.bytecode.linkReferences"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"language": "Solidity",
|
||||||
|
"sources": {
|
||||||
|
"A": {
|
||||||
|
"content": "
|
||||||
|
// SPDX-License-Identifier: GPL-3.0
|
||||||
|
pragma solidity >=0.0;
|
||||||
|
|
||||||
|
library L1 {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
library L2 {
|
||||||
|
function f() external {}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
function foo() public {
|
||||||
|
L1.f();
|
||||||
|
L2.f();
|
||||||
|
L1.f();
|
||||||
|
L2.f();
|
||||||
|
L1.f();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"libraries": {
|
||||||
|
"contract/test.sol": {
|
||||||
|
"L1": "0x1234567890123456789012345678901234567890"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"C": ["evm.bytecode.object", "evm.bytecode.linkReferences"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
{"contracts":{"A":{"C":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{"A":{"L2":[{"length":20,"start":184},{"length":20,"start":368}]}},"object":"<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>__$622b2f540b6a16ff5db7bea656ad8fcf4f$__<BYTECODE REMOVED>","opcodes":"<OPCODES REMOVED>","sourceMap":"<SOURCEMAP REMOVED>"}}}}},"sources":{"A":{"id":0}}}
|
20
test/cmdlineTests/linking_standard_yul/input.json
Normal file
20
test/cmdlineTests/linking_standard_yul/input.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"language": "Yul",
|
||||||
|
"sources": {
|
||||||
|
"A": {
|
||||||
|
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test.sol:L\") } }"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"libraries": {
|
||||||
|
"contract/test.sol": {
|
||||||
|
"L": "0x1234567890123456789012345678901234567890"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputSelection": {
|
||||||
|
"*": {
|
||||||
|
"*": ["evm.bytecode.object", "evm.bytecode.linkReferences"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
test/cmdlineTests/linking_standard_yul/output.json
Normal file
1
test/cmdlineTests/linking_standard_yul/output.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"errors":[{"component":"general","formattedMessage":"Field \"settings.libraries\" cannot be used for Yul.","message":"Field \"settings.libraries\" cannot be used for Yul.","severity":"error","type":"JSONError"}]}
|
1
test/cmdlineTests/linking_strict_assembly/args
Normal file
1
test/cmdlineTests/linking_strict_assembly/args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--strict-assembly --libraries contract/test.sol:L:0x1234567890123456789012345678901234567890
|
1
test/cmdlineTests/linking_strict_assembly/err
Normal file
1
test/cmdlineTests/linking_strict_assembly/err
Normal file
@ -0,0 +1 @@
|
|||||||
|
Warning: Yul is still experimental. Please use the output with care.
|
5
test/cmdlineTests/linking_strict_assembly/input.yul
Normal file
5
test/cmdlineTests/linking_strict_assembly/input.yul
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr := linkersymbol("contract/test.sol:L")
|
||||||
|
}
|
||||||
|
}
|
18
test/cmdlineTests/linking_strict_assembly/output
Normal file
18
test/cmdlineTests/linking_strict_assembly/output
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
======= linking_strict_assembly/input.yul (EVM) =======
|
||||||
|
|
||||||
|
Pretty printed source:
|
||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr := linkersymbol("contract/test.sol:L")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary representation:
|
||||||
|
73__$f919ba91ac99f96129544b80b9516b27a8$__50
|
||||||
|
|
||||||
|
Text representation:
|
||||||
|
linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612")
|
||||||
|
/* "linking_strict_assembly/input.yul":22:85 */
|
||||||
|
pop
|
@ -0,0 +1 @@
|
|||||||
|
--strict-assembly --libraries contract/test.sol:L1:0x1234567890123456789012345678901234567890
|
@ -0,0 +1 @@
|
|||||||
|
Warning: Yul is still experimental. Please use the output with care.
|
@ -0,0 +1,6 @@
|
|||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr1 := linkersymbol("contract/test.sol:L1")
|
||||||
|
let addr2 := linkersymbol("contract/test.sol:L2")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
======= linking_strict_assembly_unresolved_references/input.yul (EVM) =======
|
||||||
|
|
||||||
|
Pretty printed source:
|
||||||
|
object "a" {
|
||||||
|
code {
|
||||||
|
let addr1 := linkersymbol("contract/test.sol:L1")
|
||||||
|
let addr2 := linkersymbol("contract/test.sol:L2")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Binary representation:
|
||||||
|
<BYTECODE REMOVED>__$05b0326038374a21e0895480a58bda0768$__<BYTECODE REMOVED>__$fb58009a6b1ecea3b9d99bedd645df4ec3$__5050
|
||||||
|
|
||||||
|
Text representation:
|
||||||
|
linkerSymbol("05b0326038374a21e0895480a58bda0768cdcc04c8d18f154362d1ca5223d245")
|
||||||
|
/* "linking_strict_assembly_unresolved_references/input.yul":32:81 */
|
||||||
|
linkerSymbol("fb58009a6b1ecea3b9d99bedd645df4ec308f17bc0087e5f39d078f77f809177")
|
||||||
|
/* "linking_strict_assembly_unresolved_references/input.yul":22:145 */
|
||||||
|
pop
|
||||||
|
pop
|
Loading…
Reference in New Issue
Block a user