This repository was archived by the owner on Aug 20, 2024. It is now read-only.
File tree 3 files changed +78
-71
lines changed
3 files changed +78
-71
lines changed Original file line number Diff line number Diff line change @@ -20,82 +20,89 @@ To assemble `src/main.etk` you will need to invoke `eas`:
20
20
21
21
``` console
22
22
$ eas src/main.etk
23
- 3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762016da0810690815414603c575f5ffd5b62016da001545f5260205ff35b5f5ffd5b62016da042064281555f359062016da0015500
23
+ 3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500
24
24
```
25
25
26
26
It's also possible to remove the ` etk ` preproccessing by doing a roundtrip --
27
27
first assembling the program, then disassembling the program:
28
28
29
29
``` console
30
30
$ disease --code 0x$( eas src/main.etk)
31
- 0: caller
32
- 1: push20 0xfffffffffffffffffffffffffffffffffffffffe
33
- 16: eq
34
- 17: push1 0x4d
35
- 19: jumpi
36
-
37
- 1a: push1 0x20
38
- 1c: calldatasize
39
- 1d: eq
40
- 1e: push1 0x24
41
- 20: jumpi
42
-
43
- 21: push0
44
- 22: push0
45
- 23: revert
46
-
47
- 24: jumpdest
48
- 25: push0
49
- 26: calldataload
50
- 27: dup1
51
- 28: iszero
52
- 29: push1 0x49
53
- 2b: jumpi
54
-
55
- 2c: push3 0x016da0
56
- 30: dup2
57
- 31: mod
58
- 32: swap1
59
- 33: dup2
60
- 34: sload
61
- 35: eq
62
- 36: push1 0x3c
63
- 38: jumpi
64
-
65
- 39: push0
66
- 3a: push0
67
- 3b: revert
68
-
69
- 3c: jumpdest
70
- 3d: push3 0x016da0
71
- 41: add
72
- 42: sload
31
+ 0: push1 0x61
32
+ 2: dup1
33
+ 3: push1 0x09
34
+ 5: push0
35
+ 6: codecopy
36
+ 7: push0
37
+ 8: return
38
+
39
+ 9: caller
40
+ a: push20 0xfffffffffffffffffffffffffffffffffffffffe
41
+ 1f: eq
42
+ 20: push1 0x4d
43
+ 22: jumpi
44
+
45
+ 23: push1 0x20
46
+ 25: calldatasize
47
+ 26: eq
48
+ 27: push1 0x24
49
+ 29: jumpi
50
+
51
+ 2a: push0
52
+ 2b: push0
53
+ 2c: revert
54
+
55
+ 2d: jumpdest
56
+ 2e: push0
57
+ 2f: calldataload
58
+ 30: dup1
59
+ 31: iszero
60
+ 32: push1 0x49
61
+ 34: jumpi
62
+
63
+ 35: push3 0x001fff
64
+ 39: dup2
65
+ 3a: mod
66
+ 3b: swap1
67
+ 3c: dup2
68
+ 3d: sload
69
+ 3e: eq
70
+ 3f: push1 0x3c
71
+ 41: jumpi
72
+
73
+ 42: push0
73
74
43: push0
74
- 44: mstore
75
- 45: push1 0x20
76
- 47: push0
77
- 48: return
78
-
79
- 49: jumpdest
80
- 4a: push0
81
- 4b: push0
82
- 4c: revert
83
-
84
- 4d: jumpdest
85
- 4e: push3 0x016da0
86
- 52: timestamp
87
- 53: mod
88
- 54: timestamp
89
- 55: dup2
90
- 56: sstore
91
- 57: push0
92
- 58: calldataload
93
- 59: swap1
94
- 5a: push3 0x016da0
95
- 5e: add
75
+ 44: revert
76
+
77
+ 45: jumpdest
78
+ 46: push3 0x001fff
79
+ 4a: add
80
+ 4b: sload
81
+ 4c: push0
82
+ 4d: mstore
83
+ 4e: push1 0x20
84
+ 50: push0
85
+ 51: return
86
+
87
+ 52: jumpdest
88
+ 53: push0
89
+ 54: push0
90
+ 55: revert
91
+
92
+ 56: jumpdest
93
+ 57: push3 0x001fff
94
+ 5b: timestamp
95
+ 5c: mod
96
+ 5d: timestamp
97
+ 5e: dup2
96
98
5f: sstore
97
- 60: stop
98
-
99
+ 60: push0
100
+ 61: calldataload
101
+ 62: swap1
102
+ 63: push3 0x001fff
103
+ 67: add
104
+ 68: sstore
105
+ 69: stop
99
106
```
100
107
101
108
### Control-flow Graph
Original file line number Diff line number Diff line change 29
29
30
30
# buflen returns the HISTORY_BUFFER_LENGTH as defined in the EIP.
31
31
%def buflen()
32
- 93600
32
+ 8191
33
33
%end
34
34
35
35
# sysaddr is the address which calls the contract to submit a new root.
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import "../src/Contract.sol";
6
6
7
7
address constant addr = 0x000000000000000000000000000000000000000b;
8
8
address constant sysaddr = 0xffffFFFfFFffffffffffffffFfFFFfffFFFfFFfE;
9
- uint256 constant buflen = 93600 ;
9
+ uint256 constant buflen = 8191 ;
10
10
bytes32 constant root = hex"88e96d4537bea4d9c05d12549907b32561d3bf31f45aae734cdc119f13406cb6";
11
11
12
12
function timestamp() view returns (bytes32) {
@@ -142,7 +142,7 @@ contract ContractTest is Test {
142
142
uint256 start = block.timestamp;
143
143
144
144
// Saturate storage with fake roots.
145
- for (uint256 i = 0; i < buflen / 12 ; i += 1) {
145
+ for (uint256 i = 0; i < buflen; i += 1) {
146
146
bytes32 pbbr = bytes32(i*1337);
147
147
vm.prank(sysaddr);
148
148
(bool ret, bytes memory data) = unit.call(bytes.concat(pbbr));
@@ -152,7 +152,7 @@ contract ContractTest is Test {
152
152
}
153
153
154
154
// Attempt to read all values in same block context.
155
- for (uint256 i = 0; i < buflen / 12 ; i += 1) {
155
+ for (uint256 i = 0; i < buflen; i += 1) {
156
156
bytes32 time = bytes32(uint256(start+i*12));
157
157
(bool ret, bytes memory got) = unit.call(bytes.concat(time));
158
158
assertTrue(ret);
You can’t perform that action at this time.
0 commit comments