@@ -17,6 +17,9 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
17
17
mapping (address => bool ) _authorized_readers;
18
18
mapping (bytes32 attId = > bytes collateral ) _db;
19
19
20
+ event SetAuthorizedWriter (address caller , bool authorized );
21
+ event SetAuthorizedReader (address caller , bool authorized );
22
+
20
23
modifier onlyDao (address dao ) {
21
24
require (_authorized_writers[dao], "FORBIDDEN " );
22
25
_;
@@ -26,15 +29,15 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
26
29
_initializeOwner (msg .sender );
27
30
28
31
// adding address(0) as an authorized_reader to allow eth_call
29
- _authorized_readers[ address (0 )] = true ;
32
+ _setAuthorizedReader ( address (0 ), true ) ;
30
33
}
31
34
32
35
function isAuthorizedCaller (address caller ) external view returns (bool ) {
33
36
return _authorized_readers[caller];
34
37
}
35
38
36
39
function setCallerAuthorization (address caller , bool authorized ) external onlyOwner {
37
- _authorized_readers[ caller] = authorized;
40
+ _setAuthorizedReader ( caller, authorized) ;
38
41
}
39
42
40
43
function pauseCallerRestriction () external onlyOwner whenNotPaused {
@@ -45,15 +48,12 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
45
48
_unpause ();
46
49
}
47
50
48
- function updateDao (address _pcsDao , address _pckDao , address _fmspcTcbDao , address _enclaveIdDao )
49
- external
50
- onlyOwner
51
- {
52
- _updateDao (_pcsDao, _pckDao, _fmspcTcbDao, _enclaveIdDao);
51
+ function grantDao (address granted ) external onlyOwner {
52
+ _setAuthorizedWriter (granted, true );
53
53
}
54
54
55
55
function revokeDao (address revoked ) external onlyOwner {
56
- _authorized_writers[ revoked] = false ;
56
+ _setAuthorizedWriter ( revoked, false ) ;
57
57
}
58
58
59
59
function collateralPointer (bytes32 key ) external pure override returns (bytes32 collateralAttId ) {
@@ -93,13 +93,6 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
93
93
}
94
94
}
95
95
96
- function _updateDao (address _pcsDao , address _pckDao , address _fmspcTcbDao , address _enclaveIdDao ) private {
97
- _authorized_writers[_pcsDao] = true ;
98
- _authorized_writers[_pckDao] = true ;
99
- _authorized_writers[_fmspcTcbDao] = true ;
100
- _authorized_writers[_enclaveIdDao] = true ;
101
- }
102
-
103
96
/// Attestation ID Computation
104
97
bytes4 constant DATA_ATTESTATION_MAGIC = 0x54a09e9a ;
105
98
bytes4 constant HASH_ATTESTATION_MAGIC = 0x628ab4d2 ;
@@ -109,6 +102,16 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
109
102
attestationId = keccak256 (abi.encodePacked (magic, key));
110
103
}
111
104
105
+ function _setAuthorizedWriter (address caller , bool authorized ) private {
106
+ _authorized_writers[caller] = authorized;
107
+ emit SetAuthorizedWriter (caller, authorized);
108
+ }
109
+
110
+ function _setAuthorizedReader (address caller , bool authorized ) private {
111
+ _authorized_readers[caller] = authorized;
112
+ emit SetAuthorizedReader (caller, authorized);
113
+ }
114
+
112
115
/// TCB Management
113
116
using EnumerableSet for EnumerableSet.Bytes32Set;
114
117
0 commit comments