@agenticprimitives/contracts 1.0.0-alpha.47 → 1.0.0-alpha.49
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/AUDIT.md +36 -4
- package/deployments-faithchain.json +94 -68
- package/deployments-hopechain.json +71 -52
- package/dist/abi/AccountBootstrap.json +99 -0
- package/dist/abi/AgentAccount.json +95 -56
- package/dist/abi/AgentAccountFactory.json +189 -0
- package/dist/abi/AgentNameAttributeResolver.json +188 -0
- package/dist/abi/AgentNameRegistry.json +170 -0
- package/dist/abi/AgentNameUniversalResolver.json +188 -0
- package/dist/abi/AgentProfileResolver.json +188 -0
- package/dist/abi/AgentRegistryBase.json +193 -0
- package/dist/abi/AgentRelationship.json +193 -0
- package/dist/abi/AgenticGovernance.json +123 -0
- package/dist/abi/AgreementRegistry.json +193 -0
- package/dist/abi/AllowedMethodsEnforcer.json +193 -0
- package/dist/abi/AllowedTargetsEnforcer.json +193 -0
- package/dist/abi/ApprovedHashRegistry.json +220 -0
- package/dist/abi/AttestationRegistry.json +193 -0
- package/dist/abi/CallDataHashEnforcer.json +193 -0
- package/dist/abi/CustodyPolicy.json +195 -80
- package/dist/abi/DelegationManager.json +185 -0
- package/dist/abi/DigestBindingEnforcer.json +188 -0
- package/dist/abi/Eip7702.json +13 -0
- package/dist/abi/EstateProjectionRegistry.json +193 -0
- package/dist/abi/Generation5Bridge.json +355 -0
- package/dist/abi/GeoFeatureRegistry.json +193 -0
- package/dist/abi/ICustodyEpochView.json +28 -0
- package/dist/abi/IDelegationManager.json +18 -0
- package/dist/abi/IGeneration4Reads.json +143 -0
- package/dist/abi/IGeneration5Account.json +33 -0
- package/dist/abi/IGeneration5Voucher.json +26 -0
- package/dist/abi/IMoveAccountView.json +57 -0
- package/dist/abi/IMoveCustodyView.json +169 -0
- package/dist/abi/IMoveFactoryView.json +41 -0
- package/dist/abi/ITimelockVeto.json +93 -0
- package/dist/abi/OntologyTermRegistry.json +211 -0
- package/dist/abi/PayloadClassesEnforcer.json +193 -0
- package/dist/abi/PaymentEnforcer.json +188 -0
- package/dist/abi/PaymentEscrow.json +177 -0
- package/dist/abi/PaymentReceiptRegistry.json +206 -0
- package/dist/abi/PermissionlessSubregistry.json +188 -0
- package/dist/abi/PricedSubregistry.json +215 -0
- package/dist/abi/QuorumEnforcer.json +193 -0
- package/dist/abi/ReceiptAnchorRegistry.json +193 -0
- package/dist/abi/RelationshipTypeRegistry.json +211 -0
- package/dist/abi/ShapeRegistry.json +211 -0
- package/dist/abi/SignatureVerifier.json +196 -0
- package/dist/abi/SkillDefinitionRegistry.json +193 -0
- package/dist/abi/SmartAgentPaymaster.json +236 -1
- package/dist/abi/StableProxyGoverned.json +190 -0
- package/dist/abi/StableProxyGovernedOneShot.json +172 -0
- package/dist/abi/TimestampEnforcer.json +193 -0
- package/dist/abi/TreasurySpendPolicy.json +193 -0
- package/dist/abi/UpgradeVoucher.json +156 -4
- package/dist/abi/ValueEnforcer.json +193 -0
- package/dist/abi/index.d.ts +14 -0
- package/dist/abi/index.js +14 -0
- package/dist/deployments/faithchain.d.ts +34 -14
- package/dist/deployments/faithchain.js +93 -69
- package/dist/deployments/hopechain.d.ts +20 -7
- package/dist/deployments/hopechain.js +72 -55
- package/package.json +1 -1
- package/src/AccountBootstrap.sol +38 -0
- package/src/AgentAccount.sol +149 -41
- package/src/AgentAccountFactory.sol +52 -13
- package/src/ApprovedHashRegistry.sol +98 -9
- package/src/SmartAgentPaymaster.sol +96 -12
- package/src/UniversalSignatureValidator.sol +7 -0
- package/src/UpgradeVoucher.sol +16 -3
- package/src/agency/DelegationManager.sol +106 -32
- package/src/agency/IDelegationManager.sol +28 -0
- package/src/agreement/AgreementRegistry.sol +16 -15
- package/src/attestation/AttestationRegistry.sol +39 -16
- package/src/custody/CustodyPolicy.sol +36 -35
- package/src/custody/TreasurySpendPolicy.sol +10 -1
- package/src/enforcers/AllowedMethodsEnforcer.sol +7 -1
- package/src/enforcers/AllowedTargetsEnforcer.sol +7 -1
- package/src/enforcers/CallDataHashEnforcer.sol +7 -1
- package/src/enforcers/DigestBindingEnforcer.sol +5 -2
- package/src/enforcers/PayloadClassesEnforcer.sol +7 -1
- package/src/enforcers/PaymentEnforcer.sol +5 -2
- package/src/enforcers/QuorumEnforcer.sol +7 -1
- package/src/enforcers/TimestampEnforcer.sol +7 -1
- package/src/enforcers/ValueEnforcer.sol +7 -1
- package/src/geo/GeoFeatureRegistry.sol +15 -1
- package/src/governance/AgenticGovernance.sol +145 -0
- package/src/governance/GovernanceManaged.sol +2 -0
- package/src/governance/StableProxyGoverned.sol +79 -0
- package/src/governance/StableProxyGovernedOneShot.sol +93 -0
- package/src/identity/AgentProfileResolver.sol +11 -2
- package/src/libraries/Eip7702.sol +36 -0
- package/src/libraries/SignatureSlotRecovery.sol +4 -0
- package/src/libraries/SignatureVerifier.sol +52 -0
- package/src/libraries/WebAuthnLib.sol +3 -0
- package/src/migration/Generation5Bridge.sol +364 -0
- package/src/naming/AgentNameAttributeResolver.sol +12 -2
- package/src/naming/AgentNameRegistry.sol +84 -10
- package/src/naming/AgentNameUniversalResolver.sol +9 -2
- package/src/naming/PermissionlessSubregistry.sol +13 -2
- package/src/naming/PricedSubregistry.sol +59 -3
- package/src/ontology/OntologyTermRegistry.sol +30 -2
- package/src/ontology/ShapeRegistry.sol +30 -2
- package/src/payments/PaymentEscrow.sol +16 -1
- package/src/payments/PaymentReceiptRegistry.sol +28 -3
- package/src/provenance/ReceiptAnchorRegistry.sol +13 -1
- package/src/registry/AgentRegistryBase.sol +21 -1
- package/src/registry/EstateProjectionRegistry.sol +15 -1
- package/src/relationships/AgentRelationship.sol +17 -1
- package/src/relationships/RelationshipTypeRegistry.sol +30 -2
- package/src/skills/SkillDefinitionRegistry.sol +15 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* @title PaymentReceiptRegistry
|
|
6
9
|
* @notice Trustless, queryable settlement log for x402 pay-per-use (spec 272, PAY-CON-4 / X402-D9.3).
|
|
@@ -22,9 +25,12 @@ pragma solidity ^0.8.28;
|
|
|
22
25
|
* that needs them to be true compares them with a record it trusts (the mandate it issued, the
|
|
23
26
|
* resource it served); it never treats the row as that record.
|
|
24
27
|
*/
|
|
25
|
-
contract PaymentReceiptRegistry {
|
|
28
|
+
contract PaymentReceiptRegistry is StableProxyGoverned {
|
|
26
29
|
/// @notice The deployer who wires the sole authorized recorder once.
|
|
27
|
-
|
|
30
|
+
/// @dev Spec 447 — storage, no longer an immutable. An immutable `msg.sender` would be whoever deployed the
|
|
31
|
+
/// IMPLEMENTATION (behind a CREATE2 deploy, the singleton factory), and nobody could ever wire a proxy's
|
|
32
|
+
/// enforcer. The proxy's initializer names it explicitly.
|
|
33
|
+
address public owner;
|
|
28
34
|
/// @notice The single PaymentEnforcer permitted to `record` (set once via {setEnforcer}).
|
|
29
35
|
address public enforcer;
|
|
30
36
|
|
|
@@ -45,12 +51,28 @@ contract PaymentReceiptRegistry {
|
|
|
45
51
|
error EnforcerAlreadySet();
|
|
46
52
|
error ZeroAddress();
|
|
47
53
|
|
|
48
|
-
|
|
54
|
+
/// @notice A DIRECT deployment: the deployer is the owner, and there is no upgrade governance (frozen code, as
|
|
55
|
+
/// before). Spec 447 — behind a stable proxy, `initialize(governance_, owner_)` instead.
|
|
56
|
+
constructor() initializer {
|
|
49
57
|
owner = msg.sender;
|
|
50
58
|
}
|
|
51
59
|
|
|
60
|
+
/// @notice Spec 447 — the proxy's initializer: `governance_` is the upgrade authority; `owner_` wires the
|
|
61
|
+
/// enforcer once, as the deployer does for a direct deployment. Once per proxy.
|
|
62
|
+
function initialize(address governance_, address owner_) external initializer {
|
|
63
|
+
if (owner_ == address(0)) revert ZeroAddress();
|
|
64
|
+
_initializeGovernance(governance_);
|
|
65
|
+
owner = owner_;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// @dev The one-argument path would leave `owner` unset (nobody could ever wire the enforcer); refused.
|
|
69
|
+
function initialize(address) external pure override {
|
|
70
|
+
revert ZeroAddress();
|
|
71
|
+
}
|
|
72
|
+
|
|
52
73
|
/// @notice One-time wiring: authorize the deployed {PaymentEnforcer} as the sole recorder.
|
|
53
74
|
function setEnforcer(address enforcer_) external {
|
|
75
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
54
76
|
if (msg.sender != owner) revert NotOwner();
|
|
55
77
|
if (enforcer != address(0)) revert EnforcerAlreadySet();
|
|
56
78
|
if (enforcer_ == address(0)) revert ZeroAddress();
|
|
@@ -72,4 +94,7 @@ contract PaymentReceiptRegistry {
|
|
|
72
94
|
if (msg.sender != enforcer) revert NotEnforcer();
|
|
73
95
|
emit PaymentSettled(mandateId, payer, payee, asset, amount, resourceHash, delegationHash, nonce);
|
|
74
96
|
}
|
|
97
|
+
|
|
98
|
+
/// @dev Spec 447 — storage gap: the registry sits behind a stable proxy (the payment enforcer holds its address); layout gated by `check:storage-layouts`.
|
|
99
|
+
uint256[48] private __gap;
|
|
75
100
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title ReceiptAnchorRegistry
|
|
@@ -17,7 +19,13 @@ pragma solidity ^0.8.28;
|
|
|
17
19
|
* §1.5): rows are keyed by `(anchoredBy, receiptDigest)`, so a front-runner on a public mempool cannot
|
|
18
20
|
* squat the digest ahead of the agent, and an anchor cannot be re-attributed after the fact.
|
|
19
21
|
*/
|
|
20
|
-
contract ReceiptAnchorRegistry {
|
|
22
|
+
contract ReceiptAnchorRegistry is StableProxyGoverned {
|
|
23
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
24
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
25
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
26
|
+
/// the proxy and nothing else.
|
|
27
|
+
constructor() initializer {}
|
|
28
|
+
|
|
21
29
|
struct Anchor {
|
|
22
30
|
address anchoredBy;
|
|
23
31
|
uint64 at;
|
|
@@ -36,6 +44,7 @@ contract ReceiptAnchorRegistry {
|
|
|
36
44
|
|
|
37
45
|
/// @notice Anchor a receipt digest, once per anchorer. `intentDigest` and `mandateRef` may be zero for a run under no mandate (a read).
|
|
38
46
|
function anchor(bytes32 receiptDigest, bytes32 intentDigest, bytes32 mandateRef) external {
|
|
47
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
39
48
|
if (receiptDigest == bytes32(0)) revert ZeroDigest();
|
|
40
49
|
Anchor storage a = _anchors[msg.sender][receiptDigest];
|
|
41
50
|
if (a.anchoredBy != address(0)) revert AlreadyAnchored(receiptDigest, a.anchoredBy);
|
|
@@ -52,4 +61,7 @@ contract ReceiptAnchorRegistry {
|
|
|
52
61
|
function isAnchored(address anchoredBy, bytes32 receiptDigest) external view returns (bool) {
|
|
53
62
|
return _anchors[anchoredBy][receiptDigest].anchoredBy != address(0);
|
|
54
63
|
}
|
|
64
|
+
|
|
65
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
66
|
+
uint256[49] private __gap;
|
|
55
67
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import {IRegistryMembershipPolicy} from "./IRegistryMembershipPolicy.sol";
|
|
5
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
6
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* @title AgentRegistryBase
|
|
@@ -39,7 +41,13 @@ import {IRegistryMembershipPolicy} from "./IRegistryMembershipPolicy.sol";
|
|
|
39
41
|
*
|
|
40
42
|
* Spec 279 §4 + ADR-0010 / 0012 / 0013 / 0037 / 0038.
|
|
41
43
|
*/
|
|
42
|
-
contract AgentRegistryBase {
|
|
44
|
+
contract AgentRegistryBase is StableProxyGoverned {
|
|
45
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
46
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
47
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
48
|
+
/// the proxy and nothing else.
|
|
49
|
+
constructor() initializer {}
|
|
50
|
+
|
|
43
51
|
// ─── Constants ──────────────────────────────────────────────────────
|
|
44
52
|
|
|
45
53
|
/// @dev RB-07 — registration time is bucketed (provenance, not a precise clock). Mirrors AttestationRegistry.
|
|
@@ -135,6 +143,7 @@ contract AgentRegistryBase {
|
|
|
135
143
|
/// concern (create the registry in the same flow that mints its urn), out of scope for this base.
|
|
136
144
|
/// `policy == address(0)` ⇒ open registry: any SA may self-register, no admission gate.
|
|
137
145
|
function createRegistry(bytes32 registryId, address policy) external {
|
|
146
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
138
147
|
if (_registries[registryId].exists) revert RegistryExists();
|
|
139
148
|
_registries[registryId] = Registry({controller: msg.sender, policy: policy, exists: true});
|
|
140
149
|
emit RegistryCreated(registryId, msg.sender, policy);
|
|
@@ -146,6 +155,7 @@ contract AgentRegistryBase {
|
|
|
146
155
|
function transferController(bytes32 registryId, address newController) external {
|
|
147
156
|
Registry storage r = _registries[registryId];
|
|
148
157
|
if (!r.exists) revert RegistryNotFound();
|
|
158
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
149
159
|
if (msg.sender != r.controller) revert NotController();
|
|
150
160
|
pendingControllerOf[registryId] = newController;
|
|
151
161
|
emit RegistryControllerTransferStarted(registryId, msg.sender, newController);
|
|
@@ -155,6 +165,7 @@ contract AgentRegistryBase {
|
|
|
155
165
|
function acceptController(bytes32 registryId) external {
|
|
156
166
|
Registry storage r = _registries[registryId];
|
|
157
167
|
if (!r.exists) revert RegistryNotFound();
|
|
168
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
158
169
|
if (msg.sender != pendingControllerOf[registryId]) revert NotPendingController();
|
|
159
170
|
emit RegistryControllerTransferred(registryId, r.controller, msg.sender);
|
|
160
171
|
r.controller = msg.sender;
|
|
@@ -165,6 +176,7 @@ contract AgentRegistryBase {
|
|
|
165
176
|
function setRegistryPolicy(bytes32 registryId, address policy) external {
|
|
166
177
|
Registry storage r = _registries[registryId];
|
|
167
178
|
if (!r.exists) revert RegistryNotFound();
|
|
179
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
168
180
|
if (msg.sender != r.controller) revert NotController();
|
|
169
181
|
r.policy = policy;
|
|
170
182
|
emit RegistryPolicyUpdated(registryId, policy);
|
|
@@ -186,6 +198,7 @@ contract AgentRegistryBase {
|
|
|
186
198
|
Registry storage r = _registries[registryId];
|
|
187
199
|
if (!r.exists) revert RegistryNotFound();
|
|
188
200
|
if (subjectAgent == address(0)) revert ZeroSubject();
|
|
201
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
189
202
|
if (msg.sender != subjectAgent) revert SubjectMismatch(); // RB-01
|
|
190
203
|
if (expiresAt != 0 && expiresAt <= block.timestamp) revert InvalidExpiry();
|
|
191
204
|
|
|
@@ -223,6 +236,7 @@ contract AgentRegistryBase {
|
|
|
223
236
|
function renewEntry(bytes32 registryId, bytes32 entryId, uint64 expiresAt) external {
|
|
224
237
|
Entry storage e = _entries[_entryKey(registryId, entryId)];
|
|
225
238
|
if (e.status == EntryStatus.None) revert EntryNotFound();
|
|
239
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
226
240
|
if (msg.sender != e.subjectAgent) revert SubjectMismatch(); // RB-01
|
|
227
241
|
if (e.status != EntryStatus.Active) revert NotActive(); // RB-04 (Suspended/Revoked)
|
|
228
242
|
if (expiresAt != 0 && expiresAt <= block.timestamp) revert InvalidExpiry();
|
|
@@ -246,6 +260,7 @@ contract AgentRegistryBase {
|
|
|
246
260
|
) external {
|
|
247
261
|
Entry storage e = _entries[_entryKey(registryId, entryId)];
|
|
248
262
|
if (e.status == EntryStatus.None) revert EntryNotFound();
|
|
263
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
249
264
|
if (msg.sender != e.subjectAgent) revert SubjectMismatch(); // RB-01
|
|
250
265
|
if (e.status != EntryStatus.Active) revert NotActive(); // RB-04 (Suspended/Revoked)
|
|
251
266
|
|
|
@@ -295,6 +310,7 @@ contract AgentRegistryBase {
|
|
|
295
310
|
Entry storage e = _entries[key];
|
|
296
311
|
if (e.status == EntryStatus.None) revert EntryNotFound();
|
|
297
312
|
if (e.status == EntryStatus.Revoked) revert AlreadyRevoked(); // RB-04
|
|
313
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
298
314
|
if (msg.sender != e.subjectAgent) _requireAdmin(registryId, entryId);
|
|
299
315
|
_claims[key][claimSlotId] = claimHash;
|
|
300
316
|
emit RegistryClaimUpdated(registryId, entryId, claimSlotId, claimHash);
|
|
@@ -338,6 +354,7 @@ contract AgentRegistryBase {
|
|
|
338
354
|
/// no policy, a false return, or a revert all deny.
|
|
339
355
|
function _requireAdmin(bytes32 registryId, bytes32 entryId) internal view {
|
|
340
356
|
Registry storage r = _registries[registryId];
|
|
357
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
341
358
|
if (msg.sender == r.controller) return;
|
|
342
359
|
address policy = r.policy;
|
|
343
360
|
if (policy != address(0)) {
|
|
@@ -349,4 +366,7 @@ contract AgentRegistryBase {
|
|
|
349
366
|
}
|
|
350
367
|
revert NotAuthorized();
|
|
351
368
|
}
|
|
369
|
+
|
|
370
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
371
|
+
uint256[46] private __gap;
|
|
352
372
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title EstateProjectionRegistry — an estate's authority, projected onto PUBLIC GROUND (spec 410 §4)
|
|
@@ -42,7 +44,13 @@ pragma solidity ^0.8.28;
|
|
|
42
44
|
* WHAT THIS IS NOT: authority. A root proves what the estate vouches for at a moment; whether the
|
|
43
45
|
* receiving estate lets an agent ACT is its own mandate, per step (ADR-0056 / ADR-0057).
|
|
44
46
|
*/
|
|
45
|
-
contract EstateProjectionRegistry {
|
|
47
|
+
contract EstateProjectionRegistry is StableProxyGoverned {
|
|
48
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
49
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
50
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
51
|
+
/// the proxy and nothing else.
|
|
52
|
+
constructor() initializer {}
|
|
53
|
+
|
|
46
54
|
struct Roots {
|
|
47
55
|
bytes32 liveGrantRoot;
|
|
48
56
|
bytes32 membershipRoot;
|
|
@@ -79,6 +87,7 @@ contract EstateProjectionRegistry {
|
|
|
79
87
|
/// by at most `MAX_SEQUENCE_STEP`). The first anchor opens the caller's row. Refreshed on every
|
|
80
88
|
/// revocation and membership change; a verifier's freshness policy reads `anchoredAt`.
|
|
81
89
|
function setRoots(bytes32 estateId, bytes32 liveGrantRoot, bytes32 membershipRoot, bytes32 charterHash, uint64 sequence) external {
|
|
90
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
82
91
|
address successor = successorOf[estateId][msg.sender];
|
|
83
92
|
if (successor != address(0)) revert SignerRetired(estateId, msg.sender, successor);
|
|
84
93
|
Roots storage r = _roots[estateId][msg.sender];
|
|
@@ -101,6 +110,7 @@ contract EstateProjectionRegistry {
|
|
|
101
110
|
/// for it) — the successor anchors for itself, and the estate's declaration is what makes a
|
|
102
111
|
/// verifier read it.
|
|
103
112
|
function rotateSigner(bytes32 estateId, address to) external {
|
|
113
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
104
114
|
if (to == address(0) || to == msg.sender) revert ZeroAddress();
|
|
105
115
|
// `anchoredAt == 0` is the "this signer never anchored" sentinel (storage default), not arithmetic.
|
|
106
116
|
// slither-disable-next-line incorrect-equality
|
|
@@ -116,6 +126,7 @@ contract EstateProjectionRegistry {
|
|
|
116
126
|
/// computed from `msg.sender` and `block.chainid`, so nobody can declare for another estate.
|
|
117
127
|
/// Callable again to re-declare (rotation, or a lost key); zero clears the declaration.
|
|
118
128
|
function declareSigner(address signer) external returns (bytes32 estateId) {
|
|
129
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
119
130
|
estateId = estateIdOf(block.chainid, msg.sender);
|
|
120
131
|
declaredSignerOf[estateId] = signer;
|
|
121
132
|
emit EstateSignerDeclared(estateId, msg.sender, signer);
|
|
@@ -160,4 +171,7 @@ contract EstateProjectionRegistry {
|
|
|
160
171
|
}
|
|
161
172
|
return string(s);
|
|
162
173
|
}
|
|
174
|
+
|
|
175
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
176
|
+
uint256[47] private __gap;
|
|
163
177
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title AgentRelationship
|
|
@@ -41,7 +43,13 @@ pragma solidity ^0.8.28;
|
|
|
41
43
|
// Disabling Slither's `incorrect-equality` at the contract scope
|
|
42
44
|
// keeps these inline reads idiomatic.
|
|
43
45
|
// slither-disable-start incorrect-equality
|
|
44
|
-
contract AgentRelationship {
|
|
46
|
+
contract AgentRelationship is StableProxyGoverned {
|
|
47
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
48
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
49
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
50
|
+
/// the proxy and nothing else.
|
|
51
|
+
constructor() initializer {}
|
|
52
|
+
|
|
45
53
|
enum EdgeStatus {
|
|
46
54
|
NONE, // 0 — never set (sentinel)
|
|
47
55
|
PROPOSED, // 1
|
|
@@ -155,6 +163,7 @@ contract AgentRelationship {
|
|
|
155
163
|
) external returns (bytes32 edgeId) {
|
|
156
164
|
if (subject == address(0) || object_ == address(0)) revert InvalidEdge();
|
|
157
165
|
if (subject == object_) revert InvalidEdge();
|
|
166
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
158
167
|
if (msg.sender != subject) revert NotAuthorized();
|
|
159
168
|
edgeId = computeEdgeId(subject, object_, relationshipType);
|
|
160
169
|
bool reproposal = false;
|
|
@@ -213,6 +222,7 @@ contract AgentRelationship {
|
|
|
213
222
|
Edge storage e = _edges[edgeId];
|
|
214
223
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
215
224
|
if (e.status != EdgeStatus.PROPOSED) revert InvalidTransition();
|
|
225
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
216
226
|
if (msg.sender != e.object_) revert NotAuthorized();
|
|
217
227
|
e.status = EdgeStatus.CONFIRMED;
|
|
218
228
|
e.updatedAt = uint64(block.timestamp);
|
|
@@ -228,6 +238,7 @@ contract AgentRelationship {
|
|
|
228
238
|
Edge storage e = _edges[edgeId];
|
|
229
239
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
230
240
|
if (e.status != EdgeStatus.CONFIRMED) revert InvalidTransition();
|
|
241
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
231
242
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
232
243
|
e.status = EdgeStatus.ACTIVE;
|
|
233
244
|
e.updatedAt = uint64(block.timestamp);
|
|
@@ -265,6 +276,7 @@ contract AgentRelationship {
|
|
|
265
276
|
function addRole(bytes32 edgeId, bytes32 role) external {
|
|
266
277
|
Edge storage e = _edges[edgeId];
|
|
267
278
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
279
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
268
280
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
269
281
|
if (e.status == EdgeStatus.REVOKED) revert InvalidTransition();
|
|
270
282
|
if (_hasRole[edgeId][role]) revert RoleAlreadyExists();
|
|
@@ -321,6 +333,7 @@ contract AgentRelationship {
|
|
|
321
333
|
function setMetadata(bytes32 edgeId, string calldata metadataURI, bytes32 metadataHash) external {
|
|
322
334
|
Edge storage e = _edges[edgeId];
|
|
323
335
|
if (e.createdAt == 0) revert EdgeNotFound();
|
|
336
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
324
337
|
if (msg.sender != e.subject && msg.sender != e.object_) revert NotAuthorized();
|
|
325
338
|
if (e.status == EdgeStatus.REVOKED) revert InvalidTransition();
|
|
326
339
|
if (e.status == EdgeStatus.PROPOSED && msg.sender != e.subject) revert NotAuthorized();
|
|
@@ -398,5 +411,8 @@ contract AgentRelationship {
|
|
|
398
411
|
}
|
|
399
412
|
}
|
|
400
413
|
}
|
|
414
|
+
|
|
415
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
416
|
+
uint256[42] private __gap;
|
|
401
417
|
}
|
|
402
418
|
// slither-disable-end incorrect-equality
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title RelationshipTypeRegistry
|
|
@@ -20,7 +22,7 @@ pragma solidity ^0.8.28;
|
|
|
20
22
|
* (`packages/contracts/src/RelationshipTypeRegistry.sol`, 138 LOC) —
|
|
21
23
|
* structurally identical with constructor zero-governor guard.
|
|
22
24
|
*/
|
|
23
|
-
contract RelationshipTypeRegistry {
|
|
25
|
+
contract RelationshipTypeRegistry is StableProxyGoverned {
|
|
24
26
|
struct TypeSemantics {
|
|
25
27
|
bytes32 relationshipType;
|
|
26
28
|
string label;
|
|
@@ -45,13 +47,35 @@ contract RelationshipTypeRegistry {
|
|
|
45
47
|
error TypeExists();
|
|
46
48
|
error TypeNotFound();
|
|
47
49
|
error ZeroGovernor();
|
|
50
|
+
/// @dev Spec 447 — `initialize(address)` alone would leave the governor unset.
|
|
51
|
+
error GovernorRequired();
|
|
48
52
|
|
|
49
53
|
modifier onlyGovernor() {
|
|
54
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
50
55
|
if (msg.sender != governor) revert NotGovernor();
|
|
51
56
|
_;
|
|
52
57
|
}
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
/// @notice A DIRECT deployment: `governor_` runs the registry, and there is no upgrade governance (the code is
|
|
60
|
+
/// frozen, as before). Spec 447 — behind a stable proxy, `initialize(governance_, governor_)` instead.
|
|
61
|
+
constructor(address governor_) initializer {
|
|
62
|
+
_initGovernor(governor_);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/// @notice Spec 447 — the proxy's initializer: `governance_` is the upgrade authority (only); `governor_` runs
|
|
66
|
+
/// the registry, exactly as the constructor's argument does. Once per proxy; never on the implementation.
|
|
67
|
+
function initialize(address governance_, address governor_) external initializer {
|
|
68
|
+
_initializeGovernance(governance_);
|
|
69
|
+
_initGovernor(governor_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// @dev Spec 447 — the one-argument path would leave `governor` unset (a registry nobody can run), so it is
|
|
73
|
+
/// refused: `initialize(governance_, governor_)` is this contract's only initializer.
|
|
74
|
+
function initialize(address) external pure override {
|
|
75
|
+
revert GovernorRequired();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function _initGovernor(address governor_) private {
|
|
55
79
|
if (governor_ == address(0)) revert ZeroGovernor();
|
|
56
80
|
governor = governor_;
|
|
57
81
|
}
|
|
@@ -84,6 +108,7 @@ contract RelationshipTypeRegistry {
|
|
|
84
108
|
|
|
85
109
|
/// @notice Take the governor role. Only the proposed successor.
|
|
86
110
|
function acceptGovernor() external {
|
|
111
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
87
112
|
if (msg.sender != pendingGovernor || msg.sender == address(0)) revert NotPendingGovernor();
|
|
88
113
|
emit GovernorTransferred(governor, msg.sender);
|
|
89
114
|
governor = msg.sender;
|
|
@@ -168,4 +193,7 @@ contract RelationshipTypeRegistry {
|
|
|
168
193
|
function getAllTypeIds() external view returns (bytes32[] memory) {
|
|
169
194
|
return _typeIds;
|
|
170
195
|
}
|
|
196
|
+
|
|
197
|
+
/// @dev Spec 447 — storage gap: the registry may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
198
|
+
uint256[46] private __gap;
|
|
171
199
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
|
+
import "../governance/StableProxyGoverned.sol";
|
|
4
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @title SkillDefinitionRegistry
|
|
@@ -35,7 +37,13 @@ pragma solidity ^0.8.28;
|
|
|
35
37
|
* Ported from smart-agent `SkillDefinitionRegistry`; diverges per spec 251 (AP
|
|
36
38
|
* auth model, C-box-anchored kinds, no `.skill` name binding in v1).
|
|
37
39
|
*/
|
|
38
|
-
contract SkillDefinitionRegistry {
|
|
40
|
+
contract SkillDefinitionRegistry is StableProxyGoverned {
|
|
41
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
42
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
43
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
44
|
+
/// the proxy and nothing else.
|
|
45
|
+
constructor() initializer {}
|
|
46
|
+
|
|
39
47
|
// ─── C-box skill-kind codelist (keccak of the cbox vocabulary URIs) ──
|
|
40
48
|
// Concept URIs are declared in packages/ontology cbox/skill-vocabulary.ttl
|
|
41
49
|
// (scheme aps:skillKind); the lockstep gate asserts these equal keccak of
|
|
@@ -108,6 +116,7 @@ contract SkillDefinitionRegistry {
|
|
|
108
116
|
if (p.skillId == bytes32(0)) revert EmptyId();
|
|
109
117
|
if (bytes(p.metadataURI).length == 0) revert EmptyMetadata();
|
|
110
118
|
// SDR-02 — only the steward SA, acting through its own execute() path.
|
|
119
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
111
120
|
if (msg.sender != p.stewardAccount) revert NotSteward();
|
|
112
121
|
|
|
113
122
|
uint64 prevVer = latestVersion[p.skillId];
|
|
@@ -150,6 +159,7 @@ contract SkillDefinitionRegistry {
|
|
|
150
159
|
uint64 v = latestVersion[skillId];
|
|
151
160
|
if (v == 0) revert SkillNotFound();
|
|
152
161
|
SkillRecord storage r = _records[skillId][v];
|
|
162
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
153
163
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
154
164
|
r.active = false;
|
|
155
165
|
emit SkillDeactivated(skillId, v);
|
|
@@ -159,6 +169,7 @@ contract SkillDefinitionRegistry {
|
|
|
159
169
|
function setValidity(bytes32 skillId, uint64 version, uint64 validAfter, uint64 validUntil) external {
|
|
160
170
|
SkillRecord storage r = _records[skillId][version];
|
|
161
171
|
if (r.version == 0) revert SkillNotFound();
|
|
172
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
162
173
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
163
174
|
// REG-15: a published version's window can be ENDED, never rewritten. `validAfter` is fixed at
|
|
164
175
|
// publish; `validUntil` may be set (0 → a time) or moved earlier, not extended or cleared — a
|
|
@@ -208,4 +219,7 @@ contract SkillDefinitionRegistry {
|
|
|
208
219
|
page = new bytes32[](end - offset);
|
|
209
220
|
for (uint256 i = offset; i < end; i++) page[i - offset] = _allSkills[i];
|
|
210
221
|
}
|
|
222
|
+
|
|
223
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
224
|
+
uint256[47] private __gap;
|
|
211
225
|
}
|