@bloxchain/contracts 1.0.0-alpha.19 → 1.0.0-alpha.20
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.
- package/abi/BaseStateMachine.abi.json +0 -16
- package/abi/EngineBlox.abi.json +46 -4
- package/abi/GuardController.abi.json +28 -7
- package/abi/GuardControllerDefinitions.abi.json +1 -1
- package/abi/RuntimeRBAC.abi.json +28 -7
- package/abi/SecureOwnable.abi.json +23 -7
- package/core/access/RuntimeRBAC.sol +13 -1
- package/core/base/BaseStateMachine.sol +967 -948
- package/core/base/interface/IBaseStateMachine.sol +1 -0
- package/core/execution/GuardController.sol +454 -448
- package/core/execution/lib/definitions/GuardControllerDefinitions.sol +70 -13
- package/core/lib/EngineBlox.sol +182 -38
- package/core/lib/utils/SharedValidation.sol +540 -492
- package/core/security/SecureOwnable.sol +39 -7
- package/package.json +3 -3
|
@@ -4,22 +4,6 @@
|
|
|
4
4
|
"name": "InvalidInitialization",
|
|
5
5
|
"type": "error"
|
|
6
6
|
},
|
|
7
|
-
{
|
|
8
|
-
"inputs": [
|
|
9
|
-
{
|
|
10
|
-
"internalType": "uint256",
|
|
11
|
-
"name": "from",
|
|
12
|
-
"type": "uint256"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"internalType": "uint256",
|
|
16
|
-
"name": "to",
|
|
17
|
-
"type": "uint256"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"name": "InvalidRange",
|
|
21
|
-
"type": "error"
|
|
22
|
-
},
|
|
23
7
|
{
|
|
24
8
|
"inputs": [
|
|
25
9
|
{
|
package/abi/EngineBlox.abi.json
CHANGED
|
@@ -349,6 +349,22 @@
|
|
|
349
349
|
"name": "MetaTxExpired",
|
|
350
350
|
"type": "error"
|
|
351
351
|
},
|
|
352
|
+
{
|
|
353
|
+
"inputs": [
|
|
354
|
+
{
|
|
355
|
+
"internalType": "address",
|
|
356
|
+
"name": "signedContract",
|
|
357
|
+
"type": "address"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"internalType": "address",
|
|
361
|
+
"name": "entryContract",
|
|
362
|
+
"type": "address"
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"name": "MetaTxHandlerContractMismatch",
|
|
366
|
+
"type": "error"
|
|
367
|
+
},
|
|
352
368
|
{
|
|
353
369
|
"inputs": [
|
|
354
370
|
{
|
|
@@ -596,6 +612,32 @@
|
|
|
596
612
|
"name": "TransactionEvent",
|
|
597
613
|
"type": "event"
|
|
598
614
|
},
|
|
615
|
+
{
|
|
616
|
+
"inputs": [],
|
|
617
|
+
"name": "ATTACHED_PAYMENT_RECIPIENT_SELECTOR",
|
|
618
|
+
"outputs": [
|
|
619
|
+
{
|
|
620
|
+
"internalType": "bytes4",
|
|
621
|
+
"name": "",
|
|
622
|
+
"type": "bytes4"
|
|
623
|
+
}
|
|
624
|
+
],
|
|
625
|
+
"stateMutability": "view",
|
|
626
|
+
"type": "function"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"inputs": [],
|
|
630
|
+
"name": "ERC20_TRANSFER_SELECTOR",
|
|
631
|
+
"outputs": [
|
|
632
|
+
{
|
|
633
|
+
"internalType": "bytes4",
|
|
634
|
+
"name": "",
|
|
635
|
+
"type": "bytes4"
|
|
636
|
+
}
|
|
637
|
+
],
|
|
638
|
+
"stateMutability": "view",
|
|
639
|
+
"type": "function"
|
|
640
|
+
},
|
|
599
641
|
{
|
|
600
642
|
"inputs": [],
|
|
601
643
|
"name": "MAX_BATCH_SIZE",
|
|
@@ -637,7 +679,7 @@
|
|
|
637
679
|
},
|
|
638
680
|
{
|
|
639
681
|
"inputs": [],
|
|
640
|
-
"name": "
|
|
682
|
+
"name": "MAX_RESULT_PREVIEW_BYTES",
|
|
641
683
|
"outputs": [
|
|
642
684
|
{
|
|
643
685
|
"internalType": "uint256",
|
|
@@ -650,12 +692,12 @@
|
|
|
650
692
|
},
|
|
651
693
|
{
|
|
652
694
|
"inputs": [],
|
|
653
|
-
"name": "
|
|
695
|
+
"name": "MAX_ROLES",
|
|
654
696
|
"outputs": [
|
|
655
697
|
{
|
|
656
|
-
"internalType": "
|
|
698
|
+
"internalType": "uint256",
|
|
657
699
|
"name": "",
|
|
658
|
-
"type": "
|
|
700
|
+
"type": "uint256"
|
|
659
701
|
}
|
|
660
702
|
],
|
|
661
703
|
"stateMutability": "view",
|
|
@@ -58,20 +58,41 @@
|
|
|
58
58
|
"name": "InvalidInitialization",
|
|
59
59
|
"type": "error"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"inputs": [],
|
|
63
|
+
"name": "InvalidPayment",
|
|
64
|
+
"type": "error"
|
|
65
|
+
},
|
|
61
66
|
{
|
|
62
67
|
"inputs": [
|
|
63
68
|
{
|
|
64
|
-
"internalType": "
|
|
65
|
-
"name": "
|
|
66
|
-
"type": "
|
|
69
|
+
"internalType": "address",
|
|
70
|
+
"name": "signedContract",
|
|
71
|
+
"type": "address"
|
|
67
72
|
},
|
|
68
73
|
{
|
|
69
|
-
"internalType": "
|
|
70
|
-
"name": "
|
|
71
|
-
"type": "
|
|
74
|
+
"internalType": "address",
|
|
75
|
+
"name": "entryContract",
|
|
76
|
+
"type": "address"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "MetaTxHandlerContractMismatch",
|
|
80
|
+
"type": "error"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"inputs": [
|
|
84
|
+
{
|
|
85
|
+
"internalType": "bytes4",
|
|
86
|
+
"name": "signedSelector",
|
|
87
|
+
"type": "bytes4"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"internalType": "bytes4",
|
|
91
|
+
"name": "entrySelector",
|
|
92
|
+
"type": "bytes4"
|
|
72
93
|
}
|
|
73
94
|
],
|
|
74
|
-
"name": "
|
|
95
|
+
"name": "MetaTxHandlerSelectorMismatch",
|
|
75
96
|
"type": "error"
|
|
76
97
|
},
|
|
77
98
|
{
|
package/abi/RuntimeRBAC.abi.json
CHANGED
|
@@ -58,20 +58,41 @@
|
|
|
58
58
|
"name": "InvalidInitialization",
|
|
59
59
|
"type": "error"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"inputs": [],
|
|
63
|
+
"name": "InvalidPayment",
|
|
64
|
+
"type": "error"
|
|
65
|
+
},
|
|
61
66
|
{
|
|
62
67
|
"inputs": [
|
|
63
68
|
{
|
|
64
|
-
"internalType": "
|
|
65
|
-
"name": "
|
|
66
|
-
"type": "
|
|
69
|
+
"internalType": "address",
|
|
70
|
+
"name": "signedContract",
|
|
71
|
+
"type": "address"
|
|
67
72
|
},
|
|
68
73
|
{
|
|
69
|
-
"internalType": "
|
|
70
|
-
"name": "
|
|
71
|
-
"type": "
|
|
74
|
+
"internalType": "address",
|
|
75
|
+
"name": "entryContract",
|
|
76
|
+
"type": "address"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "MetaTxHandlerContractMismatch",
|
|
80
|
+
"type": "error"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"inputs": [
|
|
84
|
+
{
|
|
85
|
+
"internalType": "bytes4",
|
|
86
|
+
"name": "signedSelector",
|
|
87
|
+
"type": "bytes4"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"internalType": "bytes4",
|
|
91
|
+
"name": "entrySelector",
|
|
92
|
+
"type": "bytes4"
|
|
72
93
|
}
|
|
73
94
|
],
|
|
74
|
-
"name": "
|
|
95
|
+
"name": "MetaTxHandlerSelectorMismatch",
|
|
75
96
|
"type": "error"
|
|
76
97
|
},
|
|
77
98
|
{
|
|
@@ -34,17 +34,33 @@
|
|
|
34
34
|
{
|
|
35
35
|
"inputs": [
|
|
36
36
|
{
|
|
37
|
-
"internalType": "
|
|
38
|
-
"name": "
|
|
39
|
-
"type": "
|
|
37
|
+
"internalType": "address",
|
|
38
|
+
"name": "signedContract",
|
|
39
|
+
"type": "address"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
"internalType": "
|
|
43
|
-
"name": "
|
|
44
|
-
"type": "
|
|
42
|
+
"internalType": "address",
|
|
43
|
+
"name": "entryContract",
|
|
44
|
+
"type": "address"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"name": "MetaTxHandlerContractMismatch",
|
|
48
|
+
"type": "error"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"inputs": [
|
|
52
|
+
{
|
|
53
|
+
"internalType": "bytes4",
|
|
54
|
+
"name": "signedSelector",
|
|
55
|
+
"type": "bytes4"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"internalType": "bytes4",
|
|
59
|
+
"name": "entrySelector",
|
|
60
|
+
"type": "bytes4"
|
|
45
61
|
}
|
|
46
62
|
],
|
|
47
|
-
"name": "
|
|
63
|
+
"name": "MetaTxHandlerSelectorMismatch",
|
|
48
64
|
"type": "error"
|
|
49
65
|
},
|
|
50
66
|
{
|
|
@@ -30,6 +30,10 @@ 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
37
|
* - The **only** place to modify system wallets (protected roles) is the SecureOwnable
|
|
34
38
|
* security component (e.g. transferOwnershipRequest, broadcaster/recovery changes).
|
|
35
39
|
* - This layering is intentional: RBAC cannot touch protected roles; SecureOwnable is the
|
|
@@ -88,6 +92,12 @@ abstract contract RuntimeRBAC is BaseStateMachine, IRuntimeRBAC {
|
|
|
88
92
|
EngineBlox.MetaTransaction memory metaTx
|
|
89
93
|
) public returns (uint256) {
|
|
90
94
|
_validateBroadcaster(msg.sender);
|
|
95
|
+
SharedValidation.validateEmptyPayment(
|
|
96
|
+
metaTx.txRecord.payment.recipient,
|
|
97
|
+
metaTx.txRecord.payment.nativeTokenAmount,
|
|
98
|
+
metaTx.txRecord.payment.erc20TokenAddress,
|
|
99
|
+
metaTx.txRecord.payment.erc20TokenAmount
|
|
100
|
+
);
|
|
91
101
|
EngineBlox.TxRecord memory txRecord = _requestAndApproveTransaction(metaTx);
|
|
92
102
|
return txRecord.txId;
|
|
93
103
|
}
|
|
@@ -222,7 +232,9 @@ abstract contract RuntimeRBAC is BaseStateMachine, IRuntimeRBAC {
|
|
|
222
232
|
* @param data ABI-encoded (bytes32 roleHash, bytes4 functionSelector)
|
|
223
233
|
* @custom:security By design we allow removing function permissions from protected roles (OWNER, BROADCASTER, RECOVERY)
|
|
224
234
|
* to retain flexibility to adjust which functions system roles can call; only wallet add/revoke
|
|
225
|
-
* are restricted on protected roles.
|
|
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.
|
|
226
238
|
*/
|
|
227
239
|
function _executeRemoveFunctionFromRole(bytes calldata data) internal {
|
|
228
240
|
(bytes32 roleHash, bytes4 functionSelector) = abi.decode(data, (bytes32, bytes4));
|