@bloxchain/contracts 1.0.0-alpha.20 → 1.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,416 +1,421 @@
1
1
  [
2
2
  {
3
- "inputs": [],
3
+ "type": "function",
4
4
  "name": "BROADCASTER_UPDATE",
5
+ "inputs": [],
5
6
  "outputs": [
6
7
  {
7
- "internalType": "bytes32",
8
8
  "name": "",
9
- "type": "bytes32"
9
+ "type": "bytes32",
10
+ "internalType": "bytes32"
10
11
  }
11
12
  ],
12
- "stateMutability": "view",
13
- "type": "function"
13
+ "stateMutability": "view"
14
14
  },
15
15
  {
16
- "inputs": [],
16
+ "type": "function",
17
17
  "name": "OWNERSHIP_TRANSFER",
18
+ "inputs": [],
18
19
  "outputs": [
19
20
  {
20
- "internalType": "bytes32",
21
21
  "name": "",
22
- "type": "bytes32"
22
+ "type": "bytes32",
23
+ "internalType": "bytes32"
23
24
  }
24
25
  ],
25
- "stateMutability": "view",
26
- "type": "function"
26
+ "stateMutability": "view"
27
27
  },
28
28
  {
29
- "inputs": [],
29
+ "type": "function",
30
30
  "name": "RECOVERY_UPDATE",
31
+ "inputs": [],
31
32
  "outputs": [
32
33
  {
33
- "internalType": "bytes32",
34
34
  "name": "",
35
- "type": "bytes32"
35
+ "type": "bytes32",
36
+ "internalType": "bytes32"
36
37
  }
37
38
  ],
38
- "stateMutability": "view",
39
- "type": "function"
39
+ "stateMutability": "view"
40
40
  },
41
41
  {
42
- "inputs": [],
42
+ "type": "function",
43
43
  "name": "TIMELOCK_UPDATE",
44
+ "inputs": [],
44
45
  "outputs": [
45
46
  {
46
- "internalType": "bytes32",
47
47
  "name": "",
48
- "type": "bytes32"
48
+ "type": "bytes32",
49
+ "internalType": "bytes32"
49
50
  }
50
51
  ],
51
- "stateMutability": "view",
52
- "type": "function"
52
+ "stateMutability": "view"
53
53
  },
54
54
  {
55
- "inputs": [],
55
+ "type": "function",
56
56
  "name": "TRANSFER_OWNERSHIP_APPROVE_META_SELECTOR",
57
+ "inputs": [],
57
58
  "outputs": [
58
59
  {
59
- "internalType": "bytes4",
60
60
  "name": "",
61
- "type": "bytes4"
61
+ "type": "bytes4",
62
+ "internalType": "bytes4"
62
63
  }
63
64
  ],
64
- "stateMutability": "view",
65
- "type": "function"
65
+ "stateMutability": "view"
66
66
  },
67
67
  {
68
- "inputs": [],
68
+ "type": "function",
69
69
  "name": "TRANSFER_OWNERSHIP_CANCELLATION_SELECTOR",
70
+ "inputs": [],
70
71
  "outputs": [
71
72
  {
72
- "internalType": "bytes4",
73
73
  "name": "",
74
- "type": "bytes4"
74
+ "type": "bytes4",
75
+ "internalType": "bytes4"
75
76
  }
76
77
  ],
77
- "stateMutability": "view",
78
- "type": "function"
78
+ "stateMutability": "view"
79
79
  },
80
80
  {
81
- "inputs": [],
81
+ "type": "function",
82
82
  "name": "TRANSFER_OWNERSHIP_CANCEL_META_SELECTOR",
83
+ "inputs": [],
83
84
  "outputs": [
84
85
  {
85
- "internalType": "bytes4",
86
86
  "name": "",
87
- "type": "bytes4"
87
+ "type": "bytes4",
88
+ "internalType": "bytes4"
88
89
  }
89
90
  ],
90
- "stateMutability": "view",
91
- "type": "function"
91
+ "stateMutability": "view"
92
92
  },
93
93
  {
94
- "inputs": [],
94
+ "type": "function",
95
95
  "name": "TRANSFER_OWNERSHIP_DELAYED_APPROVAL_SELECTOR",
96
+ "inputs": [],
96
97
  "outputs": [
97
98
  {
98
- "internalType": "bytes4",
99
99
  "name": "",
100
- "type": "bytes4"
100
+ "type": "bytes4",
101
+ "internalType": "bytes4"
101
102
  }
102
103
  ],
103
- "stateMutability": "view",
104
- "type": "function"
104
+ "stateMutability": "view"
105
105
  },
106
106
  {
107
- "inputs": [],
107
+ "type": "function",
108
108
  "name": "TRANSFER_OWNERSHIP_REQUEST_SELECTOR",
109
+ "inputs": [],
109
110
  "outputs": [
110
111
  {
111
- "internalType": "bytes4",
112
112
  "name": "",
113
- "type": "bytes4"
113
+ "type": "bytes4",
114
+ "internalType": "bytes4"
114
115
  }
115
116
  ],
116
- "stateMutability": "view",
117
- "type": "function"
117
+ "stateMutability": "view"
118
118
  },
119
119
  {
120
- "inputs": [],
120
+ "type": "function",
121
121
  "name": "TRANSFER_OWNERSHIP_SELECTOR",
122
+ "inputs": [],
122
123
  "outputs": [
123
124
  {
124
- "internalType": "bytes4",
125
125
  "name": "",
126
- "type": "bytes4"
126
+ "type": "bytes4",
127
+ "internalType": "bytes4"
127
128
  }
128
129
  ],
129
- "stateMutability": "view",
130
- "type": "function"
130
+ "stateMutability": "view"
131
131
  },
132
132
  {
133
- "inputs": [],
133
+ "type": "function",
134
134
  "name": "UPDATE_BROADCASTER_APPROVE_META_SELECTOR",
135
+ "inputs": [],
135
136
  "outputs": [
136
137
  {
137
- "internalType": "bytes4",
138
138
  "name": "",
139
- "type": "bytes4"
139
+ "type": "bytes4",
140
+ "internalType": "bytes4"
140
141
  }
141
142
  ],
142
- "stateMutability": "view",
143
- "type": "function"
143
+ "stateMutability": "view"
144
144
  },
145
145
  {
146
- "inputs": [],
146
+ "type": "function",
147
147
  "name": "UPDATE_BROADCASTER_CANCELLATION_SELECTOR",
148
+ "inputs": [],
148
149
  "outputs": [
149
150
  {
150
- "internalType": "bytes4",
151
151
  "name": "",
152
- "type": "bytes4"
152
+ "type": "bytes4",
153
+ "internalType": "bytes4"
153
154
  }
154
155
  ],
155
- "stateMutability": "view",
156
- "type": "function"
156
+ "stateMutability": "view"
157
157
  },
158
158
  {
159
- "inputs": [],
159
+ "type": "function",
160
160
  "name": "UPDATE_BROADCASTER_CANCEL_META_SELECTOR",
161
+ "inputs": [],
161
162
  "outputs": [
162
163
  {
163
- "internalType": "bytes4",
164
164
  "name": "",
165
- "type": "bytes4"
165
+ "type": "bytes4",
166
+ "internalType": "bytes4"
166
167
  }
167
168
  ],
168
- "stateMutability": "view",
169
- "type": "function"
169
+ "stateMutability": "view"
170
170
  },
171
171
  {
172
- "inputs": [],
172
+ "type": "function",
173
173
  "name": "UPDATE_BROADCASTER_DELAYED_APPROVAL_SELECTOR",
174
+ "inputs": [],
174
175
  "outputs": [
175
176
  {
176
- "internalType": "bytes4",
177
177
  "name": "",
178
- "type": "bytes4"
178
+ "type": "bytes4",
179
+ "internalType": "bytes4"
179
180
  }
180
181
  ],
181
- "stateMutability": "view",
182
- "type": "function"
182
+ "stateMutability": "view"
183
183
  },
184
184
  {
185
- "inputs": [],
185
+ "type": "function",
186
186
  "name": "UPDATE_BROADCASTER_REQUEST_SELECTOR",
187
+ "inputs": [],
187
188
  "outputs": [
188
189
  {
189
- "internalType": "bytes4",
190
190
  "name": "",
191
- "type": "bytes4"
191
+ "type": "bytes4",
192
+ "internalType": "bytes4"
192
193
  }
193
194
  ],
194
- "stateMutability": "view",
195
- "type": "function"
195
+ "stateMutability": "view"
196
196
  },
197
197
  {
198
- "inputs": [],
198
+ "type": "function",
199
199
  "name": "UPDATE_BROADCASTER_SELECTOR",
200
+ "inputs": [],
200
201
  "outputs": [
201
202
  {
202
- "internalType": "bytes4",
203
203
  "name": "",
204
- "type": "bytes4"
204
+ "type": "bytes4",
205
+ "internalType": "bytes4"
205
206
  }
206
207
  ],
207
- "stateMutability": "view",
208
- "type": "function"
208
+ "stateMutability": "view"
209
209
  },
210
210
  {
211
- "inputs": [],
211
+ "type": "function",
212
212
  "name": "UPDATE_RECOVERY_META_SELECTOR",
213
+ "inputs": [],
213
214
  "outputs": [
214
215
  {
215
- "internalType": "bytes4",
216
216
  "name": "",
217
- "type": "bytes4"
217
+ "type": "bytes4",
218
+ "internalType": "bytes4"
218
219
  }
219
220
  ],
220
- "stateMutability": "view",
221
- "type": "function"
221
+ "stateMutability": "view"
222
222
  },
223
223
  {
224
- "inputs": [],
224
+ "type": "function",
225
225
  "name": "UPDATE_RECOVERY_SELECTOR",
226
+ "inputs": [],
226
227
  "outputs": [
227
228
  {
228
- "internalType": "bytes4",
229
229
  "name": "",
230
- "type": "bytes4"
230
+ "type": "bytes4",
231
+ "internalType": "bytes4"
231
232
  }
232
233
  ],
233
- "stateMutability": "view",
234
- "type": "function"
234
+ "stateMutability": "view"
235
235
  },
236
236
  {
237
- "inputs": [],
237
+ "type": "function",
238
238
  "name": "UPDATE_TIMELOCK_META_SELECTOR",
239
+ "inputs": [],
239
240
  "outputs": [
240
241
  {
241
- "internalType": "bytes4",
242
242
  "name": "",
243
- "type": "bytes4"
243
+ "type": "bytes4",
244
+ "internalType": "bytes4"
244
245
  }
245
246
  ],
246
- "stateMutability": "view",
247
- "type": "function"
247
+ "stateMutability": "view"
248
248
  },
249
249
  {
250
- "inputs": [],
250
+ "type": "function",
251
251
  "name": "UPDATE_TIMELOCK_SELECTOR",
252
+ "inputs": [],
252
253
  "outputs": [
253
254
  {
254
- "internalType": "bytes4",
255
255
  "name": "",
256
- "type": "bytes4"
256
+ "type": "bytes4",
257
+ "internalType": "bytes4"
257
258
  }
258
259
  ],
259
- "stateMutability": "view",
260
- "type": "function"
260
+ "stateMutability": "view"
261
261
  },
262
262
  {
263
- "inputs": [],
263
+ "type": "function",
264
264
  "name": "getFunctionSchemas",
265
+ "inputs": [],
265
266
  "outputs": [
266
267
  {
268
+ "name": "",
269
+ "type": "tuple[]",
270
+ "internalType": "struct EngineBlox.FunctionSchema[]",
267
271
  "components": [
268
272
  {
269
- "internalType": "string",
270
273
  "name": "functionSignature",
271
- "type": "string"
274
+ "type": "string",
275
+ "internalType": "string"
272
276
  },
273
277
  {
274
- "internalType": "bytes4",
275
278
  "name": "functionSelector",
276
- "type": "bytes4"
279
+ "type": "bytes4",
280
+ "internalType": "bytes4"
277
281
  },
278
282
  {
279
- "internalType": "bytes32",
280
283
  "name": "operationType",
281
- "type": "bytes32"
284
+ "type": "bytes32",
285
+ "internalType": "bytes32"
282
286
  },
283
287
  {
284
- "internalType": "string",
285
288
  "name": "operationName",
286
- "type": "string"
289
+ "type": "string",
290
+ "internalType": "string"
287
291
  },
288
292
  {
289
- "internalType": "uint16",
290
293
  "name": "supportedActionsBitmap",
291
- "type": "uint16"
294
+ "type": "uint16",
295
+ "internalType": "uint16"
292
296
  },
293
297
  {
294
- "internalType": "bool",
295
298
  "name": "enforceHandlerRelations",
296
- "type": "bool"
299
+ "type": "bool",
300
+ "internalType": "bool"
297
301
  },
298
302
  {
299
- "internalType": "bool",
300
303
  "name": "isProtected",
301
- "type": "bool"
304
+ "type": "bool",
305
+ "internalType": "bool"
306
+ },
307
+ {
308
+ "name": "isGrantRevocable",
309
+ "type": "bool",
310
+ "internalType": "bool"
302
311
  },
303
312
  {
304
- "internalType": "bytes4[]",
305
313
  "name": "handlerForSelectors",
306
- "type": "bytes4[]"
314
+ "type": "bytes4[]",
315
+ "internalType": "bytes4[]"
307
316
  }
308
- ],
309
- "internalType": "struct EngineBlox.FunctionSchema[]",
310
- "name": "",
311
- "type": "tuple[]"
317
+ ]
312
318
  }
313
319
  ],
314
- "stateMutability": "pure",
315
- "type": "function"
320
+ "stateMutability": "pure"
316
321
  },
