Add sstore to linker tests to prevent the address from being optimized out

This commit is contained in:
Kamil Śliwak 2021-04-22 16:08:32 +02:00
parent 703a73f949
commit 9d08b5001f
15 changed files with 85 additions and 18 deletions

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test.sol:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test.sol:L\") sstore(0, addr) } }"
}
},
"settings": {

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test\\\".sol:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"contract/test\\\".sol:L\") sstore(0, addr) } }"
}
},
"settings": {

View File

@ -2,7 +2,7 @@
"language": "Yul",
"sources": {
"A": {
"content": "object \"a\" { code { let addr1 := linkersymbol(\"contract/test.sol:L1\") let addr2 := linkersymbol(\"contract/test.sol:L2\") } }"
"content": "object \"a\" { code { let addr1 := linkersymbol(\"contract/test.sol:L1\") let addr2 := linkersymbol(\"contract/test.sol:L2\") sstore(0, addr1) sstore(1, addr2) } }"
}
},
"settings": {

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("contract/test.sol:L")
sstore(0, addr)
}
}

View File

@ -5,14 +5,21 @@ Pretty printed source:
object "a" {
code {
let addr := linkersymbol("contract/test.sol:L")
sstore(0, addr)
}
}
Binary representation:
73123456789012345678901234567890123456789050
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612")
/* "linking_strict_assembly/input.yul":22:85 */
/* "linking_strict_assembly/input.yul":98:102 */
dup1
/* "linking_strict_assembly/input.yul":95:96 */
0x00
/* "linking_strict_assembly/input.yul":88:103 */
sstore
/* "linking_strict_assembly/input.yul":22:109 */
pop

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("library.sol:L")
sstore(0, addr)
}
}

View File

@ -1,5 +1,6 @@
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}

View File

@ -3,14 +3,23 @@
Pretty printed source:
object "a" {
code { let addr := linkersymbol("L") }
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
Binary representation:
73123456789012345678901234567890123456789050
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8")
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":22:67 */
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":80:84 */
dup1
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":77:78 */
0x00
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":70:85 */
sstore
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":22:91 */
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
7311111111111111111111111111111111111111117322222222222222222222222222222222222222225050
73111111111111111111111111111111111111111173222222222222222222222222222222222222222281600055806001555050
Text representation:
linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
/* "linking_strict_assembly_same_library_name_different_files/input.yul":32:75 */
linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
/* "linking_strict_assembly_same_library_name_different_files/input.yul":22:133 */
/* "linking_strict_assembly_same_library_name_different_files/input.yul":146:151 */
dup2
/* "linking_strict_assembly_same_library_name_different_files/input.yul":143:144 */
0x00
/* "linking_strict_assembly_same_library_name_different_files/input.yul":136:152 */
sstore
/* "linking_strict_assembly_same_library_name_different_files/input.yul":171:176 */
dup1
/* "linking_strict_assembly_same_library_name_different_files/input.yul":168:169 */
0x01
/* "linking_strict_assembly_same_library_name_different_files/input.yul":161:177 */
sstore
/* "linking_strict_assembly_same_library_name_different_files/input.yul":22:183 */
pop
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("library1.sol:L")
let addr2 := linkersymbol("library2.sol:L")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__5050
73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__81600055806001555050
Text representation:
linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec")
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":32:75 */
linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f")
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":22:133 */
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":146:151 */
dup2
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":143:144 */
0x00
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":136:152 */
sstore
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":171:176 */
dup1
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":168:169 */
0x01
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":161:177 */
sstore
/* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":22:183 */
pop
pop

View File

@ -2,5 +2,7 @@ object "a" {
code {
let addr1 := linkersymbol("contract/test.sol:L1")
let addr2 := linkersymbol("contract/test.sol:L2")
sstore(0, addr1)
sstore(1, addr2)
}
}

View File

@ -6,17 +6,31 @@ object "a" {
code {
let addr1 := linkersymbol("contract/test.sol:L1")
let addr2 := linkersymbol("contract/test.sol:L2")
sstore(0, addr1)
sstore(1, addr2)
}
}
Binary representation:
73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__5050
73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__81600055806001555050
Text representation:
linkerSymbol("05b0326038374a21e0895480a58bda0768cdcc04c8d18f154362d1ca5223d245")
/* "linking_strict_assembly_unresolved_references/input.yul":32:81 */
linkerSymbol("fb58009a6b1ecea3b9d99bedd645df4ec308f17bc0087e5f39d078f77f809177")
/* "linking_strict_assembly_unresolved_references/input.yul":22:145 */
/* "linking_strict_assembly_unresolved_references/input.yul":158:163 */
dup2
/* "linking_strict_assembly_unresolved_references/input.yul":155:156 */
0x00
/* "linking_strict_assembly_unresolved_references/input.yul":148:164 */
sstore
/* "linking_strict_assembly_unresolved_references/input.yul":183:188 */
dup1
/* "linking_strict_assembly_unresolved_references/input.yul":180:181 */
0x01
/* "linking_strict_assembly_unresolved_references/input.yul":173:189 */
sstore
/* "linking_strict_assembly_unresolved_references/input.yul":22:195 */
pop
pop

View File

@ -924,7 +924,7 @@ BOOST_AUTO_TEST_CASE(linking_yul)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"fileB:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"fileB:L\") sstore(0, addr) } }"
}
}
}
@ -956,7 +956,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_empty_link_reference)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"\") sstore(0, addr) } }"
}
}
}
@ -988,7 +988,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_no_filename_in_link_reference)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"L\") sstore(0, addr) } }"
}
}
}
@ -1020,7 +1020,7 @@ BOOST_AUTO_TEST_CASE(linking_yul_same_library_name_different_files)
},
"sources": {
"fileA": {
"content": "object \"a\" { code { let addr := linkersymbol(\"fileC:L\") } }"
"content": "object \"a\" { code { let addr := linkersymbol(\"fileC:L\") sstore(0, addr) } }"
}
}
}