@agenticprimitives/contracts 1.0.0-alpha.25 → 1.0.0-alpha.27

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.
Files changed (33) hide show
  1. package/AUDIT.md +5 -0
  2. package/README.md +2 -0
  3. package/deployments-faithchain.json +2 -1
  4. package/dist/abi/AgentAccount.json +127 -0
  5. package/dist/abi/AgentAccountFactory.json +18 -0
  6. package/dist/abi/ApprovedHashRegistry.json +47 -2
  7. package/dist/abi/CustodyPolicy.json +35 -0
  8. package/dist/abi/DigestBindingEnforcer.json +125 -3
  9. package/dist/abi/EstateProjectionRegistry.json +293 -0
  10. package/dist/abi/IApprovedHashRegistryWrite.json +35 -0
  11. package/dist/abi/ICustodyPolicyAccountModuleView.json +31 -0
  12. package/dist/abi/PayloadClassesEnforcer.json +117 -0
  13. package/dist/abi/{ContentCorpusRegistry.json → ReceiptAnchorRegistry.json} +61 -82
  14. package/dist/abi/TreasurySpendPolicy.json +369 -0
  15. package/dist/abi/index.d.ts +6 -0
  16. package/dist/abi/index.js +6 -0
  17. package/dist/deployments/faithchain.d.ts +1 -0
  18. package/dist/deployments/faithchain.js +1 -0
  19. package/package.json +16 -5
  20. package/src/AgentAccount.sol +137 -7
  21. package/src/AgentAccountFactory.sol +17 -10
  22. package/src/ApprovedHashRegistry.sol +41 -6
  23. package/src/IAgentAccount.sol +23 -0
  24. package/src/custody/CustodyPolicy.sol +72 -2
  25. package/src/custody/TreasurySpendPolicy.sol +166 -0
  26. package/src/enforcers/DigestBindingEnforcer.sol +45 -10
  27. package/src/enforcers/PayloadClassesEnforcer.sol +30 -0
  28. package/src/provenance/ReceiptAnchorRegistry.sol +55 -0
  29. package/src/registry/EstateProjectionRegistry.sol +109 -0
  30. package/deployments-anvil.json +0 -1
  31. package/dist/abi/AgentSkillClaimRegistry.json +0 -735
  32. package/dist/abi/IERC1271.json +0 -26
  33. package/dist/abi/ValidationAttestationRegistry.json +0 -205
package/AUDIT.md CHANGED
@@ -52,6 +52,11 @@ This package ships the **on-chain enforcement layer** for the agenticprimitives
52
52
  | 2.12 | **CustodyPolicy reinstall is permanently forbidden.** | ✅ CLOSED audit C-11 | `CustodyPolicy.sol:onUninstall` + `onInstall` reinstall gate; tested in `CustodyPolicyWave2C.t.sol` |
53
53
  | 2.13 | **`SmartAgentPaymaster.getHash` binds `address(entryPoint)` + chainId.** | ✅ CLOSED H7-C.7 / CON-PAYMASTER-004 | `SmartAgentPaymaster.sol:206-222`; tested in `SmartAgentPaymasterValidateR610.t.sol` |
54
54
  | 2.14 | **`SmartAgentPaymaster` constructor takes EXPLICIT `devMode` (no implicit fail-open).** | ✅ CLOSED R5.7 / PKG-PAYMASTER-002 / external audit P0-2 | `SmartAgentPaymaster.sol:126-141`; tested in `SmartAgentPaymaster.t.sol::test_R5_7_*` |
