implement immutable variables codegen

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2024-10-09 03:37:56 +02:00
parent 77fe683f18
commit 0e6a6d12c3
17 changed files with 843 additions and 506 deletions
+8 -8
View File
@@ -1,10 +1,10 @@
{
"Baseline": 912,
"Computation": 4413,
"DivisionArithmetics": 40689,
"ERC20": 54374,
"Events": 1726,
"FibonacciIterative": 3015,
"Flipper": 3612,
"SHA1": 32865
"Baseline": 962,
"Computation": 4463,
"DivisionArithmetics": 40756,
"ERC20": 54427,
"Events": 1792,
"FibonacciIterative": 3065,
"Flipper": 3665,
"SHA1": 32923
}
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
/* runner.json
{
"differential": true,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "Immutables"
}
},
"data": "000000000000000000000000000000000000000000000000000000000000007b"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "c2985578"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "febb0f7e"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "7b6a8777"
}
},
{
"Call": {
"dest": {
"Instantiated": 0
}
}
}
]
}
*/
contract Immutables {
uint public immutable foo;
uint public immutable bar;
uint public immutable zoo;
constructor(uint _foo) payable {
foo = _foo;
bar = foo + 1;
zoo = bar + 2;
}
fallback() external {
assert(foo > 0);
assert(bar > 0);
assert(zoo > 0);
}
}
+1
View File
@@ -42,6 +42,7 @@ test_spec!(create, "CreateB", "Create.sol");
test_spec!(call, "Caller", "Call.sol");
test_spec!(transfer, "Transfer", "Transfer.sol");
test_spec!(return_data_oob, "ReturnDataOob", "ReturnDataOob.sol");
test_spec!(immutables, "Immutables", "Immutables.sol");
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
vec![Instantiate {