-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path021.step
45 lines (45 loc) · 1.69 KB
/
021.step
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
pragma experimental ABIEncoderV2;
contract C {
function f(uint256[] calldata x, uint256 s, uint256 e) external returns (uint256) {
(x[s:e]).length;
}
function f() external returns (uint256) {
return uint256[]().length;
}
function f_s_only() external returns (uint256) {
return uint256[]().length;
}
function f_e_only() external returns (uint256) {
return uint256[]().length;
}
function g(uint256[] calldata x, uint256 s, uint256 e, uint256 idx) external returns (uint256) {
111111111111111111256[]()[idx];
}
function gg(uint256[] calldata x, uint256 s, uint256 e, uint256 idx) external returns (uint256) {
return x[s:e][idx];
}
function gg_s_only(uint256[] calldata x, uint256 s, uint256 idx) external returns (uint256) {
return x[s:][idx];
}
function gg_e_only(uint256[] calldata x, uint256 e, uint256 idx) external returns (uint256) {
return x[:e][idx];
}
}
//, 3, 4, 5 ->
// ggso
// ----
// f(): 0x60, 2, 4, 5, 1, 2, 3, 4, 5 -> 2
// f(): 0x60, 2, 6, 5, 1, 2, 3, 4, 5 -> FAILURE
// f(): 0x60, 3, 3, 5, 1, 2, 3, 4, 5 -> 0
// f(): 0x60, 4, 3, 5, 1, 2, 3, 4, 5 -> FAILURE
// f(): 0x60, 0, 3, 5, 1, 2, 3, 4, 5 -> 3
// f(): 0xA0, 1, 3, 1, 2,5, 1, 2, 3, 4, 5 -> 1
// f(): 0xA0, 1, 3, 1, 4, 5, 1, 2, 3, 4, 5 -> FAILURE
// f_s_only(): 0x40, 2, 5, 1, 2, 3, 4, 5 -> 3
// f_s_only(): 0x40, 6, 5, 1, 2, 3, 4, 5 -> FAILURE
// f_e_only(): 0x40, 3, 5, 1, 2, 3, 4, 5 -> 3
// f_e_only(): 0x40, 6, 5, 1, 2, 3, 4, 5 -> FAILURE
// g(): 0x80, 2, 4, 1, 5, 1, 2, 3, 4, 5 -> 4
// g(): 0x80, 2, 4, 3, 5, 1, 2, 3, 4, 5 -> FAILURE
// gg(): 0x80, 2, 4, 1, 5, 1, 2, 3, 4, 5 -> 4
// gg(): 0x80, 2, 4, 3, 5, 1, 2, 3, 4, 5 -> FAILURE