55
+ | 2.15 | **The account's `execute` never reaches its own custody-tier contracts from below the custody tier.** `CustodyPolicy.onUninstall` reverts `StillInstalledOn` unless `uninstallModule` already dropped the module; a delegation stack (`_delegationExecCtx`) may not target `custodyPolicy` or `approvedHashRegistry` at all. | ✅ CLOSED R917-C-1 (spec 408 §1.1) | `CustodyPolicy.sol:onUninstall`, `AgentAccount.sol:_isAccountTrustedTarget`; `test/HardeningR917.t.sol` |
56
+ | 2.16 | **An approved hash dies with the custody set that approved it.** The `0x03` sentinel consults `isApproved(this, keccak256(hash ‖ custodyEpoch))`; `custodyEpoch` bumps on every credential retirement (`removeCustodian` / `removePasskey`); `ApprovedHashRegistry.revokeAll()` voids per signer. | ✅ CLOSED R917-C-2 (spec 408 §1.2) | `AgentAccount.sol:approvedHashKey`, `ApprovedHashRegistry.sol`; `test/HardeningR917.t.sol`, `test/ApprovedHashIsValidSignature.t.sol` |
57
+ | 2.17 | **A digest-bound redemption is single-use per step.** `DigestBindingEnforcer` is stateful + DM-only: `(delegator, delegationHash, kind, stepNonce)` consumed in `beforeHook`. | ✅ CLOSED R917-C-4 (spec 408 §1.4) | `enforcers/DigestBindingEnforcer.sol`; `test/DigestBindingEnforcer.t.sol` |
58
+ | 2.18 | **Network posture is a constructor fact, never a chain-id list.** `AgentAccountFactory.relaxedT4Floor` (immutable) is the only way to lift the 1 h T4 floor; recorded in the deployments JSON; refused by `check:production-deploy` off anvil. | ✅ CLOSED R917-C-5 (spec 408 §1.3) | `AgentAccountFactory.sol:_custodyInitData`; `test/AgentAccountFactoryMode.t.sol` |
59
+ | 2.19 | **Receipt anchors are keyed by who anchored.** `(anchoredBy, receiptDigest)` — no squat on a public mempool. | ✅ CLOSED R917-C-3 (spec 408 §1.5) | `provenance/ReceiptAnchorRegistry.sol`; `test/provenance/ReceiptAnchorRegistry.t.sol` |
55
60
 
56
61
  ## 3. Per-contract notes for the external review
57
62
 
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @agenticprimitives/contracts
2
2
 
3
+ > Part of **[Agentic Primitives](https://agenticprimitives.dev)** — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. [Developer kit](https://github.com/agentictrustlabs/agentic-primitives) · [All packages](https://agenticprimitives.dev/developers)
4
+
3
5
  **Contracts and SDK are one artifact.**
4
6
 
5
7
  This is the on-chain enforcement layer of the agenticprimitives substrate — 42 Solidity sources, all present and audited under `src/`, none of them stubs. ERC-4337 v0.7 Smart Agent core, ERC-7710-style delegation manager with caveat enforcers, an ERC-7579 modular CustodyPolicy, a three-mode paymaster, `.agent` TLD naming with hierarchical subregistries, ontology and profile resolvers, identity facets, and an ERC-6492-aware UniversalSignatureValidator. The package publishes ABI subpaths, per-network deployment JSON, flattened sources, and the Solidity itself — so a TypeScript consumer pulls addresses and ABIs from the same artifact the auditors read.
@@ -45,5 +45,6 @@
45
45
  "household": "0x9c3373E8F28739Df3aA478C18209fD7eeD769F5b"
46
46
  },
47
47
  "agentRegistryBase": "0x0Be172F1b5cfD1d084CEc2cF2Af0A0cE9023Deb1",
48
- "digestBindingEnforcer": "0xA3bb9BCC9b2F6F2419E1aBe5ED6Fd5399b9E68e1"
48
+ "digestBindingEnforcer": "0xA3bb9BCC9b2F6F2419E1aBe5ED6Fd5399b9E68e1",
49
+ "receiptAnchorRegistry": "0x0e339334B4438F7546FD53837FDC8943cB3Cf54C"
49
50
  }
@@ -99,6 +99,38 @@
99
99
  "outputs": [],
100
100
  "stateMutability": "nonpayable"
101
101
  },
102
+ {
103
+ "type": "function",
104
+ "name": "approveDigest",
105
+ "inputs": [
106
+ {
107
+ "name": "digest",
108
+ "type": "bytes32",
109
+ "internalType": "bytes32"
110
+ }
111
+ ],
112
+ "outputs": [],
113
+ "stateMutability": "nonpayable"
114
+ },
115
+ {
116
+ "type": "function",
117
+ "name": "approvedHashKey",
118
+ "inputs": [
119
+ {
120
+ "name": "hash",
121
+ "type": "bytes32",
122
+ "internalType": "bytes32"
123
+ }
124
+ ],
125
+ "outputs": [
126
+ {
127
+ "name": "",
128
+ "type": "bytes32",
129
+ "internalType": "bytes32"
130
+ }
131
+ ],
132
+ "stateMutability": "view"
133
+ },
102
134
  {
103
135
  "type": "function",
104
136
  "name": "bundlerSigner",
@@ -138,6 +170,19 @@
138
170
  ],
