Skip to content

Commit 2cf089d

Browse files
02.02.26 Release
02.02.26 Release a52bf53a3af588bf44fb096b74d14aa12ce23259
2 parents 70ed750 + fe9f46e commit 2cf089d

File tree

380 files changed

+6647
-2547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

380 files changed

+6647
-2547
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
contract C {
2+
3+
function narrow(int64 x) public pure returns (int32) {
4+
int32 y = int32(x);
5+
return y;
6+
}
7+
8+
function unsignedToSigned(uint x) public pure returns (int) {
9+
return int(x);
10+
}
11+
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rule check1(int64 x) {
2+
env e;
3+
assert x == narrow(e, x);
4+
}
5+
6+
rule check2(uint x) {
7+
env e;
8+
assert x == unsignedToSigned(e, x);
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
files: [
3+
"C.sol",
4+
],
5+
verify: "C:C.spec",
6+
"solc": "solc8.28",
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
files: [
3+
"C.sol",
4+
],
5+
verify: "C:C.spec",
6+
"solc": "solc8.28",
7+
"assume_no_casting_overflow": true
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rules": {
3+
"check1": "FAIL",
4+
"check2": "FAIL"
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rules": {
3+
"check1": "SUCCESS",
4+
"check2": "SUCCESS"
5+
}
6+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import "Immutable.sol";
2+
3+
contract Base1 is Immutable {
4+
uint inExtension1;
5+
uint inExtension2;
6+
7+
address extension1Address; // Address of contract Extension1
8+
9+
constructor(address _extension1Address) {
10+
extension1Address = _extension1Address;
11+
}
12+
13+
function callSetInExtension1(uint _num) external {
14+
address(this).call(abi.encodeWithSignature("setInExtension1(uint256)", _num));
15+
}
16+
17+
function callGetInExtension1() external returns (uint) {
18+
(bool success, bytes memory b) = address(this).call(abi.encodeWithSignature("getInExtension1()"));
19+
return abi.decode(b, (uint));
20+
}
21+
22+
function callSetInExtension2(uint _num) external {
23+
address(this).call(abi.encodeWithSignature("setInExtension2(uint256)", _num));
24+
}
25+
26+
function callGetInExtension2() external returns (uint) {
27+
(bool success, bytes memory b) = address(this).call(abi.encodeWithSignature("getInExtension2()"));
28+
return abi.decode(b, (uint));
29+
}
30+
31+
// Fallback function will handle all calls that don't match a function signature
32+
fallback() external payable {
33+
// Delegate the call to contract B
34+
(bool success, ) = extension1Address.delegatecall(msg.data);
35+
require(success, "Delegatecall failed");
36+
}
37+
38+
function getImmut() public view returns (bytes32) {
39+
return IMMUT1;
40+
}
41+
42+
bool b;
43+
function flipB() public {
44+
b = !b;
45+
}
46+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
contract Base2 {
2+
uint unused;
3+
uint inExtension2;
4+
5+
address extension2Address; // Address of contract Extension1
6+
7+
constructor(address _extension2Address) {
8+
extension2Address = _extension2Address;
9+
}
10+
11+
function callSetInExtension2(uint _num) external {
12+
address(this).call(abi.encodeWithSignature("setInExtension2(uint256)", _num));
13+
}
14+
15+
function callGetInExtension2() external returns (uint) {
16+
(bool success, bytes memory b) = address(this).call(abi.encodeWithSignature("getInExtension2()"));
17+
return abi.decode(b, (uint));
18+
}
19+
20+
// Fallback function will handle all calls that don't match a function signature
21+
fallback() external payable {
22+
// Delegate the call to contract B
23+
(bool success, ) = extension2Address.delegatecall(msg.data);
24+
require(success, "Delegatecall failed");
25+
}
26+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"files": [
3+
"Base1.sol",
4+
"Base2.sol",
5+
"Extension1.sol",
6+
"Extension2.sol",
7+
],
8+
"link": [
9+
"Extension1:base1=Base1",
10+
],
11+
"solc": "solc8.25",
12+
"verify": "Base1:test.spec",
13+
"contract_extensions": {
14+
"Base1": [
15+
{
16+
"extension": "Extension1",
17+
"exclude": ["IMMUT1", "IMMUT2"],
18+
},
19+
{
20+
"extension": "Extension2",
21+
"exclude": [],
22+
},
23+
],
24+
"Base2": [
25+
{
26+
"extension": "Extension2",
27+
"exclude": [],
28+
},
29+
],
30+
},
31+
"rule_sanity": "basic",
32+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import "Immutable.sol";
2+
import {Base1} from "Base1.sol";
3+
4+
contract Extension1 is Immutable {
5+
Base1 private immutable base1;
6+
uint inExtension1;
7+
uint inExtension2;
8+
9+
address extension2Address;
10+
11+
// Function that the base contract will delegate to
12+
function setInExtension1(uint n) public {
13+
inExtension1 = n;
14+
}
15+
16+
function getInExtension1() public view returns (uint) {
17+
return inExtension1;
18+
}
19+
20+
fallback() external payable {
21+
// Delegate the call to contract B
22+
(bool success, ) = extension2Address.delegatecall(msg.data);
23+
require(success, "Delegatecall failed");
24+
}
25+
26+
function getExtensionImmut() public view returns (bytes32) {
27+
return IMMUT1;
28+
}
29+
30+
function callFlipB() public {
31+
base1.flipB();
32+
}
33+
}

0 commit comments

Comments
 (0)