317
322
  {
318
- "inputs": [],
323
+ "type": "function",
319
324
  "name": "getRolePermissions",
325
+ "inputs": [],
320
326
  "outputs": [
321
327
  {
328
+ "name": "",
329
+ "type": "tuple",
330
+ "internalType": "struct IDefinition.RolePermission",
322
331
  "components": [
323
332
  {
324
- "internalType": "bytes32[]",
325
333
  "name": "roleHashes",
326
- "type": "bytes32[]"
334
+ "type": "bytes32[]",
335
+ "internalType": "bytes32[]"
327
336
  },
328
337
  {
338
+ "name": "functionPermissions",
339
+ "type": "tuple[]",
340
+ "internalType": "struct EngineBlox.FunctionPermission[]",
329
341
  "components": [
330
342
  {
331
- "internalType": "bytes4",
332
343
  "name": "functionSelector",
333
- "type": "bytes4"
344
+ "type": "bytes4",
345
+ "internalType": "bytes4"
334
346
  },
335
347
  {
336
- "internalType": "uint16",
337
348
  "name": "grantedActionsBitmap",
338
- "type": "uint16"
349
+ "type": "uint16",
350
+ "internalType": "uint16"
339
351
  },
340
352
  {
341
- "internalType": "bytes4[]",
342
353
  "name": "handlerForSelectors",
343
- "type": "bytes4[]"
354
+ "type": "bytes4[]",
355
+ "internalType": "bytes4[]"
344
356
  }
345
- ],
346
- "internalType": "struct EngineBlox.FunctionPermission[]",
347
- "name": "functionPermissions",
348
- "type": "tuple[]"
357
+ ]
349
358
  }
350
- ],
351
- "internalType": "struct IDefinition.RolePermission",
352
- "name": "",
353
- "type": "tuple"
359
+ ]
354
360
  }
