@agenticprimitives/contracts 1.0.0-alpha.48 → 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/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/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
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
5
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
5
6
|
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
7
|
+
import "../governance/StableProxyGoverned.sol";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @title AgreementRegistry
|
|
@@ -35,7 +37,13 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
|
35
37
|
* commitment — one row per agreement, read API unchanged.
|
|
36
38
|
* AR-14 (REG-7) nullifiers are scoped to the agreement: an unrelated agreement cannot burn one.
|
|
37
39
|
*/
|
|
38
|
-
contract AgreementRegistry {
|
|
40
|
+
contract AgreementRegistry 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
|
// ─── Constants ──────────────────────────────────────────────────────
|
|
40
48
|
|
|
41
49
|
uint64 public constant EPOCH_SECONDS = 3600;
|
|
@@ -333,20 +341,16 @@ contract AgreementRegistry {
|
|
|
333
341
|
|
|
334
342
|
// ─── Internal ───────────────────────────────────────────────────────
|
|
335
343
|
|
|
336
|
-
/// @dev ERC-1271 for contract signers, low-s ECDSA for EOAs. REG-16
|
|
337
|
-
///
|
|
338
|
-
///
|
|
339
|
-
///
|
|
344
|
+
/// @dev ERC-1271 for contract signers, low-s ECDSA for EOAs. REG-16 / spec 448 §0 (EIP-7702): a delegated
|
|
345
|
+
/// EOA (`0xef0100 ‖ delegate`) is an EOA here — ECDSA only. Its attached code is never asked, because
|
|
346
|
+
/// whoever obtained one authorization signature from the key chose that code. One mechanism per kind
|
|
347
|
+
/// of signer (ADR-0013).
|
|
340
348
|
function _isValidSignatureBool(
|
|
341
349
|
address signer,
|
|
342
350
|
bytes32 digest,
|
|
343
351
|
bytes memory signature
|
|
344
352
|
) internal view returns (bool) {
|
|
345
|
-
|
|
346
|
-
if (codeLen > 0) {
|
|
347
|
-
if (_erc1271Ok(signer, digest, signature)) return true;
|
|
348
|
-
if (!_isDelegatedEoa(signer, codeLen)) return false;
|
|
349
|
-
}
|
|
353
|
+
if (signer.code.length > 0 && !Eip7702.isDelegatedEOA(signer)) return _erc1271Ok(signer, digest, signature);
|
|
350
354
|
// P2-2 (audit 2026-06-10): OpenZeppelin ECDSA.tryRecover rejects high-s (malleable) signatures and
|
|
351
355
|
// malformed lengths. The error value is checked explicitly: on any error `recovered` is zero and
|
|
352
356
|
// is NOT compared (a zero `signer` can therefore never match).
|
|
@@ -367,9 +371,6 @@ contract AgreementRegistry {
|
|
|
367
371
|
return bytes32(ret) == bytes32(IERC1271.isValidSignature.selector);
|
|
368
372
|
}
|
|
369
373
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
bytes memory c = a.code;
|
|
373
|
-
return c[0] == 0xef && c[1] == 0x01 && c[2] == 0x00;
|
|
374
|
-
}
|
|
374
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
375
|
+
uint256[48] private __gap;
|
|
375
376
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
5
|
+
import {Eip7702} from "../libraries/Eip7702.sol";
|
|
5
6
|
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
7
|
+
import "../governance/StableProxyGoverned.sol";
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* @title AttestationRegistry
|
|
@@ -35,7 +37,8 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
|
35
37
|
* AR-06 NO issuerRevoke(...) entrypoint — by static analysis
|
|
36
38
|
* AR-07 epoch-bucket timestamps; raw block.timestamp never stored
|
|
37
39
|
* AR-08 four indexed event topics (EAS-like)
|
|
38
|
-
* AR-09
|
|
40
|
+
* AR-09 no admin. A direct deployment is immutable; spec 447 — behind a stable proxy, governance may replace the
|
|
41
|
+
* code (and nothing else). Its digests bind `address(this)` per call, so they name the proxy and survive a fix.
|
|
39
42
|
* AR-10 (spec 445 / REG-3, ledger ATT-2) revocation follows the attestation's CONTENT, not its salt:
|
|
40
43
|
* the content id is the UID without the salt, plus the schema — (subject, party2, issuer, schemaId,
|
|
41
44
|
* credentialType, credentialHash, refUID). Revoking any row revokes that content: it cannot be
|
|
@@ -47,7 +50,13 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
|
47
50
|
*
|
|
48
51
|
* Spec 242 §9 + ADR-0023.
|
|
49
52
|
*/
|
|
50
|
-
contract AttestationRegistry {
|
|
53
|
+
contract AttestationRegistry is StableProxyGoverned {
|
|
54
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
55
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
56
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
57
|
+
/// the proxy and nothing else.
|
|
58
|
+
constructor() initializer {}
|
|
59
|
+
|
|
51
60
|
// ─── Constants ──────────────────────────────────────────────────────
|
|
52
61
|
|
|
53
62
|
uint64 public constant EPOCH_SECONDS = 3600;
|
|
@@ -184,6 +193,7 @@ contract AttestationRegistry {
|
|
|
184
193
|
if (req.credentialHash == bytes32(0)) revert EmptyCredentialHash();
|
|
185
194
|
// AR-11 / REG-8: the holder anchors its own association. Anyone holding the issuer's signature
|
|
186
195
|
// could previously publish the subject↔issuer link (and pick the status-list pointer).
|
|
196
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
187
197
|
if (msg.sender != req.subject) revert NotSubject();
|
|
188
198
|
|
|
189
199
|
// SC-2: RECOMPUTE the issuer-attestation digest binding the SUBJECT (+ schema / type / chain /
|
|
@@ -305,6 +315,11 @@ contract AttestationRegistry {
|
|
|
305
315
|
{
|
|
306
316
|
bytes32 cid = _contentId(req.party1, req.party2, req.issuer, req.schemaId, req.credentialType, req.credentialHash, req.refUID);
|
|
307
317
|
if (_contentRevokedAt[cid] != 0) revert ContentRevoked(cid);
|
|
318
|
+
// Audit 2026-12-02 C4-4: the content id above includes the issuer, the schema and the credential type —
|
|
319
|
+
// three fields the consent signatures do NOT cover and a re-anchorer chooses. A party's revocation
|
|
320
|
+
// therefore also follows exactly what the two parties signed.
|
|
321
|
+
cid = _jointConsentKey(req.party1, req.party2, req.refUID, req.credentialHash);
|
|
322
|
+
if (_contentRevokedAt[cid] != 0) revert ContentRevoked(cid);
|
|
308
323
|
}
|
|
309
324
|
|
|
310
325
|
bytes32 uid = _computeUid(
|
|
@@ -402,6 +417,21 @@ contract AttestationRegistry {
|
|
|
402
417
|
if (bucket == 0) bucket = 1;
|
|
403
418
|
a.revocationEpochBucket = bucket;
|
|
404
419
|
_contentRevokedAt[cid] = bucket;
|
|
420
|
+
// C4-4: a joint agreement is revoked for what its parties consented to, whoever anchors it next.
|
|
421
|
+
if (a.party2 != address(0)) {
|
|
422
|
+
_contentRevokedAt[_jointConsentKey(a.subject, a.party2, a.refUID, a.credentialHash)] = bucket;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/// @dev Key of "the two parties' consent to (refUID, credentialHash) was withdrawn", kept in
|
|
427
|
+
/// `_contentRevokedAt` beside the content ids. The leading tag keeps the two key spaces apart (a content
|
|
428
|
+
/// id is the hash of seven words, this of five, the first of them the tag).
|
|
429
|
+
function _jointConsentKey(address party1, address party2, bytes32 refUID, bytes32 credentialHash)
|
|
430
|
+
internal
|
|
431
|
+
pure
|
|
432
|
+
returns (bytes32)
|
|
433
|
+
{
|
|
434
|
+
return keccak256(abi.encode(keccak256("agenticprimitives.joint-consent-revoked"), party1, party2, refUID, credentialHash));
|
|
405
435
|
}
|
|
406
436
|
|
|
407
437
|
function _contentIdOf(Attestation storage a) internal view returns (bytes32) {
|
|
@@ -435,20 +465,16 @@ contract AttestationRegistry {
|
|
|
435
465
|
);
|
|
436
466
|
}
|
|
437
467
|
|
|
438
|
-
/// @dev ERC-1271 for contract signers, low-s ECDSA for EOAs. REG-16
|
|
439
|
-
///
|
|
440
|
-
///
|
|
441
|
-
///
|
|
468
|
+
/// @dev ERC-1271 for contract signers, low-s ECDSA for EOAs. REG-16 / spec 448 §0 (EIP-7702): a delegated
|
|
469
|
+
/// EOA (`0xef0100 ‖ delegate`) is an EOA here — ECDSA only. Its attached code is never asked, because
|
|
470
|
+
/// whoever obtained one authorization signature from the key chose that code. One mechanism per kind
|
|
471
|
+
/// of signer (ADR-0013).
|
|
442
472
|
function _isValidSignatureBool(
|
|
443
473
|
address signer,
|
|
444
474
|
bytes32 digest,
|
|
445
475
|
bytes memory signature
|
|
446
476
|
) internal view returns (bool) {
|
|
447
|
-
|
|
448
|
-
if (codeLen > 0) {
|
|
449
|
-
if (_erc1271Ok(signer, digest, signature)) return true;
|
|
450
|
-
if (!_isDelegatedEoa(signer, codeLen)) return false;
|
|
451
|
-
}
|
|
477
|
+
if (signer.code.length > 0 && !Eip7702.isDelegatedEOA(signer)) return _erc1271Ok(signer, digest, signature);
|
|
452
478
|
// P2-2 (audit 2026-06-10): OpenZeppelin ECDSA.tryRecover rejects high-s (malleable) signatures and
|
|
453
479
|
// malformed lengths. The error value is checked explicitly: on any error `recovered` is zero and
|
|
454
480
|
// is NOT compared (a zero `signer` can therefore never match).
|
|
@@ -469,9 +495,6 @@ contract AttestationRegistry {
|
|
|
469
495
|
return bytes32(ret) == bytes32(IERC1271.isValidSignature.selector);
|
|
470
496
|
}
|
|
471
497
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
bytes memory c = a.code;
|
|
475
|
-
return c[0] == 0xef && c[1] == 0x01 && c[2] == 0x00;
|
|
476
|
-
}
|
|
498
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
499
|
+
uint256[48] private __gap;
|
|
477
500
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import {IAgentAccount, AgentAccountRecoveryArgs, AgentAccountRecoveryPasskeyAdd, AgentAccountRotateCredentialArgs} from "../IAgentAccount.sol";
|
|
5
|
-
import {
|
|
5
|
+
import {SignatureVerifier} from "../libraries/SignatureVerifier.sol";
|
|
6
|
+
import {StableProxyGoverned} from "../governance/StableProxyGoverned.sol";
|
|
6
7
|
|
|
7
8
|
/// @dev R6.6 — minimal interface for the `account → factory → governance.isPaused()`
|
|
8
9
|
/// staticcall chain. Mirrors the same patterns introduced by R6.5
|
|
@@ -67,7 +68,7 @@ interface ICustodyPolicyPasskeyView {
|
|
|
67
68
|
* timelock → safetyDelay, guardian → trustee, owner → custodian),
|
|
68
69
|
* and EIP-712 typehashes likewise.
|
|
69
70
|
*/
|
|
70
|
-
contract CustodyPolicy {
|
|
71
|
+
contract CustodyPolicy is StableProxyGoverned {
|
|
71
72
|
// ─── ERC-7579 marker constants (mirror of the account-side ids) ──
|
|
72
73
|
uint256 internal constant MODULE_TYPE_EXECUTOR = 2;
|
|
73
74
|
uint256 internal constant MODULE_TYPE_HOOK = 4;
|
|
@@ -138,6 +139,8 @@ contract CustodyPolicy {
|
|
|
138
139
|
}
|
|
139
140
|
|
|
140
141
|
mapping(address => Config) internal _configs;
|
|
142
|
+
/// @dev Storage gap (spec 447: behind a stable proxy; layout gated by `check:storage-layouts`).
|
|
143
|
+
uint256[49] private __gap;
|
|
141
144
|
|
|
142
145
|
// ─── Constants ────────────────────────────────────────────────────
|
|
143
146
|
|
|
@@ -159,15 +162,19 @@ contract CustodyPolicy {
|
|
|
159
162
|
"CancelScheduledChangeRequest(address account,uint8 action,bytes32 argsHash,uint256 changeId,uint64 eta)"
|
|
160
163
|
);
|
|
161
164
|
|
|
162
|
-
/// @
|
|
163
|
-
///
|
|
164
|
-
///
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
166
|
+
/// (spec 447), `initialize(governance_)` instead. The quorum signs over this contract's EIP-712 domain,
|
|
167
|
+
/// and every account holds its address as the factory's canonical custody policy, so a fix must keep
|
|
168
|
+
/// the address: scheduled changes and their signatures survive it.
|
|
169
|
+
/// @notice Spec 449: the stateless verifier that recovers each quorum signature slot
|
|
170
|
+
/// (`SignatureSlotRecovery.recoverFromSlot`, unchanged) — moved out of this bytecode for EIP-170 room.
|
|
171
|
+
/// Created by this implementation's constructor, so it is part of the code governance vouched; reached
|
|
172
|
+
/// by STATICCALL from `_verifyQuorum` only; no state, no authority (it returns a signer, this policy
|
|
173
|
+
/// decides whether that signer counts).
|
|
174
|
+
address public immutable signatureVerifier;
|
|
167
175
|
|
|
168
|
-
constructor() {
|
|
169
|
-
|
|
170
|
-
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator();
|
|
176
|
+
constructor() initializer {
|
|
177
|
+
signatureVerifier = address(new SignatureVerifier());
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
// ─── R6.6 / CON-CustodyPolicy-005 — system-pause modifier ──────
|
|
@@ -259,8 +266,9 @@ contract CustodyPolicy {
|
|
|
259
266
|
);
|
|
260
267
|
}
|
|
261
268
|
|
|
269
|
+
/// @dev Computed per call from `address(this)` — the proxy's address behind a proxy. Never cached in an
|
|
270
|
+
/// immutable: that would carry the implementation's address (spec 447). Recomputes on a chain split.
|
|
262
271
|
function _domainSeparator() internal view returns (bytes32) {
|
|
263
|
-
if (block.chainid == _CACHED_CHAIN_ID) return _CACHED_DOMAIN_SEPARATOR;
|
|
264
272
|
return _buildDomainSeparator();
|
|
265
273
|
}
|
|
266
274
|
|
|
@@ -1063,14 +1071,15 @@ contract CustodyPolicy {
|
|
|
1063
1071
|
if (signatures.length < uint256(vargs.reqThreshold) * 65) {
|
|
1064
1072
|
revert AdminInsufficientQuorum(signatures.length / 65, vargs.reqThreshold);
|
|
1065
1073
|
}
|
|
1066
|
-
bytes memory sigsMem = signatures;
|
|
1067
1074
|
address approvedHashReg = c.approvedHashRegistry;
|
|
1075
|
+
SignatureVerifier verifier = SignatureVerifier(signatureVerifier);
|
|
1068
1076
|
signers = new address[](vargs.reqThreshold);
|
|
1069
1077
|
address prev;
|
|
1070
1078
|
for (uint256 i; i < vargs.reqThreshold; i++) {
|
|
1071
|
-
|
|
1079
|
+
// Its errors (`SignatureSlotRecovery.*`) revert through this call unchanged.
|
|
1080
|
+
address signer = verifier.recoverFromSlot(
|
|
1072
1081
|
// Spec 302 W2 — v=2 passkey slots derive the per-ACCOUNT PIA.
|
|
1073
|
-
vargs.payloadHash,
|
|
1082
|
+
vargs.payloadHash, signatures, i, approvedHashReg, account
|
|
1074
1083
|
);
|
|
1075
1084
|
if (signer <= prev) revert AdminDuplicateOrUnsortedSigner(signer);
|
|
1076
1085
|
prev = signer;
|
|
@@ -1158,10 +1167,14 @@ contract CustodyPolicy {
|
|
|
1158
1167
|
_applyRotateCredential(account, c, r);
|
|
1159
1168
|
} else if (action == CustodyAction.ApplySystemUpdate) {
|
|
1160
1169
|
// Spec 445 §1.3 (i): the account refuses `newImpl` unless its implementation's UpgradeVoucher
|
|
1161
|
-
// vouches for (newImpl, keccak256(
|
|
1162
|
-
// code either.
|
|
1163
|
-
(
|
|
1164
|
-
|
|
1170
|
+
// vouches for (newImpl, keccak256(data)) at this moment — a quorum cannot delegatecall arbitrary
|
|
1171
|
+
// code either. Spec 447 §3.4: `args` is `abi.encode(newImpl)` (a plain upgrade) or
|
|
1172
|
+
// `abi.encode(newImpl, data)` (a vouched migration, e.g. the generation-5 factory move).
|
|
1173
|
+
address newImpl;
|
|
1174
|
+
bytes memory data;
|
|
1175
|
+
if (args.length == 32) newImpl = abi.decode(args, (address));
|
|
1176
|
+
else (newImpl, data) = abi.decode(args, (address, bytes));
|
|
1177
|
+
_execute(account, abi.encodeWithSignature("upgradeToAndCall(address,bytes)", newImpl, data));
|
|
1165
1178
|
} else if (action == CustodyAction.InstallModule) {
|
|
1166
1179
|
(uint256 moduleTypeId, address module, bytes memory initData) = abi.decode(args, (uint256, address, bytes));
|
|
1167
1180
|
_execute(account, abi.encodeWithSignature(
|
|
@@ -1257,24 +1270,12 @@ contract CustodyPolicy {
|
|
|
1257
1270
|
if (newMode > 3) revert InvalidMode(newMode);
|
|
1258
1271
|
uint8 oldMode = c.mode;
|
|
1259
1272
|
if (newMode == 0 && c.trusteeCount > 0) revert CannotDowngradeWithTrustees();
|
|
1260
|
-
// EXT-CHANGEMODE-1 (2026-07-05 audit): a runtime ChangeMode must re-run the factory's install-time
|
|
1261
|
-
// mode-3 feasibility so the account can't enter an un-executable / liveness-hostile org mode.
|
|
1262
|
-
// Org SoD needs ≥2 signers (distinct proposers + appliers) and T4/T5 thresholds within the
|
|
1263
|
-
// floor(N/2) cap (else 2×threshold > N → no disjoint quorum → the tier silently locks). Require the
|
|
1264
|
-
// signer floor; cap the SoD-constrained thresholds (mirrors the factory, avoids a locked mode).
|
|
1265
|
-
if (newMode == 3) {
|
|
1266
|
-
uint256 n = IAgentAccount(account).custodianCount();
|
|
1267
|
-
if (n < 2) revert InfeasibleOrgConfig(uint8(n));
|
|
1268
|
-
uint8 sodCap = uint8(n / 2); // ≥ 1 since n ≥ 2
|
|
1269
|
-
for (uint8 tier = 4; tier <= 5; tier++) {
|
|
1270
|
-
uint8 v = c.approvalsRequiredByTier[tier];
|
|
1271
|
-
if (v > sodCap) {
|
|
1272
|
-
c.approvalsRequiredByTier[tier] = sodCap;
|
|
1273
|
-
emit ThresholdChanged(account, tier, v, sodCap);
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
1273
|
c.mode = newMode;
|
|
1274
|
+
// EXT-CHANGEMODE-1 + audit 2026-12-02 C2-7: entering org mode needs >= 2 signers and T4 / T5 within the
|
|
1275
|
+
// floor(N/2) separation-of-duties cap. It is REFUSED when they are not, never capped: capping here lowered
|
|
1276
|
+
// T5 under a T4 quorum (and the lowered value stayed when the mode changed back). The quorum lowers the
|
|
1277
|
+
// thresholds first, as `ChangeApprovalsRequired` — a T5 action that names the numbers it signs.
|
|
1278
|
+
if (newMode == 3) _requireThresholdsReachable(c, IAgentAccount(account).custodianCount());
|
|
1278
1279
|
emit ModeChanged(account, oldMode, newMode);
|
|
1279
1280
|
}
|
|
1280
1281
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
|
+
import {StableProxyGoverned} from "../governance/StableProxyGoverned.sol";
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* @title TreasurySpendPolicy — an aggregate ceiling AT THE RESOURCE (spec 410 §7, THESIS-6)
|
|
6
8
|
* @notice Every caveat enforcer bounds ONE delegation: `ValueEnforcer` a call's value, `PaymentEnforcer` a
|
|
@@ -83,7 +85,12 @@ interface ITreasurySpendPolicyAccountView {
|
|
|
83
85
|
function entryPoint() external view returns (address);
|
|
84
86
|
}
|
|
85
87
|
|
|
86
|
-
contract TreasurySpendPolicy {
|
|
88
|
+
contract TreasurySpendPolicy is StableProxyGoverned {
|
|
89
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
90
|
+
/// (spec 447), `initialize(governance_)` instead — a treasury holds this hook's address in its module
|
|
91
|
+
/// list, so a fix must keep the address (and every installed budget with it).
|
|
92
|
+
constructor() initializer {}
|
|
93
|
+
|
|
87
94
|
struct Budget {
|
|
88
95
|
address asset; // address(0) = native value
|
|
89
96
|
uint256 ceiling; // per window, in the asset's base units
|
|
@@ -96,6 +103,8 @@ contract TreasurySpendPolicy {
|
|
|
96
103
|
|
|
97
104
|
/// account => budget
|
|
98
105
|
mapping(address => Budget) private _budgets;
|
|
106
|
+
/// @dev Storage gap (spec 447; layout gated by `check:storage-layouts`).
|
|
107
|
+
uint256[49] private __gap;
|
|
99
108
|
|
|
100
109
|
event BudgetInstalled(address indexed account, address indexed asset, uint256 ceiling, uint64 windowSeconds, uint64 windowStart);
|
|
101
110
|
event BudgetUninstalled(address indexed account);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title AllowedMethodsEnforcer
|
|
@@ -20,7 +21,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
20
21
|
* executing account itself (`SelfTargetedRedemption`) — the route by which a self-`executeBatch`
|
|
21
22
|
* once ran inner calls no enforcer saw. Do not reuse this enforcer under a manager without that rule.
|
|
22
23
|
*/
|
|
23
|
-
contract AllowedMethodsEnforcer is ICaveatEnforcer {
|
|
24
|
+
contract AllowedMethodsEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
25
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
26
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
27
|
+
/// names it, so a fix must keep the address.
|
|
28
|
+
constructor() initializer {}
|
|
29
|
+
|
|
24
30
|
error MethodNotAllowed();
|
|
25
31
|
error CalldataTooShort();
|
|
26
32
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title AllowedTargetsEnforcer
|
|
@@ -20,7 +21,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
20
21
|
* executing account itself (`SelfTargetedRedemption`) — the route by which a self-`executeBatch`
|
|
21
22
|
* once ran inner calls no enforcer saw. Do not reuse this enforcer under a manager without that rule.
|
|
22
23
|
*/
|
|
23
|
-
contract AllowedTargetsEnforcer is ICaveatEnforcer {
|
|
24
|
+
contract AllowedTargetsEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
25
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
26
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
27
|
+
/// names it, so a fix must keep the address.
|
|
28
|
+
constructor() initializer {}
|
|
29
|
+
|
|
24
30
|
error TargetNotAllowed();
|
|
25
31
|
|
|
26
32
|
function beforeHook(
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title CallDataHashEnforcer
|
|
@@ -26,7 +27,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
26
27
|
* dispatch, and the read-only `verifyAuthorizationForCall` evaluates it
|
|
27
28
|
* via `staticcall`.
|
|
28
29
|
*/
|
|
29
|
-
contract CallDataHashEnforcer is ICaveatEnforcer {
|
|
30
|
+
contract CallDataHashEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
31
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
32
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
33
|
+
/// names it, so a fix must keep the address.
|
|
34
|
+
constructor() initializer {}
|
|
35
|
+
|
|
30
36
|
error BadTermsLength();
|
|
31
37
|
error CallDataMismatch(bytes32 expected, bytes32 actual);
|
|
32
38
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title DigestBindingEnforcer
|
|
@@ -71,7 +72,7 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
71
72
|
* The hooks mutate state and are `onlyDelegationManager` (EXT-PMT-1's rule for stateful
|
|
72
73
|
* enforcers): a stranger cannot spend a use or a nonce outside a valid redemption.
|
|
73
74
|
*/
|
|
74
|
-
contract DigestBindingEnforcer is ICaveatEnforcer {
|
|
75
|
+
contract DigestBindingEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
75
76
|
error BadTermsLength();
|
|
76
77
|
error BadArgsLength();
|
|
77
78
|
error ZeroMaxUses();
|
|
@@ -88,6 +89,8 @@ contract DigestBindingEnforcer is ICaveatEnforcer {
|
|
|
88
89
|
mapping(address => mapping(bytes32 => mapping(bytes32 => uint256))) private _uses;
|
|
89
90
|
/// delegator => delegationHash => keccak256(kind, redeemer, stepNonce) => consumed
|
|
90
91
|
mapping(address => mapping(bytes32 => mapping(bytes32 => bool))) private _used;
|
|
92
|
+
/// @dev Storage gap (spec 447: behind a stable proxy; layout gated by `check:storage-layouts`).
|
|
93
|
+
uint256[48] private __gap;
|
|
91
94
|
|
|
92
95
|
event DigestBindingRedeemed(
|
|
93
96
|
address indexed delegator,
|
|
@@ -100,7 +103,7 @@ contract DigestBindingEnforcer is ICaveatEnforcer {
|
|
|
100
103
|
uint256 maxUses
|
|
101
104
|
);
|
|
102
105
|
|
|
103
|
-
constructor(address delegationManager_) {
|
|
106
|
+
constructor(address delegationManager_) initializer {
|
|
104
107
|
require(delegationManager_ != address(0), "DigestBindingEnforcer: zero DelegationManager");
|
|
105
108
|
delegationManager = delegationManager_;
|
|
106
109
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title PayloadClassesEnforcer — the INFORMATION-FLOW caveat (spec 410 §7)
|
|
@@ -19,7 +20,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
19
20
|
* What it is NOT: authority over the read (the read has its own mandate and scope), a content
|
|
20
21
|
* filter, or a substitute for the vault's per-record scope — those are enforced where the data is.
|
|
21
22
|
*/
|
|
22
|
-
contract PayloadClassesEnforcer is ICaveatEnforcer {
|
|
23
|
+
contract PayloadClassesEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
24
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
25
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
26
|
+
/// names it, so a fix must keep the address.
|
|
27
|
+
constructor() initializer {}
|
|
28
|
+
|
|
23
29
|
function beforeHook(bytes calldata, bytes calldata, bytes32, address, address, address, uint256, bytes calldata) external pure override {}
|
|
24
30
|
function afterHook(bytes calldata, bytes calldata, bytes32, address, address, address, uint256, bytes calldata) external pure override {}
|
|
25
31
|
|
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
5
|
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
|
+
import "../governance/StableProxyGoverned.sol";
|
|
6
7
|
|
|
7
8
|
/// @dev The one thing this enforcer asks of its DelegationManager beyond calling the hooks: whose
|
|
8
9
|
/// account executes the redemption in flight (audit DLG-8c). Attribution only.
|
|
@@ -65,7 +66,7 @@ interface IPaymentReceiptRegistry {
|
|
|
65
66
|
* smuggling; `value == 0` rejects ETH; the DelegationManager's single (target,value,data)
|
|
66
67
|
* redemption shape rejects batch/delegatecall.
|
|
67
68
|
*/
|
|
68
|
-
contract PaymentEnforcer is ICaveatEnforcer {
|
|
69
|
+
contract PaymentEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
69
70
|
bytes4 private constant TRANSFER_SELECTOR = IERC20.transfer.selector; // 0xa9059cbb
|
|
70
71
|
|
|
71
72
|
struct Budget {
|
|
@@ -85,6 +86,8 @@ contract PaymentEnforcer is ICaveatEnforcer {
|
|
|
85
86
|
/// entry is distinguishable from an unset slot even when the treasury balance is 0. Set and
|
|
86
87
|
/// deleted within a single non-reentrant `redeemDelegation`, so it never persists across txs.
|
|
87
88
|
mapping(bytes32 => uint256) private _settleSnap;
|
|
89
|
+
/// @dev Storage gap (spec 447: behind a stable proxy; layout gated by `check:storage-layouts`).
|
|
90
|
+
uint256[47] private __gap;
|
|
88
91
|
|
|
89
92
|
/// @notice The ONLY authorized caller of the hooks (EXT-PMT-1 / C-NEW-1). Unlike the stateless
|
|
90
93
|
/// enforcers (timestamp/value/targets/methods), this enforcer MUTATES state (budget, nonce)
|
|
@@ -140,7 +143,7 @@ contract PaymentEnforcer is ICaveatEnforcer {
|
|
|
140
143
|
_;
|
|
141
144
|
}
|
|
142
145
|
|
|
143
|
-
constructor(address delegationManager_, address receiptRegistry_) {
|
|
146
|
+
constructor(address delegationManager_, address receiptRegistry_) initializer {
|
|
144
147
|
require(delegationManager_ != address(0), "PaymentEnforcer: zero DelegationManager");
|
|
145
148
|
delegationManager = delegationManager_;
|
|
146
149
|
receiptRegistry = IPaymentReceiptRegistry(receiptRegistry_);
|
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
5
|
import "../libraries/SignatureSlotRecovery.sol";
|
|
6
|
+
import "../governance/StableProxyGoverned.sol";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @title QuorumEnforcer
|
|
@@ -77,7 +78,12 @@ import "../libraries/SignatureSlotRecovery.sol";
|
|
|
77
78
|
* dispatch. See `docs/audits/r6-contracts-recon-2026-05-31.md`
|
|
78
79
|
* § 4.4 + `test/EnforcerPauseInvariantR67.t.sol`.
|
|
79
80
|
*/
|
|
80
|
-
contract QuorumEnforcer is ICaveatEnforcer {
|
|
81
|
+
contract QuorumEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
82
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
83
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
84
|
+
/// names it, so a fix must keep the address.
|
|
85
|
+
constructor() initializer {}
|
|
86
|
+
|
|
81
87
|
error InsufficientQuorum(uint256 supplied, uint8 threshold);
|
|
82
88
|
error UnauthorizedSigner(address signer);
|
|
83
89
|
error DuplicateOrUnsortedSigner(address signer);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title TimestampEnforcer
|
|
@@ -16,7 +17,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
16
17
|
* dispatch. See `docs/audits/r6-contracts-recon-2026-05-31.md`
|
|
17
18
|
* § 4.4 + `test/EnforcerPauseInvariantR67.t.sol`.
|
|
18
19
|
*/
|
|
19
|
-
contract TimestampEnforcer is ICaveatEnforcer {
|
|
20
|
+
contract TimestampEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
21
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
22
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
23
|
+
/// names it, so a fix must keep the address.
|
|
24
|
+
constructor() initializer {}
|
|
25
|
+
|
|
20
26
|
error TimestampNotYetValid();
|
|
21
27
|
error TimestampExpired();
|
|
22
28
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
4
|
import "../agency/ICaveatEnforcer.sol";
|
|
5
|
+
import "../governance/StableProxyGoverned.sol";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @title ValueEnforcer
|
|
@@ -20,7 +21,12 @@ import "../agency/ICaveatEnforcer.sol";
|
|
|
20
21
|
* executing account itself (`SelfTargetedRedemption`) — the route by which a self-`executeBatch`
|
|
21
22
|
* once ran inner calls no enforcer saw. Do not reuse this enforcer under a manager without that rule.
|
|
22
23
|
*/
|
|
23
|
-
contract ValueEnforcer is ICaveatEnforcer {
|
|
24
|
+
contract ValueEnforcer is ICaveatEnforcer, StableProxyGoverned {
|
|
25
|
+
/// @notice A direct deployment, initialized here (no governance: never upgradeable). Behind a stable proxy
|
|
26
|
+
/// (spec 447), `initialize(governance_)` instead — an enforcer's address is in every delegation that
|
|
27
|
+
/// names it, so a fix must keep the address.
|
|
28
|
+
constructor() initializer {}
|
|
29
|
+
|
|
24
30
|
error ValueExceedsLimit();
|
|
25
31
|
|
|
26
32
|
function beforeHook(
|
|
@@ -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 GeoFeatureRegistry
|
|
@@ -34,7 +36,13 @@ pragma solidity ^0.8.28;
|
|
|
34
36
|
* Ported from smart-agent `GeoFeatureRegistry`; diverges per spec 251 (AP auth,
|
|
35
37
|
* C-box-anchored kinds, no name binding in v1).
|
|
36
38
|
*/
|
|
37
|
-
contract GeoFeatureRegistry {
|
|
39
|
+
contract GeoFeatureRegistry is StableProxyGoverned {
|
|
40
|
+
/// @notice Spec 447 — a DIRECT deployment, initialized here with no governance (its code is frozen, as
|
|
41
|
+
/// before). Behind a stable proxy, `initialize(governance_)` instead; the governance is then the only
|
|
42
|
+
/// upgrade authority. This contract has no admin of its own: governance can replace the code behind
|
|
43
|
+
/// the proxy and nothing else.
|
|
44
|
+
constructor() initializer {}
|
|
45
|
+
|
|
38
46
|
// ─── C-box feature-kind codelist (keccak of the cbox URIs) ──────────
|
|
39
47
|
// Concept URIs are declared in packages/ontology cbox/geo-vocabulary.ttl
|
|
40
48
|
// (scheme apg:geoKind); lockstep-gated against the ontology (ADR-0009).
|
|
@@ -115,6 +123,7 @@ contract GeoFeatureRegistry {
|
|
|
115
123
|
function publish(PublishInput calldata p) external returns (uint64 version) {
|
|
116
124
|
if (p.featureId == bytes32(0)) revert EmptyId();
|
|
117
125
|
if (bytes(p.metadataURI).length == 0) revert EmptyMetadata();
|
|
126
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
118
127
|
if (msg.sender != p.stewardAccount) revert NotSteward();
|
|
119
128
|
|
|
120
129
|
uint64 prevVer = latestVersion[p.featureId];
|
|
@@ -160,6 +169,7 @@ contract GeoFeatureRegistry {
|
|
|
160
169
|
uint64 v = latestVersion[featureId];
|
|
161
170
|
if (v == 0) revert FeatureNotFound();
|
|
162
171
|
FeatureRecord storage r = _records[featureId][v];
|
|
172
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
163
173
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
164
174
|
r.active = false;
|
|
165
175
|
emit FeatureDeactivated(featureId, v);
|
|
@@ -168,6 +178,7 @@ contract GeoFeatureRegistry {
|
|
|
168
178
|
function setValidity(bytes32 featureId, uint64 version, uint64 validAfter, uint64 validUntil) external {
|
|
169
179
|
FeatureRecord storage r = _records[featureId][version];
|
|
170
180
|
if (r.version == 0) revert FeatureNotFound();
|
|
181
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
171
182
|
if (msg.sender != r.stewardAccount) revert NotSteward();
|
|
172
183
|
// REG-15: a published version's window can be ENDED, never rewritten. `validAfter` is fixed at
|
|
173
184
|
// publish; `validUntil` may be set (0 → a time) or moved earlier, not extended or cleared — a
|
|
@@ -218,4 +229,7 @@ contract GeoFeatureRegistry {
|
|
|
218
229
|
page = new bytes32[](end - offset);
|
|
219
230
|
for (uint256 i = offset; i < end; i++) page[i - offset] = _allFeatures[i];
|
|
220
231
|
}
|
|
232
|
+
|
|
233
|
+
/// @dev Spec 447 — storage gap: the contract may sit behind a stable proxy; layout gated by `check:storage-layouts`.
|
|
234
|
+
uint256[47] private __gap;
|
|
221
235
|
}
|