@agenticprimitives/contracts 1.0.0-alpha.5 → 1.0.0-alpha.50
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 +119 -27
- package/README.md +47 -12
- package/deployments-base-sepolia.json +52 -1
- package/deployments-faithchain.json +103 -0
- package/deployments-hopechain.json +78 -0
- package/deployments-paymaster-anvil.json +1 -0
- package/deployments-registries-base-sepolia.json +1 -0
- package/deployments-registries-hopechain.json +1 -0
- package/dist/abi/AccountBootstrap.json +99 -0
- package/dist/abi/AgentAccount.json +461 -67
- package/dist/abi/AgentAccountFactory.json +309 -0
- package/dist/abi/AgentNameAttributeResolver.json +212 -0
- package/dist/abi/AgentNameRegistry.json +544 -0
- package/dist/abi/AgentNameUniversalResolver.json +222 -0
- package/dist/abi/AgentProfileResolver.json +236 -0
- package/dist/abi/AgentRegistryBase.json +1003 -0
- package/dist/abi/AgentRelationship.json +405 -0
- package/dist/abi/AgenticGovernance.json +155 -0
- package/dist/abi/AgreementRegistry.json +203 -5
- package/dist/abi/AllowedMethodsEnforcer.json +193 -0
- package/dist/abi/AllowedTargetsEnforcer.json +193 -0
- package/dist/abi/ApprovedHashRegistry.json +267 -2
- package/dist/abi/AttestationRegistry.json +242 -0
- package/dist/abi/AttributeStorage.json +24 -0
- package/dist/abi/CallDataHashEnforcer.json +193 -0
- package/dist/abi/CustodyPolicy.json +422 -55
- package/dist/abi/DelegationManager.json +292 -0
- package/dist/abi/DigestBindingEnforcer.json +541 -0
- package/dist/abi/Eip7702.json +13 -0
- package/dist/abi/EstateProjectionRegistry.json +599 -0
- package/dist/abi/Generation5Bridge.json +355 -0
- package/dist/abi/GeoFeatureRegistry.json +235 -0
- package/dist/abi/IAgentAccountFactoryView.json +26 -0
- package/dist/abi/IAgentAccountGovernanceTimelockView.json +15 -0
- package/dist/abi/IApprovedHashRegistryWrite.json +35 -0
- package/dist/abi/ICustodyEpochView.json +28 -0
- package/dist/abi/ICustodyPolicyAccountModuleView.json +31 -0
- package/dist/abi/ICustodyPolicyFactoryView.json +13 -0
- package/dist/abi/ICustodyPolicyPasskeyView.json +50 -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/IPaymentReceiptRegistry.json +50 -0
- package/dist/abi/IRedemptionContext.json +15 -0
- package/dist/abi/IRegistryMembershipPolicy.json +70 -0
- package/dist/abi/ITimelockVeto.json +93 -0
- package/dist/abi/ITreasurySpendPolicyAccountView.json +44 -0
- package/dist/abi/IUpgradeVoucherView.json +26 -0
- package/dist/abi/MockUSDC.json +621 -0
- package/dist/abi/OntologyTermRegistry.json +268 -0
- package/dist/abi/PayloadClassesEnforcer.json +310 -0
- package/dist/abi/PaymentEnforcer.json +639 -0
- package/dist/abi/PaymentEscrow.json +501 -0
- package/dist/abi/PaymentReceiptRegistry.json +388 -0
- package/dist/abi/PermissionlessSubregistry.json +353 -0
- package/dist/abi/PricedSubregistry.json +1141 -0
- package/dist/abi/QuorumEnforcer.json +209 -0
- package/dist/abi/ReceiptAnchorRegistry.json +346 -0
- package/dist/abi/RelationshipTypeRegistry.json +268 -0
- package/dist/abi/ShapeRegistry.json +268 -0
- package/dist/abi/SignatureVerifier.json +196 -0
- package/dist/abi/SkillDefinitionRegistry.json +235 -0
- package/dist/abi/SmartAgentPaymaster.json +445 -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 +667 -0
- package/dist/abi/UpgradeVoucher.json +328 -0
- package/dist/abi/ValueEnforcer.json +193 -0
- package/dist/abi/index.d.ts +35 -0
- package/dist/abi/index.js +35 -0
- package/dist/deployments/base-sepolia.d.ts +11 -0
- package/dist/deployments/base-sepolia.js +51 -28
- package/dist/deployments/faithchain.d.ts +77 -0
- package/dist/deployments/faithchain.js +107 -0
- package/dist/deployments/hopechain.d.ts +68 -0
- package/dist/deployments/hopechain.js +82 -0
- package/dist/deployments/index.d.ts +7 -2
- package/dist/deployments/index.js +15 -0
- package/dist/deployments/paymaster-anvil.d.ts +11 -0
- package/dist/deployments/paymaster-anvil.js +9 -0
- package/dist/deployments/registries-base-sepolia.d.ts +10 -0
- package/dist/deployments/registries-base-sepolia.js +8 -0
- package/dist/deployments/registries-hopechain.d.ts +10 -0
- package/dist/deployments/registries-hopechain.js +8 -0
- package/package.json +37 -7
- package/src/AccountBootstrap.sol +38 -0
- package/src/AgentAccount.sol +1091 -134
- package/src/AgentAccountFactory.sol +198 -21
- package/src/ApprovedHashRegistry.sol +134 -10
- package/src/IAgentAccount.sol +37 -0
- package/src/SmartAgentPaymaster.sol +275 -22
- package/src/UniversalSignatureValidator.sol +7 -0
- package/src/UpgradeVoucher.sol +87 -0
- package/src/agency/DelegationManager.sol +299 -76
- package/src/agency/ICaveatEnforcer.sol +10 -0
- package/src/agency/IDelegationManager.sol +37 -5
- package/src/agreement/AgreementRegistry.sol +105 -35
- package/src/attestation/AttestationRegistry.sol +220 -40
- package/src/custody/CustodyPolicy.sol +588 -70
- package/src/custody/TreasurySpendPolicy.sol +338 -0
- package/src/enforcers/AllowedMethodsEnforcer.sol +13 -2
- package/src/enforcers/AllowedTargetsEnforcer.sol +13 -2
- package/src/enforcers/CallDataHashEnforcer.sol +7 -1
- package/src/enforcers/DigestBindingEnforcer.sol +182 -0
- package/src/enforcers/PayloadClassesEnforcer.sol +36 -0
- package/src/enforcers/PaymentEnforcer.sol +291 -0
- package/src/enforcers/QuorumEnforcer.sol +24 -3
- package/src/enforcers/TimestampEnforcer.sol +7 -1
- package/src/enforcers/ValueEnforcer.sol +13 -2
- package/src/geo/GeoFeatureRegistry.sol +67 -22
- package/src/governance/AgenticGovernance.sol +187 -4
- package/src/governance/GovernanceManaged.sol +2 -0
- package/src/governance/StableProxyGoverned.sol +79 -0
- package/src/governance/StableProxyGovernedOneShot.sol +93 -0
- package/src/identity/AgentProfilePredicates.sol +23 -0
- package/src/identity/AgentProfileResolver.sol +22 -2
- package/src/libraries/Eip7702.sol +36 -0
- package/src/libraries/SignatureSlotRecovery.sol +28 -7
- package/src/libraries/SignatureVerifier.sol +52 -0
- package/src/libraries/WebAuthnLib.sol +16 -0
- package/src/migration/Generation5Bridge.sol +364 -0
- package/src/mocks/MockUSDC.sol +152 -0
- package/src/naming/AgentNameAttributeResolver.sol +29 -4
- package/src/naming/AgentNamePredicates.sol +89 -0
- package/src/naming/AgentNameRegistry.sol +324 -20
- package/src/naming/AgentNameUniversalResolver.sol +35 -2
- package/src/naming/PermissionlessSubregistry.sol +82 -25
- package/src/naming/PricedSubregistry.sol +293 -0
- package/src/ontology/AttributeStorage.sol +93 -80
- package/src/ontology/OntologyTermRegistry.sol +58 -2
- package/src/ontology/ShapeRegistry.sol +58 -2
- package/src/payments/PaymentEscrow.sol +187 -0
- package/src/payments/PaymentReceiptRegistry.sol +100 -0
- package/src/provenance/ReceiptAnchorRegistry.sol +67 -0
- package/src/registry/AgentRegistryBase.sol +372 -0
- package/src/registry/EstateProjectionRegistry.sol +177 -0
- package/src/registry/IRegistryMembershipPolicy.sol +30 -0
- package/src/relationships/AgentRelationship.sol +129 -8
- package/src/relationships/RelationshipTypeRegistry.sol +58 -2
- package/src/skills/SkillDefinitionRegistry.sol +61 -17
|
@@ -6,6 +6,9 @@ import "./AgentAccount.sol";
|
|
|
6
6
|
import {AgentAccountInitParams} from "./IAgentAccount.sol";
|
|
7
7
|
import {CustodyPolicy} from "./custody/CustodyPolicy.sol";
|
|
8
8
|
import "./governance/GovernanceManaged.sol";
|
|
9
|
+
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
10
|
+
import {UUPSUpgradeable} from "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
11
|
+
import {AccountBootstrap} from "./AccountBootstrap.sol";
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @title AgentAccountFactory
|
|
@@ -45,7 +48,7 @@ import "./governance/GovernanceManaged.sol";
|
|
|
45
48
|
* proposal + 48h timelock and propagates automatically to every
|
|
46
49
|
* existing AgentAccount.
|
|
47
50
|
*/
|
|
48
|
-
contract AgentAccountFactory is GovernanceManaged {
|
|
51
|
+
contract AgentAccountFactory is GovernanceManaged, Initializable, UUPSUpgradeable {
|
|
49
52
|
AgentAccount public immutable accountImplementation;
|
|
50
53
|
address public immutable delegationManager;
|
|
51
54
|
address public immutable custodyPolicy;
|
|
@@ -55,6 +58,21 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
55
58
|
/// sentinel consults it; it is NOT a mutable factory-view.
|
|
56
59
|
address public immutable approvedHashRegistry;
|
|
57
60
|
|
|
61
|
+
/// @notice Spec 445 §1.3 (i) — the `UpgradeVoucher` baked (immutable) into the AgentAccount implementation
|
|
62
|
+
/// this factory deploys; surfaced here for deploy-time auditing only. Accounts read it from their
|
|
63
|
+
/// IMPLEMENTATION, never from this factory (an account upgraded in place still names the factory
|
|
64
|
+
/// that created it). `address(0)` builds an implementation that can never be upgraded away from
|
|
65
|
+
/// — every upgrade fails closed; `Deploy.s.sol` always passes a governance-managed voucher.
|
|
66
|
+
address public immutable upgradeVoucher;
|
|
67
|
+
|
|
68
|
+
/// @notice R917-C-5 (spec 408 §1.3) — whether the T4 (admin) safety-delay floor is LIFTED to zero for
|
|
69
|
+
/// accounts this factory deploys. A DEPLOYMENT decision, stated by the deployer in the
|
|
70
|
+
/// constructor and recorded in the deployments JSON, never a `block.chainid` list in bytecode:
|
|
71
|
+
/// the previous carve-out named the estate's own chain (34348) and silently switched the
|
|
72
|
+
/// EXT-TL-FLOOR-1 invariant off where it mattered. `check:production-deploy` refuses a
|
|
73
|
+
/// production/testnet record with this `true`. T5 (24 h) / T6 (48 h) are never relaxed.
|
|
74
|
+
bool public immutable relaxedT4Floor;
|
|
75
|
+
|
|
58
76
|
address public bundlerSigner;
|
|
59
77
|
address public sessionIssuer;
|
|
60
78
|
|
|
@@ -69,7 +87,14 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
69
87
|
event BundlerSignerChanged(address indexed oldVal, address indexed newVal);
|
|
70
88
|
event SessionIssuerChanged(address indexed oldVal, address indexed newVal);
|
|
71
89
|
|
|
72
|
-
|
|
90
|
+
/// @notice Spec 447 §3.2 — the placeholder every new account proxy first points at. Created once, in the
|
|
91
|
+
/// initializer (so behind a proxy its `factory` is the PROXY), and kept in storage: a factory upgrade never
|
|
92
|
+
/// changes it, so a person's counterfactual address never changes with the code.
|
|
93
|
+
AccountBootstrap public accountBootstrap;
|
|
94
|
+
/// @dev Spec 447 — accounts this factory created (`isAccountFromFactory`).
|
|
95
|
+
mapping(address => bool) private _created;
|
|
96
|
+
|
|
97
|
+
uint256[48] private __gap;
|
|
73
98
|
|
|
74
99
|
// ─── Errors ─────────────────────────────────────────────────────────
|
|
75
100
|
|
|
@@ -77,6 +102,13 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
77
102
|
error NoInitialSigner();
|
|
78
103
|
error InsufficientTrusteesForMode(uint8 mode, uint256 actual, uint256 required);
|
|
79
104
|
error TrusteesRequiredForRecoverableMode(uint8 mode);
|
|
105
|
+
/// @notice ACCT-M1 (spec 300): a mode-3 (org) account needs ≥2 signers so its separation-of-duties
|
|
106
|
+
/// (disjoint propose + apply quorums) is satisfiable — a 1-signer org can never split duties.
|
|
107
|
+
error InfeasibleOrgConfig(uint8 nSigners);
|
|
108
|
+
/// @notice EXT-TL-FLOOR-1 (external audit P1-2): a mode>0 timelock override is below the on-chain product
|
|
109
|
+
/// floor. Overrides may RAISE a safety delay but never LOWER it below the marketed minimum
|
|
110
|
+
/// (spec 300 — the T5/recovery guarantee is a protocol invariant, not a UI convention).
|
|
111
|
+
error TimelockBelowFloor(uint8 tier, uint32 provided, uint32 floorSecs);
|
|
80
112
|
error ZeroAddress();
|
|
81
113
|
/// @notice R9.6 / ATL-SEC-05 -- thrown when `params.custodians.length`
|
|
82
114
|
/// exceeds `MAX_INITIAL_CUSTODIANS`. Without this cap,
|
|
@@ -94,6 +126,35 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
94
126
|
/// threshold at `_buildValidatorInitData:252`.
|
|
95
127
|
uint256 public constant MAX_INITIAL_CUSTODIANS = 32;
|
|
96
128
|
|
|
129
|
+
/// @notice ACCT-10 (audit 2026-11-10) — upper bound on the initial trustee list, beside
|
|
130
|
+
/// `MAX_INITIAL_CUSTODIANS` and for the same reason: `_buildValidatorInitData` derives the
|
|
131
|
+
/// recovery threshold as `uint8(trustees / 2 + 1)`. Uncapped, 510 trustees truncated it to 0
|
|
132
|
+
/// ("recovery disabled", the state audit C-9 forbids reaching at runtime) and 512 to 1-of-512.
|
|
133
|
+
/// With the cap the threshold is at most 17 and the cast cannot truncate.
|
|
134
|
+
uint256 public constant MAX_INITIAL_TRUSTEES = 32;
|
|
135
|
+
|
|
136
|
+
/// @notice ACCT-10 — `params.trustees.length` exceeds `MAX_INITIAL_TRUSTEES`.
|
|
137
|
+
error TooManyInitialTrustees(uint256 actual, uint256 max);
|
|
138
|
+
|
|
139
|
+
/// @notice Spec 302 W2 — trustee-slot sentinel meaning "the initial
|
|
140
|
+
/// passkey's Passkey-Identity-Address on the account being
|
|
141
|
+
/// deployed". The PIA is now account-scoped, so it CANNOT be
|
|
142
|
+
/// computed before the CREATE2 address exists — but the salt
|
|
143
|
+
/// commits to `params.trustees` (CA-F1). Clients that want the
|
|
144
|
+
/// initial passkey to be its own recovery trustee (mode>0
|
|
145
|
+
/// self-recovery bootstrap) pass this sentinel; the factory
|
|
146
|
+
/// resolves it to the real per-account PIA AFTER the deploy,
|
|
147
|
+
/// when it builds the CustodyPolicy install blob. The address
|
|
148
|
+
/// therefore commits to the INTENT ("self-passkey is a
|
|
149
|
+
/// trustee"), which is deterministic, instead of the derived
|
|
150
|
+
/// value, which is circular.
|
|
151
|
+
address public constant SELF_PASSKEY_TRUSTEE =
|
|
152
|
+
address(uint160(uint256(keccak256("ap.trustee.self-initial-passkey"))));
|
|
153
|
+
|
|
154
|
+
/// @notice Spec 302 W2 — `SELF_PASSKEY_TRUSTEE` passed without an
|
|
155
|
+
/// initial passkey to resolve it to.
|
|
156
|
+
error SelfPasskeyTrusteeWithoutPasskey();
|
|
157
|
+
|
|
97
158
|
constructor(
|
|
98
159
|
IEntryPoint entryPoint_,
|
|
99
160
|
address delegationManager_,
|
|
@@ -101,19 +162,43 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
101
162
|
address bundlerSigner_,
|
|
102
163
|
address sessionIssuer_,
|
|
103
164
|
address governance_,
|
|
104
|
-
address approvedHashRegistry_
|
|
105
|
-
|
|
165
|
+
address approvedHashRegistry_,
|
|
166
|
+
bool relaxedT4Floor_,
|
|
167
|
+
address upgradeVoucher_
|
|
168
|
+
) GovernanceManaged(governance_) initializer {
|
|
106
169
|
if (custodyPolicy_ == address(0)) revert ZeroAddress();
|
|
107
|
-
accountImplementation = new AgentAccount(entryPoint_, approvedHashRegistry_);
|
|
170
|
+
accountImplementation = new AgentAccount(entryPoint_, approvedHashRegistry_, upgradeVoucher_);
|
|
108
171
|
approvedHashRegistry = approvedHashRegistry_;
|
|
172
|
+
upgradeVoucher = upgradeVoucher_;
|
|
173
|
+
relaxedT4Floor = relaxedT4Floor_;
|
|
109
174
|
delegationManager = delegationManager_;
|
|
110
175
|
custodyPolicy = custodyPolicy_;
|
|
176
|
+
_initializeFactory(bundlerSigner_, sessionIssuer_);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/// @notice Spec 447 — the proxy's initializer: the factory's STORAGE (roles, the bootstrap placeholder). Its
|
|
180
|
+
/// immutables (implementation, manager, policy, registry, voucher, governance) are the implementation's
|
|
181
|
+
/// and name stable proxies. Runs once per proxy; never on an implementation (its constructor ran it).
|
|
182
|
+
function initializeFactory(address bundlerSigner_, address sessionIssuer_) external initializer {
|
|
183
|
+
_initializeFactory(bundlerSigner_, sessionIssuer_);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function _initializeFactory(address bundlerSigner_, address sessionIssuer_) private {
|
|
111
187
|
bundlerSigner = bundlerSigner_;
|
|
112
188
|
sessionIssuer = sessionIssuer_;
|
|
189
|
+
accountBootstrap = new AccountBootstrap(address(this));
|
|
113
190
|
emit BundlerSignerChanged(address(0), bundlerSigner_);
|
|
114
191
|
emit SessionIssuerChanged(address(0), sessionIssuer_);
|
|
115
192
|
}
|
|
116
193
|
|
|
194
|
+
/// @dev Spec 447: only governance upgrades the factory (behind a proxy; a direct deployment never upgrades).
|
|
195
|
+
function _authorizeUpgrade(address) internal view override onlyGovernance {}
|
|
196
|
+
|
|
197
|
+
/// @notice Spec 447 §3.2 — on-chain provenance: whether `account` was created by this factory.
|
|
198
|
+
function isAccountFromFactory(address account) external view returns (bool) {
|
|
199
|
+
return _created[account];
|
|
200
|
+
}
|
|
201
|
+
|
|
117
202
|
// ─── Governance-only setters ─────────────────────────────────────────
|
|
118
203
|
|
|
119
204
|
function setBundlerSigner(address newBundler) external onlyGovernance {
|
|
@@ -156,17 +241,21 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
156
241
|
// timelock (see AgenticGovernance).
|
|
157
242
|
_validateInitParams(params);
|
|
158
243
|
|
|
159
|
-
|
|
244
|
+
// CA-F1 (audit 2026-06-10): derive the deploy salt from the FULL custody config so the
|
|
245
|
+
// counterfactual address commits to mode/trustees/timelocks too — not just custodians/passkey.
|
|
246
|
+
bytes32 deploySalt = _effectiveSalt(params, timelockOverrides, salt);
|
|
247
|
+
address addr = _getAddressFromSalt(params, deploySalt);
|
|
160
248
|
if (addr.code.length > 0) return AgentAccount(payable(addr));
|
|
161
249
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
);
|
|
250
|
+
// Spec 447 §3.2: deployed pointing at the placeholder (so the address never depends on the code), then
|
|
251
|
+
// upgraded to the account implementation and initialized, in this same transaction.
|
|
252
|
+
ERC1967Proxy proxy = new ERC1967Proxy{salt: deploySalt}(address(accountBootstrap), "");
|
|
253
|
+
AccountBootstrap(address(proxy)).bootstrap(address(accountImplementation), _initData(params));
|
|
166
254
|
account = AgentAccount(payable(address(proxy)));
|
|
255
|
+
_created[address(account)] = true;
|
|
167
256
|
|
|
168
257
|
if (params.mode > 0) {
|
|
169
|
-
bytes memory validatorInit = _buildValidatorInitData(params, timelockOverrides);
|
|
258
|
+
bytes memory validatorInit = _buildValidatorInitData(params, timelockOverrides, address(account));
|
|
170
259
|
account.installModule(2 /* MODULE_TYPE_EXECUTOR */, custodyPolicy, validatorInit);
|
|
171
260
|
}
|
|
172
261
|
|
|
@@ -181,12 +270,16 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
181
270
|
}
|
|
182
271
|
|
|
183
272
|
/// @notice Counterfactual address for `createAgentAccount`.
|
|
273
|
+
/// @dev CA-F1: takes `timelockOverrides` because the address now commits to it. Callers MUST
|
|
274
|
+
/// predict with the SAME (params, timelockOverrides, salt) they will deploy with, else the
|
|
275
|
+
/// predicted address won't match the deployed one.
|
|
184
276
|
function getAddressForAgentAccount(
|
|
185
277
|
AgentAccountInitParams calldata params,
|
|
278
|
+
uint32[7] calldata timelockOverrides,
|
|
186
279
|
uint256 salt
|
|
187
280
|
) external view returns (address) {
|
|
188
281
|
_validateInitParams(params);
|
|
189
|
-
return
|
|
282
|
+
return _getAddressFromSalt(params, _effectiveSalt(params, timelockOverrides, salt));
|
|
190
283
|
}
|
|
191
284
|
|
|
192
285
|
// ─── Internals ──────────────────────────────────────────────────────
|
|
@@ -209,22 +302,48 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
209
302
|
);
|
|
210
303
|
}
|
|
211
304
|
|
|
212
|
-
|
|
305
|
+
/// @dev CA-F1 (audit 2026-06-10) — the deploy salt commits to the FULL custody configuration:
|
|
306
|
+
/// mode, trustees, and per-tier timelock overrides. `_initData` already folds custodians +
|
|
307
|
+
/// the initial passkey into the proxy bytecode hash (and thus the address); those, plus the
|
|
308
|
+
/// mode/trustees/timelocks bound here, mean the canonical address IS its complete custody
|
|
309
|
+
/// config. Two `createAgentAccount` calls that differ in ANY of these resolve to DIFFERENT
|
|
310
|
+
/// addresses, so an attacker can no longer front-run a victim's counterfactual address with a
|
|
311
|
+
/// weaker mode, attacker-controlled recovery trustees, or shortened timelocks. The
|
|
312
|
+
/// occupied-address branch is consequently reachable only by an identical-config request —
|
|
313
|
+
/// which also closes CA-F2 (silent adoption of a mismatched pre-existing account) by
|
|
314
|
+
/// construction, with no separate config-equality assertion needed.
|
|
315
|
+
function _effectiveSalt(
|
|
213
316
|
AgentAccountInitParams calldata params,
|
|
317
|
+
uint32[7] calldata timelockOverrides,
|
|
214
318
|
uint256 salt
|
|
319
|
+
) internal pure returns (bytes32) {
|
|
320
|
+
// Spec 447 §3.2: the custodians and initial passkey move into the salt — before, they were committed through
|
|
321
|
+
// the init data inside the proxy's creation code, which no longer carries it. The address still commits to
|
|
322
|
+
// the complete custody configuration (CA-F1), and to nothing about code.
|
|
323
|
+
return keccak256(abi.encode(
|
|
324
|
+
salt, params.mode, params.trustees, timelockOverrides,
|
|
325
|
+
params.custodians, params.initialPasskeyCredentialIdDigest, params.initialPasskeyX, params.initialPasskeyY,
|
|
326
|
+
params.initialPasskeyRpIdHash
|
|
327
|
+
));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function _getAddressFromSalt(
|
|
331
|
+
AgentAccountInitParams calldata,
|
|
332
|
+
bytes32 deploySalt
|
|
215
333
|
) internal view returns (address) {
|
|
216
|
-
|
|
217
|
-
return _create2Address(initData, salt);
|
|
334
|
+
return _create2Address(deploySalt);
|
|
218
335
|
}
|
|
219
336
|
|
|
220
|
-
|
|
337
|
+
/// @dev Spec 447 §3.2: the proxy's creation code carries only the placeholder — no implementation, no manager,
|
|
338
|
+
/// no init data — so the address is a function of (this factory, the placeholder, the salt).
|
|
339
|
+
function _create2Address(bytes32 salt) internal view returns (address) {
|
|
221
340
|
bytes memory proxyBytecode = abi.encodePacked(
|
|
222
341
|
type(ERC1967Proxy).creationCode,
|
|
223
|
-
abi.encode(address(
|
|
342
|
+
abi.encode(address(accountBootstrap), bytes(""))
|
|
224
343
|
);
|
|
225
344
|
bytes32 bytecodeHash = keccak256(proxyBytecode);
|
|
226
345
|
return address(uint160(uint256(keccak256(
|
|
227
|
-
abi.encodePacked(bytes1(0xff), address(this),
|
|
346
|
+
abi.encodePacked(bytes1(0xff), address(this), salt, bytecodeHash)
|
|
228
347
|
))));
|
|
229
348
|
}
|
|
230
349
|
|
|
@@ -249,6 +368,20 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
249
368
|
revert TooManyInitialCustodians(params.custodians.length, MAX_INITIAL_CUSTODIANS);
|
|
250
369
|
}
|
|
251
370
|
|
|
371
|
+
// ACCT-10: cap the trustee list on every mode (it is committed to the salt on every mode).
|
|
372
|
+
if (params.trustees.length > MAX_INITIAL_TRUSTEES) {
|
|
373
|
+
revert TooManyInitialTrustees(params.trustees.length, MAX_INITIAL_TRUSTEES);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Spec 302 W2 — the self-passkey trustee sentinel is meaningless
|
|
377
|
+
// without an initial passkey to resolve it to (fail-closed at
|
|
378
|
+
// predict time too, so counterfactual and deploy agree).
|
|
379
|
+
bool hasSentinel;
|
|
380
|
+
for (uint256 i; i < params.trustees.length; i++) {
|
|
381
|
+
if (params.trustees[i] == SELF_PASSKEY_TRUSTEE) { hasSentinel = true; break; }
|
|
382
|
+
}
|
|
383
|
+
if (hasSentinel && !hasPasskey) revert SelfPasskeyTrusteeWithoutPasskey();
|
|
384
|
+
|
|
252
385
|
if (params.mode == 0) return;
|
|
253
386
|
|
|
254
387
|
uint256 nTrustees = params.trustees.length;
|
|
@@ -273,7 +406,8 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
273
406
|
/// external custodians + (1 if initial passkey, else 0).
|
|
274
407
|
function _buildValidatorInitData(
|
|
275
408
|
AgentAccountInitParams calldata params,
|
|
276
|
-
uint32[7] calldata timelockOverrides
|
|
409
|
+
uint32[7] calldata timelockOverrides,
|
|
410
|
+
address account
|
|
277
411
|
) internal view returns (bytes memory) {
|
|
278
412
|
uint256 nSigners = params.custodians.length;
|
|
279
413
|
if (params.initialPasskeyX != 0 && params.initialPasskeyY != 0) nSigners++;
|
|
@@ -283,17 +417,60 @@ contract AgentAccountFactory is GovernanceManaged {
|
|
|
283
417
|
thresholds[t] = CustodyPolicy(custodyPolicy).defaultApprovals(uint8(nSigners), t);
|
|
284
418
|
}
|
|
285
419
|
|
|
420
|
+
// ACCT-M1 (spec 300): mode-3 (org) separation-of-duties requires DISJOINT propose + apply quorums
|
|
421
|
+
// for the T4/T5 tiers, so a satisfiable config needs 2×threshold DISTINCT signers. The default
|
|
422
|
+
// matrix sets T4/T5 = N for small N (all custodians), which would demand 2N signers — making every
|
|
423
|
+
// such change permanently un-executable (the account silently locks). Cap the SoD-constrained
|
|
424
|
+
// thresholds at floor(N/2) so a disjoint quorum always exists, and require ≥2 signers (a 1-signer
|
|
425
|
+
// org can't split duties). Modes 0-2 have no SoD, so their thresholds are unchanged.
|
|
426
|
+
if (params.mode == 3) {
|
|
427
|
+
if (nSigners < 2) revert InfeasibleOrgConfig(uint8(nSigners));
|
|
428
|
+
uint8 sodCap = uint8(nSigners / 2); // ≥ 1 since nSigners ≥ 2
|
|
429
|
+
if (thresholds[4] > sodCap) thresholds[4] = sodCap;
|
|
430
|
+
if (thresholds[5] > sodCap) thresholds[5] = sodCap;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// R917-C-5 (spec 408 §1.3): the T4 floor is lifted ONLY when the deployer said so in the constructor
|
|
434
|
+
// (`relaxedT4Floor`) — a local development posture so a demo can drive an admin custody action's
|
|
435
|
+
// schedule→apply back-to-back. It is not inferred from `block.chainid`: the estate's own chain was
|
|
436
|
+
// once on that list, and the audited EXT-TL-FLOOR-1 invariant was off where it mattered. T5 (24h)
|
|
437
|
+
// and T6 (recovery, 48h) are NOT relaxed under any posture.
|
|
438
|
+
uint32 floor4 = relaxedT4Floor ? 0 : uint32(1 hours);
|
|
439
|
+
|
|
286
440
|
uint32[7] memory timelocks;
|
|
287
|
-
timelocks[4] = timelockOverrides[4] == 0 ?
|
|
441
|
+
timelocks[4] = timelockOverrides[4] == 0 ? floor4 : timelockOverrides[4];
|
|
288
442
|
timelocks[5] = timelockOverrides[5] == 0 ? uint32(24 hours) : timelockOverrides[5];
|
|
289
443
|
timelocks[6] = timelockOverrides[6] == 0 ? uint32(48 hours) : timelockOverrides[6];
|
|
290
444
|
|
|
445
|
+
// EXT-TL-FLOOR-1 (external audit P1-2): a timelock override may RAISE a safety delay but NEVER lower it
|
|
446
|
+
// below the product floor. A zero override inherits the floor default above; a non-zero override below
|
|
447
|
+
// the floor reverts, so a mode>0 (custody-governed) account can never deploy with sub-floor T4/T5/T6
|
|
448
|
+
// (recovery = T6) delays. The "T5=24h / recovery=48h" guarantee becomes a protocol invariant, not a UI
|
|
449
|
+
// convention (spec 300 — raise-only). The T4 floor is `floor4` (production value on real chains, 0 on
|
|
450
|
+
// the dev-chain carve-out); T5/T6 keep their audited floors on every chain.
|
|
451
|
+
if (timelocks[4] < floor4) revert TimelockBelowFloor(4, timelocks[4], floor4);
|
|
452
|
+
if (timelocks[5] < 24 hours) revert TimelockBelowFloor(5, timelocks[5], uint32(24 hours));
|
|
453
|
+
if (timelocks[6] < 48 hours) revert TimelockBelowFloor(6, timelocks[6], uint32(48 hours));
|
|
454
|
+
|
|
455
|
+
// ACCT-10: `trustees.length <= MAX_INITIAL_TRUSTEES` (32) is enforced in `_validateInitParams`, so
|
|
456
|
+
// this is at most 17 and the cast cannot truncate.
|
|
291
457
|
uint8 recThr = uint8(params.trustees.length / 2 + 1);
|
|
292
458
|
|
|
459
|
+
// Spec 302 W2 — resolve the self-passkey trustee sentinel to the
|
|
460
|
+
// account-scoped PIA. Runs AFTER the deploy (the account address —
|
|
461
|
+
// and thus the per-account PIA — exists), while the CREATE2 salt
|
|
462
|
+
// committed to the sentinel form (deterministic pre-deploy).
|
|
463
|
+
address[] memory trustees = new address[](params.trustees.length);
|
|
464
|
+
for (uint256 i; i < trustees.length; i++) {
|
|
465
|
+
trustees[i] = params.trustees[i] == SELF_PASSKEY_TRUSTEE
|
|
466
|
+
? AgentAccount(payable(account)).passkeyIdentity(params.initialPasskeyX, params.initialPasskeyY)
|
|
467
|
+
: params.trustees[i];
|
|
468
|
+
}
|
|
469
|
+
|
|
293
470
|
return abi.encode(
|
|
294
471
|
params.mode,
|
|
295
472
|
recThr,
|
|
296
|
-
|
|
473
|
+
trustees,
|
|
297
474
|
thresholds,
|
|
298
475
|
timelocks,
|
|
299
476
|
uint256(0.01 ether),
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.28;
|
|
3
3
|
|
|
4
|
+
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
5
|
+
import {Eip7702} from "./libraries/Eip7702.sol";
|
|
6
|
+
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol";
|
|
7
|
+
|
|
8
|
+
/// @dev The one read the registry makes of an account signer (audit 2026-12-02 H-2).
|
|
9
|
+
interface ICustodyEpochView {
|
|
10
|
+
function custodyEpoch() external view returns (uint64);
|
|
11
|
+
function approvalRefused() external view returns (bool);
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* @title ApprovedHashRegistry
|
|
6
16
|
* @notice On-chain pre-approved hashes — the `v == 1` path of Safe's
|
|
@@ -26,13 +36,81 @@ pragma solidity ^0.8.28;
|
|
|
26
36
|
* Pairs with `MultiSendCallOnly` (atomic batch) so a passkey
|
|
27
37
|
* smart account can `approveHash` + perform the delegated action
|
|
28
38
|
* in one userOp.
|
|
39
|
+
*
|
|
40
|
+
* R917-C-2 (spec 408 §1.2): an `AgentAccount`'s `0x03` sentinel does NOT consult the raw hash —
|
|
41
|
+
* it consults `AgentAccount.approvedHashKey(hash)` = `keccak256(abi.encode(hash, custodyEpoch))`,
|
|
42
|
+
* so an approval planted by a custodian who is later removed is void once the account's custody
|
|
43
|
+
* epoch moves.
|
|
44
|
+
*
|
|
45
|
+
* THE KEY IS DERIVED HERE, never taken from the caller (audit 2026-12-02 H-2, THESIS-1a). A signer
|
|
46
|
+
* with code is an account: `approveHash(h)` / `revokeHash(h)` act on
|
|
47
|
+
* `keccak256(abi.encode(h, msg.sender.custodyEpoch()))` — the epoch the account is in NOW, read from
|
|
48
|
+
* it. A caller cannot name a future epoch, whatever code it runs: generation-4 code (which may call
|
|
49
|
+
* this registry directly, before or in the same call frame as its move to generation 5) and the
|
|
50
|
+
* generation-5 `approveDigest` alike. A signer with no code (an EOA, the `QuorumEnforcer` `v == 1`
|
|
51
|
+
* slot's usual signer) approves the raw hash: its approval dies with its key. A contract that does not
|
|
52
|
+
* answer `custodyEpoch()` cannot approve or revoke a single hash here (fail closed, ADR-0013).
|
|
53
|
+
*
|
|
54
|
+
* Spec 447 (generation 5): deployed behind a UUPS proxy at an address that never changes. The registry is
|
|
55
|
+
* an IMMUTABLE of every `AgentAccount` implementation, so before this, fixing it meant a new instance, every
|
|
56
|
+
* account upgrading to reach it, and every approval made again (with a window in which a hash approved in the
|
|
57
|
+
* new registry ahead of time would count — GC's upgrade rehearsal, 2026-11-30). Behind a stable proxy a fix
|
|
58
|
+
* is a new implementation: the address the accounts hold, and every approval and epoch, stay.
|
|
29
59
|
*/
|
|
30
|
-
contract ApprovedHashRegistry {
|
|
31
|
-
/// signer
|
|
32
|
-
|
|
60
|
+
contract ApprovedHashRegistry is Initializable, UUPSUpgradeable {
|
|
61
|
+
/// @dev R917-C-2 (spec 408 §1.2): an approval is recorded with the signer's epoch at the time
|
|
62
|
+
/// (`epoch + 1`, so a set slot is never zero); `revokeAll()` bumps the epoch and voids every
|
|
63
|
+
/// approval the signer ever made in one call. `isApproved` is the ONE read: the `0x03` sentinel
|
|
64
|
+
/// and `QuorumEnforcer`'s `v == 1` slot both consult it.
|
|
65
|
+
/// signer => hash => (epoch at approval + 1), 0 = never approved
|
|
66
|
+
mapping(address => mapping(bytes32 => uint64)) private _approvedAt;
|
|
67
|
+
/// signer => current epoch
|
|
68
|
+
mapping(address => uint64) private _epoch;
|
|
69
|
+
/// @dev Spec 447: the only upgrade authority (the `AgenticGovernance` contract, acting through its timelock).
|
|
70
|
+
/// Zero = never upgradeable.
|
|
71
|
+
address private _governance;
|
|
72
|
+
/// @dev Storage gap; this layout is gated by `check:storage-layouts`.
|
|
73
|
+
uint256[47] private __gap;
|
|
74
|
+
|
|
75
|
+
/// @dev Spec 447: an upgrade by anything but this registry's governance.
|
|
76
|
+
error NotGovernance();
|
|
77
|
+
/// @dev Spec 447: a registry with no governance cannot be upgraded.
|
|
78
|
+
error UpgradeWithoutGovernance();
|
|
79
|
+
/// @dev Spec 447: a non-zero governance with no code (an upgrade authority that can never act).
|
|
80
|
+
error GovernanceHasNoCode(address governance);
|
|
81
|
+
/// @dev The signing account answered `approvalRefused()` true: its custody changed, or it moved, earlier in this
|
|
82
|
+
/// transaction, so an approval now could outlive the custodian who sent it.
|
|
83
|
+
error ApprovalAfterCustodyChange();
|
|
33
84
|
|
|
34
85
|
event HashApproved(address indexed signer, bytes32 indexed hash);
|
|
35
86
|
event HashRevoked(address indexed signer, bytes32 indexed hash);
|
|
87
|
+
/// @dev R917-C-2 — every approval `signer` made before this event is void.
|
|
88
|
+
event AllHashesRevoked(address indexed signer, uint64 epoch);
|
|
89
|
+
|
|
90
|
+
/// @notice A DIRECT deployment (tests, a one-off instance): initialized here with no governance, so it works on
|
|
91
|
+
/// its own, can never be upgraded, and nobody can initialize it later.
|
|
92
|
+
constructor() initializer {}
|
|
93
|
+
|
|
94
|
+
/// @notice The proxy's initializer (spec 447). `governance_` is the upgrade authority; zero freezes the code.
|
|
95
|
+
function initialize(address governance_) external initializer {
|
|
96
|
+
if (governance_ != address(0) && governance_.code.length == 0) revert GovernanceHasNoCode(governance_);
|
|
97
|
+
Eip7702.refuseDelegatedEOA(governance_); // "has code" is not "is a contract" (spec 448 §0)
|
|
98
|
+
_governance = governance_;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// @notice The upgrade authority (zero = none).
|
|
102
|
+
function governance() external view returns (address) {
|
|
103
|
+
return _governance;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// @dev Spec 447: only governance upgrades; never a registry without one. UUPS's `onlyProxy` already refuses an
|
|
107
|
+
/// upgrade of a direct deployment.
|
|
108
|
+
function _authorizeUpgrade(address) internal view override {
|
|
109
|
+
address gov = _governance;
|
|
110
|
+
if (gov == address(0)) revert UpgradeWithoutGovernance();
|
|
111
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
112
|
+
if (msg.sender != gov) revert NotGovernance();
|
|
113
|
+
}
|
|
36
114
|
|
|
37
115
|
/**
|
|
38
116
|
* @notice Pre-approve a hash. `msg.sender` is the signer; only
|
|
@@ -40,18 +118,64 @@ contract ApprovedHashRegistry {
|
|
|
40
118
|
* for this hash.
|
|
41
119
|
*/
|
|
42
120
|
function approveHash(bytes32 hash) external {
|
|
43
|
-
|
|
44
|
-
|
|
121
|
+
bytes32 key = _keyOf(msg.sender, hash);
|
|
122
|
+
// An account in the same transaction as its custody change or its move approves nothing (audit 2026-12-02
|
|
123
|
+
// H-2, the move-transaction route); one that cannot answer is refused.
|
|
124
|
+
Eip7702.refuseDelegatedEOA(msg.sender); // spec 448 §0 (EIP-7702)
|
|
125
|
+
if (msg.sender.code.length != 0 && ICustodyEpochView(msg.sender).approvalRefused()) {
|
|
126
|
+
revert ApprovalAfterCustodyChange();
|
|
127
|
+
}
|
|
128
|
+
_approvedAt[msg.sender][key] = _epoch[msg.sender] + 1;
|
|
129
|
+
emit HashApproved(msg.sender, key);
|
|
45
130
|
}
|
|
46
131
|
|
|
47
|
-
/// @notice Revoke a previously-approved hash before redemption.
|
|
132
|
+
/// @notice Revoke a previously-approved hash before redemption (keyed as `approveHash` keys it).
|
|
48
133
|
function revokeHash(bytes32 hash) external {
|
|
49
|
-
|
|
50
|
-
|
|
134
|
+
bytes32 key = _keyOf(msg.sender, hash);
|
|
135
|
+
_approvedAt[msg.sender][key] = 0;
|
|
136
|
+
emit HashRevoked(msg.sender, key);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// @notice The key `approveHash(hash)` from `signer` records NOW: the raw hash for a signer with no code;
|
|
140
|
+
/// `keccak256(abi.encode(hash, signer.custodyEpoch()))` for an account. Reverts for a contract
|
|
141
|
+
/// that does not answer `custodyEpoch()`.
|
|
142
|
+
function keyOf(address signer, bytes32 hash) external view returns (bytes32) {
|
|
143
|
+
return _keyOf(signer, hash);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// @dev Audit 2026-12-02 H-2 / THESIS-1a: the epoch is the caller's own current one, read here — never an
|
|
147
|
+
/// argument. One mechanism per kind of signer; an account that cannot say its epoch is refused.
|
|
148
|
+
function _keyOf(address signer, bytes32 hash) private view returns (bytes32) {
|
|
149
|
+
// A delegated EOA is keyed as the EOA it is (spec 448 §0): it approves nothing (refused above) but can
|
|
150
|
+
// still revoke the raw approvals its key made before it delegated.
|
|
151
|
+
if (signer.code.length == 0 || Eip7702.isDelegatedEOA(signer)) return hash;
|
|
152
|
+
return keccak256(abi.encode(hash, ICustodyEpochView(signer).custodyEpoch()));
|
|
51
153
|
}
|
|
52
154
|
|
|
53
|
-
/// @notice
|
|
155
|
+
/// @notice R917-C-2 — revoke EVERY hash `msg.sender` ever approved, in one call. The per-hash
|
|
156
|
+
/// approvals are unenumerable on chain; this is how a signer that suspects a planted approval
|
|
157
|
+
/// voids all of them without knowing which.
|
|
158
|
+
function revokeAll() external {
|
|
159
|
+
uint64 next = _epoch[msg.sender] + 1;
|
|
160
|
+
_epoch[msg.sender] = next;
|
|
161
|
+
emit AllHashesRevoked(msg.sender, next);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/// @notice The signer's current epoch (informational; `isApproved` already accounts for it).
|
|
165
|
+
function epochOf(address signer) external view returns (uint64) {
|
|
166
|
+
return _epoch[signer];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/// @notice Whether `signer` approved `hash` under its CURRENT epoch. External view used by the
|
|
170
|
+
/// `0x03` sentinel and by `QuorumEnforcer`'s `v == 1` path.
|
|
54
171
|
function isApproved(address signer, bytes32 hash) external view returns (bool) {
|
|
55
|
-
|
|
172
|
+
uint64 at = _approvedAt[signer][hash];
|
|
173
|
+
return at != 0 && at == _epoch[signer] + 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/// @notice Back-compat read shape of the former public mapping: true iff currently approved.
|
|
177
|
+
function approved(address signer, bytes32 hash) external view returns (bool) {
|
|
178
|
+
uint64 at = _approvedAt[signer][hash];
|
|
179
|
+
return at != 0 && at == _epoch[signer] + 1;
|
|
56
180
|
}
|
|
57
181
|
}
|
package/src/IAgentAccount.sol
CHANGED
|
@@ -90,6 +90,43 @@ struct AgentAccountRecoveryArgs {
|
|
|
90
90
|
bytes32[] removePasskeyCredentialIdDigests;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* @notice Payload for `CustodyAction.RotateCredential` (T4) — spec 410 §1.2. A PLANNED rotation: the
|
|
95
|
+
* old credential is still controlled, the person (or an org's quorum) registers the new one,
|
|
96
|
+
* retires the old one, and re-approves every standing approved-digest wire under the new epoch
|
|
97
|
+
* — in ONE applied change, so no wire is dead between the retirement and the re-approval.
|
|
98
|
+
*
|
|
99
|
+
* Exactly one credential is added (`addOwner` XOR `addPasskey.x != 0`) and exactly one retired
|
|
100
|
+
* (`removeOwner` XOR `removePasskeyCredentialIdDigest != 0`). `reapprove` lists the delegation
|
|
101
|
+
* digests to approve after the retirement; the module calls `AgentAccount.approveDigest` for
|
|
102
|
+
* each, so the key is derived on chain under the post-rotation epoch.
|
|
103
|
+
*
|
|
104
|
+
* This is the ONLY custody action that carries a re-approval list. `AgentAccountRecoveryArgs`
|
|
105
|
+
* has no such field by construction: a recovery is the moment a planted grant would otherwise
|
|
106
|
+
* ride through, so recovery re-approves nothing and ends with `revokeAllApprovedDigests`.
|
|
107
|
+
*
|
|
108
|
+
* GENERATION 4 (spec 445 §1.3 (ii)) — two fields APPENDED, so the ABI encoding of this struct changed
|
|
109
|
+
* (a generation-3 payload does not decode; the EIP-712 typehashes did not change — the args ride as
|
|
110
|
+
* `argsHash`). A retirement now also expels every non-canonical executor module and a non-canonical
|
|
111
|
+
* delegation manager, so the rotation carries what the owner KEEPS:
|
|
112
|
+
* `reaffirmModules` — installed executor modules to re-stamp under the new epoch
|
|
113
|
+
* (`AgentAccount.reaffirmModule` each), after the retirement;
|
|
114
|
+
* `reaffirmDelegationManager` — re-stamp the current delegation manager
|
|
115
|
+
* (`AgentAccount.reaffirmDelegationManager`). Needed only when it
|
|
116
|
+
* is not the factory's canonical one.
|
|
117
|
+
* The whole ceremony stays one applied change: add → retire → approveDigest×N → reaffirm×M.
|
|
118
|
+
* `AgentAccountRecoveryArgs` has neither field, by construction: a recovery re-affirms nothing.
|
|
119
|
+
*/
|
|
120
|
+
struct AgentAccountRotateCredentialArgs {
|
|
121
|
+
address addOwner;
|
|
122
|
+
AgentAccountRecoveryPasskeyAdd addPasskey;
|
|
123
|
+
address removeOwner;
|
|
124
|
+
bytes32 removePasskeyCredentialIdDigest;
|
|
125
|
+
bytes32[] reapprove;
|
|
126
|
+
address[] reaffirmModules;
|
|
127
|
+
bool reaffirmDelegationManager;
|
|
128
|
+
}
|
|
129
|
+
|
|
93
130
|
/**
|
|
94
131
|
* @title IAgentAccount
|
|
95
132
|
* @notice Interface for an agent-native ERC-4337 smart account.
|