355
361
  ],
356
- "stateMutability": "pure",
357
- "type": "function"
362
+ "stateMutability": "pure"
358
363
  },
359
364
  {
365
+ "type": "function",
366
+ "name": "supportsInterface",
360
367
  "inputs": [
361
368
  {
362
- "internalType": "address",
363
- "name": "newRecoveryAddress",
364
- "type": "address"
369
+ "name": "interfaceId",
370
+ "type": "bytes4",
371
+ "internalType": "bytes4"
365
372
  }
366
373
  ],
367
- "name": "updateRecoveryExecutionParams",
368
374
  "outputs": [
369
375
  {
370
- "internalType": "bytes",
371
376
  "name": "",
372
- "type": "bytes"
377
+ "type": "bool",
378
+ "internalType": "bool"
373
379
  }
374
380
  ],
375
- "stateMutability": "pure",
376
- "type": "function"
381
+ "stateMutability": "pure"
377
382
  },
378
383
  {
384
+ "type": "function",
385
+ "name": "updateRecoveryExecutionParams",
379
386
  "inputs": [
380
387
  {
381
- "internalType": "uint256",
382
- "name": "newTimeLockPeriodSec",
383
- "type": "uint256"
388
+ "name": "newRecoveryAddress",
389
+ "type": "address",
390
+ "internalType": "address"
384
391
  }
385
392
  ],
386
- "name": "updateTimeLockExecutionParams",
387
393
  "outputs": [
388
394
  {
389
- "internalType": "bytes",
390
395
  "name": "",
391
- "type": "bytes"
396
+ "type": "bytes",
397
+ "internalType": "bytes"
392
398
  }
393
399
  ],
394
- "stateMutability": "pure",
395
- "type": "function"
400
+ "stateMutability": "pure"
396
401
  },