139
171
  "stateMutability": "view"
140
172
  },
173
+ {
174
+ "type": "function",
175
+ "name": "custodyEpoch",
176
+ "inputs": [],
177
+ "outputs": [
178
+ {
179
+ "name": "",
180
+ "type": "uint64",
181
+ "internalType": "uint64"
182
+ }
183
+ ],
184
+ "stateMutability": "view"
185
+ },
141
186
  {
142
187
  "type": "function",
143
188
  "name": "decodeWebAuthnAssertion",
@@ -775,6 +820,26 @@
775
820
  "outputs": [],
776
821
  "stateMutability": "nonpayable"
777
822
  },
823
+ {
824
+ "type": "function",
825
+ "name": "revokeAllApprovedDigests",
826
+ "inputs": [],
827
+ "outputs": [],
828
+ "stateMutability": "nonpayable"
829
+ },
830
+ {
831
+ "type": "function",
832
+ "name": "revokeDigest",
833
+ "inputs": [
834
+ {
835
+ "name": "digest",
836
+ "type": "bytes32",
837
+ "internalType": "bytes32"
838
+ }
839
+ ],
840
+ "outputs": [],
841
+ "stateMutability": "nonpayable"
842
+ },
778
843
  {
779
844
  "type": "function",
780
845
  "name": "scheduleUpgrade",
@@ -1045,6 +1110,12 @@
1045
1110
  ],
1046
1111
  "stateMutability": "pure"
1047
1112
  },
1113
+ {
1114
+ "type": "event",
1115
+ "name": "AllDigestsRevoked",
1116
+ "inputs": [],
1117
+ "anonymous": false
1118
+ },
1048
1119
  {
1049
1120
  "type": "event",
1050
1121
  "name": "CustodianAdded",
@@ -1071,6 +1142,19 @@
1071
1142
  ],
1072
1143
  "anonymous": false
1073
1144
  },
1145
+ {
1146
+ "type": "event",
1147
+ "name": "CustodyEpochBumped",
1148
+ "inputs": [
1149
+ {
1150
+ "name": "epoch",
1151
+ "type": "uint64",
1152
+ "indexed": false,
1153
+ "internalType": "uint64"
1154
+ }
1155
+ ],
1156
+ "anonymous": false
1157
+ },
1074
1158
  {
1075
1159
  "type": "event",
1076
1160
  "name": "DelegationManagerRotated",
@@ -1084,6 +1168,44 @@
1084
1168
  ],
1085
1169
  "anonymous": false
1086
1170
  },
1171
+ {
1172
+ "type": "event",
1173
+ "name": "DigestApproved",
1174
+ "inputs": [
1175
+ {
1176
+ "name": "digest",
1177
+ "type": "bytes32",
1178
+ "indexed": true,
1179
+ "internalType": "bytes32"
1180
+ },
1181
+ {
1182
+ "name": "epoch",
1183
+ "type": "uint64",
1184
+ "indexed": false,
1185
+ "internalType": "uint64"
1186
+ }
1187
+ ],
1188
+ "anonymous": false
1189
+ },
1190
+ {
1191
+ "type": "event",
1192
+ "name": "DigestRevoked",
1193
+ "inputs": [
1194
+ {
1195
+ "name": "digest",
1196
+ "type": "bytes32",
1197
+ "indexed": true,
1198
+ "internalType": "bytes32"
1199
+ },
1200
+ {
1201
+ "name": "epoch",
1202
+ "type": "uint64",
1203
+ "indexed": false,
1204
+ "internalType": "uint64"
1205
+ }
1206
+ ],
1207
+ "anonymous": false
1208
+ },
1087
1209
  {
1088
1210
  "type": "event",
1089
1211
  "name": "Initialized",
@@ -1303,6 +1425,11 @@
1303
1425
  }
1304
1426
  ]
1305
1427
  },
1428
+ {
1429
+ "type": "error",
1430
+ "name": "ApprovedHashRegistryOnlyViaAccount",
1431
+ "inputs": []
1432
+ },
1306
1433
  {
1307
1434
  "type": "error",
1308
1435
  "name": "CannotRemoveLastCustodian",
@@ -36,6 +36,11 @@
36
36
  "name": "approvedHashRegistry_",
37
37
  "type": "address",
38
38
  "internalType": "address"
39
+ },
40
+ {
41
+ "name": "relaxedT4Floor_",
42
+ "type": "bool",
43
+ "internalType": "bool"
39
44
  }
