remove superfluous byte swap in linkersymbol builtin translation (#455)

- Remove the superfluous byte swap in the `linkersymbol` builtin
translation.
- Support testing the `linkersymbol` builtin translation in the runner
specs.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus authored and GitHub committed 2026-01-15 12:43:46 +01:00
1 parent 2d85ca9755
commit 289af875db
12 files changed
+498 -345

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
library L {
function f() public returns(uint r) {
r = 10;
}
}
+59
View File
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2;
import "contracts/Library.sol";
/* runner.json
{
"differential": false,
"actions": [
{
"Instantiate": {
"origin": "Bob",
"code": {
"Solidity": {
"contract": "L",
"path": "contracts/Library.sol"
}
}
}
},
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "Linked",
"path": "contracts/Linked.sol",
"libraries": {
"contracts/Library.sol": {
"L": "0x17bb6d1a8161a52422f86e4460600bdbefc1becd"
}
}
}
}
}
},
{
"Call": {
"dest": {
"Instantiated": 1
},
"data": "dffeadd0"
}
},
{
"VerifyCall": {
"success": true,
"output": "000000000000000000000000000000000000000000000000000000000000000a"
}
}
]
}
*/
contract Linked {
function main() public returns (uint) {
return L.f();
}
}
+9 -3
View File
@@ -17,7 +17,7 @@ impl Contract {
pub fn build(calldata: Vec<u8>, name: &'static str, code: &str) -> Self {
Self {
name,
evm_runtime: compile_evm_bin_runtime(name, code),
evm_runtime: compile_evm_bin_runtime(name, code, Default::default()),
pvm_runtime: compile_blob(name, code),
calldata,
yul: compile_to_yul(name, code, true),
@@ -27,8 +27,14 @@ impl Contract {
pub fn build_size_opt(calldata: Vec<u8>, name: &'static str, code: &str) -> Self {
Self {
name,
evm_runtime: compile_evm_bin_runtime(name, code),
pvm_runtime: compile_blob_with_options(name, code, true, OptimizerSettings::size()),
evm_runtime: compile_evm_bin_runtime(name, code, Default::default()),
pvm_runtime: compile_blob_with_options(
name,
code,
true,
OptimizerSettings::size(),
Default::default(),
),
calldata,
yul: compile_to_yul(name, code, true),
}
+3
View File
@@ -67,6 +67,7 @@ test_spec!(memory_bounds, "MemoryBounds", "MemoryBounds.sol");
test_spec!(selfdestruct, "Selfdestruct", "Selfdestruct.sol");
test_spec!(clz, "CountLeadingZeros", "CountLeadingZeros.sol");
test_spec!(call_gas, "CallGas", "CallGas.sol");
test_spec!(linker_symbol, "Linked", "Linked.sol");
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
vec![Instantiate {
@@ -78,6 +79,7 @@ fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
path: Some(path.into()),
contract: contract.to_string(),
solc_optimizer: None,
libraries: Default::default(),
},
data: vec![],
salt: OptionalHex::default(),
@@ -372,6 +374,7 @@ fn ext_code_size() {
path: Some("contracts/Baseline.sol".into()),
contract: "Baseline".to_string(),
solc_optimizer: None,
libraries: Default::default(),
},
data: vec![],
salt: OptionalHex::from([0; 32]),