397
402
  {
403
+ "type": "function",
404
+ "name": "updateTimeLockExecutionParams",
398
405
  "inputs": [
399
406
  {
400
- "internalType": "bytes4",
401
- "name": "interfaceId",
402
- "type": "bytes4"
407
+ "name": "newTimeLockPeriodSec",
408
+ "type": "uint256",
409
+ "internalType": "uint256"
403
410
  }
404
411
  ],
405
- "name": "supportsInterface",
406
412
  "outputs": [
407
413
  {
408
- "internalType": "bool",
409
414
  "name": "",
410
- "type": "bool"
415
+ "type": "bytes",
416
+ "internalType": "bytes"
411
417
  }
412
418
  ],
413
- "stateMutability": "pure",
414
- "type": "function"
419
+ "stateMutability": "pure"
415
420
  }
416
421
  ]
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  // Contract imports
5
5
  import "../base/BaseStateMachine.sol";
@@ -30,10 +30,9 @@ import "./interface/IRuntimeRBAC.sol";
30
30
  * - For ADD_WALLET and REVOKE_WALLET we call _requireRoleNotProtected so batch ops cannot
31
31
  * change who holds system roles. For REMOVE_ROLE we rely on EngineBlox.removeRole, which
32
32
  * enforces the same policy at the library layer (cannot remove protected roles).