40
45
  ],
41
46
  "stateMutability": "nonpayable"
@@ -289,6 +294,19 @@
289
294
  ],
290
295
  "stateMutability": "view"
291
296
  },
297
+ {
298
+ "type": "function",
299
+ "name": "relaxedT4Floor",
300
+ "inputs": [],
301
+ "outputs": [
302
+ {
303
+ "name": "",
304
+ "type": "bool",
305
+ "internalType": "bool"
306
+ }
307
+ ],
308
+ "stateMutability": "view"
309
+ },
292
310
  {
293
311
  "type": "function",
294
312
  "name": "sessionIssuer",
@@ -17,12 +17,12 @@
17
17
  "name": "approved",
18
18
  "inputs": [
19
19
  {
20
- "name": "",
20
+ "name": "signer",
21
21
  "type": "address",
22
22
  "internalType": "address"
23
23
  },
24
24
  {
25
- "name": "",
25
+ "name": "hash",
26
26
  "type": "bytes32",
27
27
  "internalType": "bytes32"
28
28
  }
@@ -36,6 +36,25 @@
36
36
  ],
37
37
  "stateMutability": "view"
38
38
  },
39
+ {
40
+ "type": "function",
41
+ "name": "epochOf",
42
+ "inputs": [
43
+ {
44
+ "name": "signer",
45
+ "type": "address",
46
+ "internalType": "address"
47
+ }
48
+ ],
49
+ "outputs": [
50
+ {
51
+ "name": "",
52
+ "type": "uint64",
53
+ "internalType": "uint64"
54
+ }
55
+ ],
56
+ "stateMutability": "view"
57
+ },
39
58
  {
40
59
  "type": "function",
41
60
  "name": "isApproved",
@@ -60,6 +79,13 @@
60
79
  ],
61
80
  "stateMutability": "view"
62
81
  },
82
+ {
83
+ "type": "function",
84
+ "name": "revokeAll",
85
+ "inputs": [],
86
+ "outputs": [],
87
+ "stateMutability": "nonpayable"
88
+ },
63
89
  {
64
90
  "type": "function",
65
91
  "name": "revokeHash",
@@ -73,6 +99,25 @@
73
99
  "outputs": [],
74
100
  "stateMutability": "nonpayable"
75
101
  },
102
+ {
103
+ "type": "event",
104
+ "name": "AllHashesRevoked",
105
+ "inputs": [
106
+ {
107
+ "name": "signer",
108
+ "type": "address",
109
+ "indexed": true,
110
+ "internalType": "address"
111
+ },
112
+ {
113
+ "name": "epoch",
114
+ "type": "uint64",
115
+ "indexed": false,
116
+ "internalType": "uint64"
117
+ }
118
+ ],
119
+ "anonymous": false
120
+ },
76
121
  {
77
122
  "type": "event",
78
123
  "name": "HashApproved",
@@ -443,6 +443,25 @@
443
443
  ],
444
444
  "anonymous": false
445
445
  },
446
+ {
447
+ "type": "event",
448
+ "name": "CredentialRotated",
449
+ "inputs": [
450
+ {
451
+ "name": "account",
452
+ "type": "address",
453
+ "indexed": true,
454
+ "internalType": "address"
455
+ },
456
+ {
457
+ "name": "reapproved",
458
+ "type": "uint256",
459
+ "indexed": false,
460
+ "internalType": "uint256"
461
+ }
462
+ ],
463
+ "anonymous": false
464
+ },
446
465
  {
447
466
  "type": "event",
448
467
  "name": "CustodiansRemovedDuringRotation",
@@ -1039,6 +1058,11 @@
1039
1058
  }
1040
1059
  ]
1041
1060
  },
1061
+ {
1062
+ "type": "error",
1063
+ "name": "RotationNeedsOneAddAndOneRemove",
1064
+ "inputs": []
1065
+ },
1042
1066
  {
1043
1067
  "type": "error",
1044
1068
  "name": "SeparationOfDutiesViolation",
@@ -1076,6 +1100,17 @@
1076
1100
  }
1077
1101
  ]
1078
1102
  },
