|
1 | 1 | --- |
2 | 2 | rskip: 529 |
3 | | -title: Super events |
| 3 | +title: New storage cells in Bridge native contract for base and super events info |
4 | 4 | created: 26-AUG-25 |
5 | 5 | author: MI |
6 | 6 | purpose: Sca |
@@ -30,75 +30,106 @@ To be completed... |
30 | 30 |
|
31 | 31 | ## Specification |
32 | 32 |
|
33 | | -### 1. New storage entry for the serialized `super event` |
| 33 | +### 1. Base event |
34 | 34 |
|
35 | | -A new storage entry is necessary to store the serialized `super event` sent by the Union Bridge contract. |
| 35 | +#### 1.1 New storage entry for the serialized `base event` |
| 36 | + |
| 37 | +A new storage entry is necessary to store the serialized `base event` sent by the Union Bridge contract. |
36 | 38 |
|
37 | 39 | ``` |
38 | | -**Storage entry name:** `superEvent` |
| 40 | +**Storage entry name:** `baseEvent` |
39 | 41 |
|
40 | 42 | **Data type:** `bytes` |
41 | 43 |
|
42 | | -**Maximum size:** TBD |
| 44 | +**Maximum size:** 128 bytes |
43 | 45 | ``` |
44 | 46 |
|
45 | | -The value is considered *unset* if `superEvent.length == 0`. |
| 47 | +#### 1.2. Method to get the serialized `base event` |
46 | 48 |
|
47 | | -### 2. Method to get the serialized `super event` |
48 | | - |
49 | | -A method will be added to allow anyone to query the current `super event`. If no value is set, then it should return an empty array of bytes. |
| 49 | +A method will be added to allow anyone to query the current `base event`. If no value is set, then it should return an empty array of bytes. |
50 | 50 |
|
51 | 51 | **Method signature:** |
52 | 52 |
|
53 | 53 | ``` |
54 | | -function getSuperEvent() public view returns (bytes memory); |
| 54 | +function getBaseEvent() public view returns (bytes memory); |
55 | 55 | ``` |
56 | 56 |
|
57 | | -### 3. Method to set the `super event` value in storage |
| 57 | +#### 1.3. Method to set the `base event` value in storage |
58 | 58 |
|
59 | | -A method will be added to allow the Union Bridge contract address to set the current `super event` value in storage. |
| 59 | +A method will be added to allow the Union Bridge contract address to set the current `base event` value in storage. |
60 | 60 |
|
61 | 61 | - If the caller is not the Union Bridge contract address then it should revert. |
62 | | -- It should receive a non-empty array of bytes and store it under the `superEvent` storage key of the Bridge contract. |
63 | | -- If there is an already existing value under the `superEvent` storage key of the Bridge contract, it will be overriden by the new value. |
| 62 | +- It should receive a non-empty array of bytes whose length is at most 128 bytes, which it then stores under the `baseEvent` storage key of the Bridge contract. |
| 63 | +- If there is an already existing value under the `baseEvent` storage key of the Bridge contract, it will be overriden by the new value. |
64 | 64 |
|
65 | 65 | **Method signature:** |
66 | 66 |
|
67 | 67 | ``` |
68 | | -function setSuperEvent(bytes memory superEvent) public; |
| 68 | +function setBaseEvent(bytes memory baseEvent) public; |
69 | 69 | ``` |
70 | 70 |
|
71 | | -### 4. Method to clear the `super event` value in storage |
| 71 | +#### 1.4. Method to clear the `base event` value in storage |
72 | 72 |
|
73 | | -A method will be added to allow the Union Bridge contract address to clear the current `super event` value in storage. |
| 73 | +A method will be added to allow the Union Bridge contract address to clear the current `base event` value in storage. |
74 | 74 |
|
75 | 75 | - If the caller is not the Union Bridge contract address then it should revert. |
76 | | -- It should store an empty byte array under the `superEvent` storage key of the Bridge, overriding whatever value was previously there. |
| 76 | +- It should store an empty byte array under the `baseEvent` storage key of the Bridge, overriding whatever value was previously there. |
77 | 77 |
|
78 | 78 | **Method signature:** |
79 | 79 |
|
80 | 80 | ``` |
81 | | -function clearSuperEvent() public; |
| 81 | +function clearBaseEvent() public; |
| 82 | +``` |
| 83 | + |
| 84 | +### 2. Super event |
| 85 | + |
| 86 | +#### 2.1 New storage entry for the serialized `super event` |
| 87 | + |
| 88 | +A new storage entry is necessary to store the serialized `super event` sent by the Union Bridge contract. |
| 89 | + |
| 90 | +``` |
| 91 | +**Storage entry name:** `superEvent` |
| 92 | +
|
| 93 | +**Data type:** `bytes` |
| 94 | +
|
| 95 | +**Maximum size:** 128 bytes |
82 | 96 | ``` |
83 | 97 |
|
84 | | -### 5. Method to get the accumulated difficulty of the latest `super block` |
| 98 | +#### 2.2. Method to get the serialized `super event` |
85 | 99 |
|
86 | | -A method will be added to allow anyone to query the latest `super block` accumulated difficulty. |
| 100 | +A method will be added to allow anyone to query the current `super event`. If no value is set, then it should return an empty array of bytes. |
87 | 101 |
|
88 | 102 | **Method signature:** |
89 | 103 |
|
90 | 104 | ``` |
91 | | -function getSuperBlockCumulativeDifficulty() public view returns(bytes); |
| 105 | +function getSuperEvent() public view returns (bytes memory); |
92 | 106 | ``` |
93 | 107 |
|
94 | | -### 6. Method to get the latest `super block` chain height |
| 108 | +#### 2.3. Method to set the `super event` value in storage |
95 | 109 |
|
96 | | -A method will be added to allow anyone to query the latest `super block` chain height. |
| 110 | +A method will be added to allow the Union Bridge contract address to set the current `super event` value in storage. |
| 111 | + |
| 112 | +- If the caller is not the Union Bridge contract address then it should revert. |
| 113 | +- It should receive a non-empty array of bytes whose length is at most 128 bytes, which it then stores under the `superEvent` storage key of the Bridge contract. |
| 114 | +- If there is an already existing value under the `superEvent` storage key of the Bridge contract, it will be overriden by the new value. |
97 | 115 |
|
98 | 116 | **Method signature:** |
99 | 117 |
|
100 | 118 | ``` |
101 | | -function getSuperBlockchainHeight() public view returns(uint32); |
| 119 | +function setSuperEvent(bytes memory superEvent) public; |
| 120 | +``` |
| 121 | + |
| 122 | +#### 2.4. Method to clear the `super event` value in storage |
| 123 | + |
| 124 | +A method will be added to allow the Union Bridge contract address to clear the current `super event` value in storage. |
| 125 | + |
| 126 | +- If the caller is not the Union Bridge contract address then it should revert. |
| 127 | +- It should store an empty byte array under the `superEvent` storage key of the Bridge, overriding whatever value was previously there. |
| 128 | + |
| 129 | +**Method signature:** |
| 130 | + |
| 131 | +``` |
| 132 | +function clearSuperEvent() public; |
102 | 133 | ``` |
103 | 134 |
|
104 | 135 | ## Rationale |
|
0 commit comments