33
- * - Function-permission updates on protected roles are intentionally supported for flexibility,
34
- * but EngineBlox.removeFunctionFromRole still blocks removal of protected function schemas
35
- * (isProtected == true). This prevents bricking core protected operations like ownership flow
36
- * selectors while still allowing policy updates for non-protected selectors.
33
+ * - Function-permission updates on protected roles are intentionally supported for flexibility.
34
+ * EngineBlox.removeFunctionFromRole allows removing a grant whenever the schema's **`isGrantRevocable`**
35
+ * is true (including from protected roles); **`GrantNotRevocable`** applies when it is false.
37
36
  * - The **only** place to modify system wallets (protected roles) is the SecureOwnable
38
37
  * security component (e.g. transferOwnershipRequest, broadcaster/recovery changes).
39
38
  * - This layering is intentional: RBAC cannot touch protected roles; SecureOwnable is the
@@ -231,10 +230,9 @@ abstract contract RuntimeRBAC is BaseStateMachine, IRuntimeRBAC {
231
230
  * @dev Executes REMOVE_FUNCTION_FROM_ROLE: removes a function permission from a role.
232
231
  * @param data ABI-encoded (bytes32 roleHash, bytes4 functionSelector)
233
232
  * @custom:security By design we allow removing function permissions from protected roles (OWNER, BROADCASTER, RECOVERY)
234
- * to retain flexibility to adjust which functions system roles can call; only wallet add/revoke
235
- * are restricted on protected roles. EngineBlox.removeFunctionFromRole still blocks
236
- * removing protected function schemas (isProtected == true), so critical protected
237
- * selectors cannot be stripped from roles.
233
+ * for flexibility; only wallet add/revoke are restricted on protected roles. EngineBlox.removeFunctionFromRole
234
+ * enforces **`GrantNotRevocable`** when the schema's **`isGrantRevocable`** is false; when true,
235
+ * grants may be removed from protected roles as well as custom roles.
238
236
  */
239
237
  function _executeRemoveFunctionFromRole(bytes calldata data) internal {
240
238
  (bytes32 roleHash, bytes4 functionSelector) = abi.decode(data, (bytes32, bytes4));
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  import "../../lib/EngineBlox.sol";
5
5
 
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: MPL-2.0
2
- pragma solidity 0.8.34;
2
+ pragma solidity 0.8.35;
3
3
 
4
4
  import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
5
5
  import "../../../lib/EngineBlox.sol";
@@ -30,7 +30,7 @@ library RuntimeRBACDefinitions {
30
30
  bytes4 public constant ROLE_CONFIG_BATCH_META_SELECTOR =
31
31
  bytes4(
32
32
  keccak256(
33
- "roleConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
33
+ "roleConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))"
34
34
  )
35
35
  );
36
36
 
@@ -57,13 +57,14 @@ library RuntimeRBACDefinitions {
57
57
  handlerForSelectors[0] = ROLE_CONFIG_BATCH_EXECUTE_SELECTOR;
58
58
 
59
59
  schemas[0] = EngineBlox.FunctionSchema({
60
- functionSignature: "roleConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
60
+ functionSignature: "roleConfigBatchRequestAndApprove(((uint256,uint256,uint8,(address,address,uint256,uint256,bytes32,bytes4,bytes),bytes32,bytes32,(address,uint256,address,uint256)),(uint256,uint256,address,bytes4,uint8,uint256,uint256,address),bytes32,bytes,bytes))",
61
61
  functionSelector: ROLE_CONFIG_BATCH_META_SELECTOR,
62
62
  operationType: ROLE_CONFIG_BATCH,
63
63
  operationName: "ROLE_CONFIG_BATCH",
64
64
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(metaRequestApproveActions),
65
65
  enforceHandlerRelations: true,
66
66
  isProtected: true,
67
+ isGrantRevocable: false,
67
68
  handlerForSelectors: handlerForSelectors
68
69
  });
69
70
 
@@ -86,6 +87,7 @@ library RuntimeRBACDefinitions {
86
87
  supportedActionsBitmap: EngineBlox.createBitmapFromActions(executionActions),
87
88
  enforceHandlerRelations: false,
88
89
  isProtected: true,
90
+ isGrantRevocable: false,
89
91
  handlerForSelectors: executionHandlerForSelectors
90
92
  });
91
93