1103
+ {
1104
+ "type": "error",
1105
+ "name": "StillInstalledOn",
1106
+ "inputs": [
1107
+ {
1108
+ "name": "account",
1109
+ "type": "address",
1110
+ "internalType": "address"
1111
+ }
1112
+ ]
1113
+ },
1079
1114
  {
1080
1115
  "type": "error",
1081
1116
  "name": "SystemPaused",
@@ -1,4 +1,15 @@
1
1
  [
2
+ {
3
+ "type": "constructor",
4
+ "inputs": [
5
+ {
6
+ "name": "delegationManager_",
7
+ "type": "address",
8
+ "internalType": "address"
9
+ }
10
+ ],
11
+ "stateMutability": "nonpayable"
12
+ },
2
13
  {
3
14
  "type": "function",
4
15
  "name": "afterHook",
@@ -62,12 +73,12 @@
62
73
  "internalType": "bytes"
63
74
  },
64
75
  {
65
- "name": "",
76
+ "name": "delegationHash",
66
77
  "type": "bytes32",
67
78
  "internalType": "bytes32"
68
79
  },
69
80
  {
70
- "name": "",
81
+ "name": "delegator",
71
82
  "type": "address",
72
83
  "internalType": "address"
73
84
  },
@@ -93,7 +104,91 @@
93
104
  }
94
105
  ],
95
106
  "outputs": [],
96
- "stateMutability": "pure"
107
+ "stateMutability": "nonpayable"
108
+ },
109
+ {
110
+ "type": "function",
111
+ "name": "delegationManager",
112
+ "inputs": [],
113
+ "outputs": [
114
+ {
115
+ "name": "",
116
+ "type": "address",
117
+ "internalType": "address"
118
+ }
119
+ ],
120
+ "stateMutability": "view"
121
+ },
122
+ {
123
+ "type": "function",
124
+ "name": "isUsed",
125
+ "inputs": [
126
+ {
127
+ "name": "delegator",
128
+ "type": "address",
129
+ "internalType": "address"
130
+ },
131
+ {
132
+ "name": "delegationHash",
133
+ "type": "bytes32",
134
+ "internalType": "bytes32"
135
+ },
136
+ {
137
+ "name": "kind",
138
+ "type": "bytes32",
139
+ "internalType": "bytes32"
140
+ },
141
+ {
142
+ "name": "stepNonce",
143
+ "type": "bytes32",
144
+ "internalType": "bytes32"
145
+ }
146
+ ],
147
+ "outputs": [
148
+ {
149
+ "name": "",
150
+ "type": "bool",
151
+ "internalType": "bool"
152
+ }
153
+ ],
154
+ "stateMutability": "view"
155
+ },
156
+ {
157
+ "type": "event",
158
+ "name": "DigestBindingRedeemed",
159
+ "inputs": [
160
+ {
161
+ "name": "delegator",
162
+ "type": "address",
163
+ "indexed": true,
164
+ "internalType": "address"
165
+ },
166
+ {
167
+ "name": "delegationHash",
168
+ "type": "bytes32",
169
+ "indexed": true,
170
+ "internalType": "bytes32"
171
+ },
172
+ {
173
+ "name": "kind",
174
+ "type": "bytes32",
175
+ "indexed": true,
176
+ "internalType": "bytes32"
177
+ },
178
+ {
179
+ "name": "presented",
180
+ "type": "bytes32",
181
+ "indexed": false,
182
+ "internalType": "bytes32"
183
+ },
184
+ {
185
+ "name": "stepNonce",
186
+ "type": "bytes32",
187
+ "indexed": false,
188
+ "internalType": "bytes32"
189
+ }
190
+ ],
191
+ "anonymous": false
97
192
  },
98
193
  {
99
194
  "type": "error",
@@ -125,5 +220,32 @@
125
220
  "internalType": "bytes32"
126
221
  }
127
222
  ]
223
+ },
224
+ {
225
+ "type": "error",
226
+ "name": "NotDelegationManager",
227
+ "inputs": [
228
+ {
229
+ "name": "caller",
230
+ "type": "address",
231
+ "internalType": "address"
232
+ }
233
+ ]
234
+ },
235
+ {
236
+ "type": "error",
237
+ "name": "StepNonceReused",
238
+ "inputs": [
239
+ {
240
+ "name": "kind",
241
+ "type": "bytes32",
242
+ "internalType": "bytes32"
243
+ },
244
+ {
245
+ "name": "stepNonce",
246
+ "type": "bytes32",
247
+ "internalType": "bytes32"
248
+ }
249
+ ]
128
250
  }
129
251
  ]