@@ -17,6 +17,9 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
1717 mapping (address => bool ) _authorized_readers;
1818 mapping (bytes32 attId = > bytes collateral ) _db;
1919
20+ event SetAuthorizedWriter (address caller , bool authorized );
21+ event SetAuthorizedReader (address caller , bool authorized );
22+
2023 modifier onlyDao (address dao ) {
2124 require (_authorized_writers[dao], "FORBIDDEN " );
2225 _;
@@ -26,15 +29,15 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
2629 _initializeOwner (msg .sender );
2730
2831 // adding address(0) as an authorized_reader to allow eth_call
29- _authorized_readers[ address (0 )] = true ;
32+ _setAuthorizedReader ( address (0 ), true ) ;
3033 }
3134
3235 function isAuthorizedCaller (address caller ) external view returns (bool ) {
3336 return _authorized_readers[caller];
3437 }
3538
3639 function setCallerAuthorization (address caller , bool authorized ) external onlyOwner {
37- _authorized_readers[ caller] = authorized;
40+ _setAuthorizedReader ( caller, authorized) ;
3841 }
3942
4043 function pauseCallerRestriction () external onlyOwner whenNotPaused {
@@ -45,15 +48,12 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
4548 _unpause ();
4649 }
4750
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 );
5353 }
5454
5555 function revokeDao (address revoked ) external onlyOwner {
56- _authorized_writers[ revoked] = false ;
56+ _setAuthorizedWriter ( revoked, false ) ;
5757 }
5858
5959 function collateralPointer (bytes32 key ) external pure override returns (bytes32 collateralAttId ) {
@@ -93,13 +93,6 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
9393 }
9494 }
9595
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-
10396 /// Attestation ID Computation
10497 bytes4 constant DATA_ATTESTATION_MAGIC = 0x54a09e9a ;
10598 bytes4 constant HASH_ATTESTATION_MAGIC = 0x628ab4d2 ;
@@ -109,6 +102,16 @@ contract AutomataDaoStorage is AutomataTCBManager, IDaoAttestationResolver, Paus
109102 attestationId = keccak256 (abi.encodePacked (magic, key));
110103 }
111104
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+
112115 /// TCB Management
113116 using EnumerableSet for EnumerableSet.Bytes32Set;
114117
0 commit comments