@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.
Files changed (110) hide show
  1. package/AUDIT.md +36 -4
  2. package/deployments-faithchain.json +94 -68
  3. package/deployments-hopechain.json +71 -52
  4. package/dist/abi/AccountBootstrap.json +99 -0
  5. package/dist/abi/AgentAccount.json +95 -56
  6. package/dist/abi/AgentAccountFactory.json +189 -0
  7. package/dist/abi/AgentNameAttributeResolver.json +188 -0
  8. package/dist/abi/AgentNameRegistry.json +170 -0
  9. package/dist/abi/AgentNameUniversalResolver.json +188 -0
  10. package/dist/abi/AgentProfileResolver.json +188 -0
  11. package/dist/abi/AgentRegistryBase.json +193 -0
  12. package/dist/abi/AgentRelationship.json +193 -0
  13. package/dist/abi/AgenticGovernance.json +123 -0
  14. package/dist/abi/AgreementRegistry.json +193 -0
  15. package/dist/abi/AllowedMethodsEnforcer.json +193 -0
  16. package/dist/abi/AllowedTargetsEnforcer.json +193 -0
  17. package/dist/abi/ApprovedHashRegistry.json +220 -0
  18. package/dist/abi/AttestationRegistry.json +193 -0
  19. package/dist/abi/CallDataHashEnforcer.json +193 -0
  20. package/dist/abi/CustodyPolicy.json +195 -80
  21. package/dist/abi/DelegationManager.json +185 -0
  22. package/dist/abi/DigestBindingEnforcer.json +188 -0
  23. package/dist/abi/Eip7702.json +13 -0
  24. package/dist/abi/EstateProjectionRegistry.json +193 -0
  25. package/dist/abi/Generation5Bridge.json +355 -0
  26. package/dist/abi/GeoFeatureRegistry.json +193 -0
  27. package/dist/abi/ICustodyEpochView.json +28 -0
  28. package/dist/abi/IDelegationManager.json +18 -0
  29. package/dist/abi/IGeneration4Reads.json +143 -0
  30. package/dist/abi/IGeneration5Account.json +33 -0
  31. package/dist/abi/IGeneration5Voucher.json +26 -0
  32. package/dist/abi/IMoveAccountView.json +57 -0
  33. package/dist/abi/IMoveCustodyView.json +169 -0
  34. package/dist/abi/IMoveFactoryView.json +41 -0
  35. package/dist/abi/ITimelockVeto.json +93 -0
  36. package/dist/abi/OntologyTermRegistry.json +211 -0
  37. package/dist/abi/PayloadClassesEnforcer.json +193 -0
  38. package/dist/abi/PaymentEnforcer.json +188 -0
  39. package/dist/abi/PaymentEscrow.json +177 -0
  40. package/dist/abi/PaymentReceiptRegistry.json +206 -0
  41. package/dist/abi/PermissionlessSubregistry.json +188 -0
  42. package/dist/abi/PricedSubregistry.json +215 -0
  43. package/dist/abi/QuorumEnforcer.json +193 -0
  44. package/dist/abi/ReceiptAnchorRegistry.json +193 -0
  45. package/dist/abi/RelationshipTypeRegistry.json +211 -0
  46. package/dist/abi/ShapeRegistry.json +211 -0
  47. package/dist/abi/SignatureVerifier.json +196 -0
  48. package/dist/abi/SkillDefinitionRegistry.json +193 -0
  49. package/dist/abi/SmartAgentPaymaster.json +236 -1
  50. package/dist/abi/StableProxyGoverned.json +190 -0
  51. package/dist/abi/StableProxyGovernedOneShot.json +172 -0
  52. package/dist/abi/TimestampEnforcer.json +193 -0
  53. package/dist/abi/TreasurySpendPolicy.json +193 -0
  54. package/dist/abi/UpgradeVoucher.json +156 -4
  55. package/dist/abi/ValueEnforcer.json +193 -0
  56. package/dist/abi/index.d.ts +14 -0
  57. package/dist/abi/index.js +14 -0
  58. package/dist/deployments/faithchain.d.ts +34 -14
  59. package/dist/deployments/faithchain.js +93 -69
  60. package/dist/deployments/hopechain.d.ts +20 -7
  61. package/dist/deployments/hopechain.js +72 -55
  62. package/package.json +1 -1
  63. package/src/AccountBootstrap.sol +38 -0
  64. package/src/AgentAccount.sol +149 -41
  65. package/src/AgentAccountFactory.sol +52 -13
  66. package/src/ApprovedHashRegistry.sol +98 -9
  67. package/src/SmartAgentPaymaster.sol +96 -12
  68. package/src/UniversalSignatureValidator.sol +7 -0
  69. package/src/UpgradeVoucher.sol +16 -3
  70. package/src/agency/DelegationManager.sol +106 -32
  71. package/src/agency/IDelegationManager.sol +28 -0
  72. package/src/agreement/AgreementRegistry.sol +16 -15
  73. package/src/attestation/AttestationRegistry.sol +39 -16
  74. package/src/custody/CustodyPolicy.sol +36 -35
  75. package/src/custody/TreasurySpendPolicy.sol +10 -1
  76. package/src/enforcers/AllowedMethodsEnforcer.sol +7 -1
  77. package/src/enforcers/AllowedTargetsEnforcer.sol +7 -1
  78. package/src/enforcers/CallDataHashEnforcer.sol +7 -1
  79. package/src/enforcers/DigestBindingEnforcer.sol +5 -2
  80. package/src/enforcers/PayloadClassesEnforcer.sol +7 -1
  81. package/src/enforcers/PaymentEnforcer.sol +5 -2
  82. package/src/enforcers/QuorumEnforcer.sol +7 -1
  83. package/src/enforcers/TimestampEnforcer.sol +7 -1
  84. package/src/enforcers/ValueEnforcer.sol +7 -1
  85. package/src/geo/GeoFeatureRegistry.sol +15 -1
  86. package/src/governance/AgenticGovernance.sol +145 -0
  87. package/src/governance/GovernanceManaged.sol +2 -0
  88. package/src/governance/StableProxyGoverned.sol +79 -0
  89. package/src/governance/StableProxyGovernedOneShot.sol +93 -0
  90. package/src/identity/AgentProfileResolver.sol +11 -2
  91. package/src/libraries/Eip7702.sol +36 -0
  92. package/src/libraries/SignatureSlotRecovery.sol +4 -0
  93. package/src/libraries/SignatureVerifier.sol +52 -0
  94. package/src/libraries/WebAuthnLib.sol +3 -0
  95. package/src/migration/Generation5Bridge.sol +364 -0
  96. package/src/naming/AgentNameAttributeResolver.sol +12 -2
  97. package/src/naming/AgentNameRegistry.sol +84 -10
  98. package/src/naming/AgentNameUniversalResolver.sol +9 -2
  99. package/src/naming/PermissionlessSubregistry.sol +13 -2
  100. package/src/naming/PricedSubregistry.sol +59 -3
  101. package/src/ontology/OntologyTermRegistry.sol +30 -2
  102. package/src/ontology/ShapeRegistry.sol +30 -2
  103. package/src/payments/PaymentEscrow.sol +16 -1
  104. package/src/payments/PaymentReceiptRegistry.sol +28 -3
  105. package/src/provenance/ReceiptAnchorRegistry.sol +13 -1
  106. package/src/registry/AgentRegistryBase.sol +21 -1
  107. package/src/registry/EstateProjectionRegistry.sol +15 -1
  108. package/src/relationships/AgentRelationship.sol +17 -1
  109. package/src/relationships/RelationshipTypeRegistry.sol +30 -2
  110. package/src/skills/SkillDefinitionRegistry.sol +15 -1
@@ -1,65 +1,82 @@
1
1
  // Generated by scripts/build-deployments.mjs — do not edit by hand.
2
2
  // Source: deployments-hopechain.json
3
3
  export const CONTRACTS = {
4
- "agentAccountFactory": "0x73A7B878168b7DE48677617179A8bE894f0Dfe96",
5
- "agentAccountImplementation": "0xd39E59385e3380EEa10F06F55BA372d6085A21d4",
6
- "agentNameRegistry": "0x60c7a6b34217da304b75cf72C73269625900318c",
7
- "agentNameResolver": "0x0E22171844ba88B4e572B33E60E82e0B762301CF",
8
- "agentNameUniversalResolver": "0xe3Bf0C39B082C4DE81a919eAaA45A7f3FB19447e",
9
- "agentProfileResolver": "0x89Ab6eB35e0C7c7B91eAaCbe1A0f42e00B5d2C9d",
10
- "agentRelationship": "0xeBe1247403fB8e82f0cBb70D158AE38f627174A2",
11
- "agenticGovernance": "0x783e095F5f020ddd552B453103d74DAf6144C700",
12
- "agreementRegistry": "0x733Aa1F5D43E561B64b109af2864dD9A80e3c91F",
13
- "allowedMethodsEnforcer": "0x8759c1a6cEBF1D5069e9434EF46327Bf2ef69975",
14
- "allowedTargetsEnforcer": "0xdBb2E47793393C499efB0f3fcbf6Ca8669791a41",
15
- "approvedHashRegistry": "0x464eEe7518c3c97DA570592481329E0627E9a3B8",
16
- "attestationRegistry": "0x2D5EFeeB87f60244530e0a1ed420755090295cC4",
17
- "callDataHashEnforcer": "0x9bF556A36F3dF3972E355dE4215476Dc268bD0C7",
18
- "chainId": 34349,
19
- "contractsGeneration": 3,
20
- "custodyPolicy": "0xfb3662Ddc308FAc977A1F663948A447055722d3B",
21
- "delegationManager": "0x710cb1bF08C234Df397e0910331e0A29710EF4F7",
22
- "deployer": "0x1fcd93189311bedE20a02592cC83f31199A303bF",
23
- "digestBindingEnforcer": "0x5FfDd6186C1bBc4628187B1c4C1fDaA39F870d43",
24
- "entryPoint": "0xf7855250B3363AB7649B10957d8908A9AFcdD4B5",
25
- "estateProjectionRegistry": "0xF47F9a22fFFab9F5aB9b58131B94990eB2829B78",
26
- "geoFeatureRegistry": "0x1791316684f08ca7158c639C528980d780B47051",
27
- "mockUsdc": "0xBd19d53981677357052EF9768B70929217a6F1F0",
28
- "ontologyTermRegistry": "0xF343054e046A4145ccae499ECB28197394eE0798",
29
- "payloadClassesEnforcer": "0x07fA0aE59FdE4B7ce8962d6fE7a1d648ec3DD5CE",
30
- "paymentEnforcer": "0xeDd56f500325D4701B9985A34e5Fa6EED6716137",
31
- "paymentReceiptRegistry": "0xbd93fEC6910ffD74F14709188b5a9B6C6965b2a7",
32
- "permissionlessSubregistries": {
33
- "church": "0x5eA2Bd3986f1924764d145515C3680fAbaaBbE6a",
34
- "circle": "0x57Db73fA77C19601f5dCdeB79de40aAE9C505892",
35
- "me": "0xd864CBD9d5c3F3d859e8Ab2d691C3694E73ab23f",
36
- "org": "0xB720087dA4659bd1039eef838022B68e17EB9be5",
37
- "registry": "0x7fd5e2A3a49c321a4CEd39bE403eCde2Fc1CB823",
38
- "svc": "0x833aAD7bBAE7b6C250F837e8CBD2022Cf42ae58e",
39
- "team": "0x5b580E741DBb4f57F6D885dF2c12F4e0B53B6f50",
40
- "treasury": "0x1a960E5E2A533F37345a643552584be142A511b5",
41
- "workspace": "0xfD07A5A28A4e430ee6ca4Cd825451CB4FF81DCF7"
42
- },
43
- "permissionlessSubregistry": "0xa91c1ff07b79460d8a763aed3C882ACDB2cB3719",
4
+ "_chainNote": "hopechain (34349) — THE SECOND TOWN, stood up 2026-10-14 on the operator's existing VM beside faithchain. Same posture: private Besu/QBFT, free gas, deployer-EOA authority, two validators. It exists so the federation twin runs across two CHAINS, which is the half every gate has been unable to prove.",
5
+ "_generation4Note": "spec 445 (2026-11-11): FRESH generation-4 Deploy.s.sol at sourceCommit; every generation-3 contract and account on this chain is orphaned history (the gen-3 manifest is in git at the commit before this one). imbnet re-charters on agentAccountFactory; catch-up terms (atl:accounts, atl:clientKeys, atl:projectionSigner, atl:capabilities, discovery, 329, 331, distribution) registered and active.",
6
+ "_incompleteNote": "Four keys faithchain has are absent here and are not omissions: agentRegistryBase (DeployAgentRegistry) and namingCoin / namingFeeTreasury / namingServiceAgent / pricedSubregistries (spec 431 paid names; hopechain's roots close at faithchain, spec 440).",
7
+ "_neutralGroundNote": "estateProjectionRegistry IS deployed here because Deploy.s.sol deploys it unconditionally, and it MUST NOT BE USED. Neutral ground stays on faithchain: generation 4 re-deployed it there on 2026-11-11 at 0x489E2b147C7F13fCf1c9e7A827a4D9Fd7bE2FEb9 (deployments-faithchain.json estateProjectionRegistry, federation.yaml registry). Both estates anchor to that one registry.",
44
8
  "_permissionlessSubregistryRetired": "retired 2026-11-10 (owner's decision): the subregistry of the impact root, which remains on chain as recorded history — not resolved or claimed through the SDK, never written by Deploy.s.sol again. Read permissionlessSubregistries.<tld> (a person claims under .me).",
45
9
  "_retiredRoots": [
46
10
  "impact"
47
11
  ],
48
- "permissionlessSubregistryDemoAgent": "0x0222388C3F9612058fb1bB2A9760c470DbD2121b",
49
- "quorumEnforcer": "0xdaE09066A2cc32f6203605619137dcF01A9B49Ae",
50
- "relationshipTypeRegistry": "0xA14afaE192596CE0B1Eb86C583d1EEC62f246999",
51
- "relaxedT4Floor": false,
52
- "shapeRegistry": "0xBC6DA292843500cEd8D4DF3ECbD690f8cf25E46b",
53
- "skillDefinitionRegistry": "0xad31CAE8A5805DD03608f0292bE6F70074f10909",
54
- "smartAgentPaymaster": "0x60E949D52660A9D4143ecB0fdA56c0457f20aED9",
55
- "timestampEnforcer": "0x2156311097A936de1916a878bF53Bfd43c7b5715",
56
- "treasurySpendPolicy": "0xC6a4983bC6649f7C46c9E7d83f1Cd7e9078AFc7b",
57
- "universalSignatureValidator": "0xa5855906C0De3813E74BEe201973071e0c844115",
58
- "valueEnforcer": "0x142e97F9012e587330Cfe6222E01338D1A200378",
59
- "_chainNote": "hopechain (34349) — THE SECOND TOWN, stood up 2026-10-14 on the operator's existing VM beside faithchain. Same posture: private Besu/QBFT, free gas, deployer-EOA authority, two validators. It exists so the federation twin runs across two CHAINS, which is the half every gate has been unable to prove.",
60
- "_neutralGroundNote": "estateProjectionRegistry IS deployed here because Deploy.s.sol deploys it unconditionally — and it MUST NOT BE USED. Neutral ground stays on faithchain (0xb4E116F5C6915a4f1e649E0877e4a0A7a1c1147b): the whole value of the twin is that both estates anchor to the SAME registry on a chain neither of them is moving to, so an estate that anchored here would prove nothing. federation.yaml points at faithchain's and this copy is an artifact of the script, not a choice.",
61
12
  "_sameAddressNote": "Several addresses match faithchain's exactly (entryPoint, delegationManager and others): same deployer, same nonces, fresh chain, so CREATE lands them identically. Convenient, and a trap — an address alone no longer says which chain you are on. CHAIN_ID is required everywhere and chainIdOf throws when unset (ap-home spec 441); the twin's gates must pass chain per estate rather than infer it.",
62
- "_incompleteNote": "Six keys faithchain has are absent here and are W2 work, not omissions: agentRegistryBase (DeployAgentRegistry), receiptAnchorRegistry (AddReceiptAnchorRegistry — the harness treats it as optional and runs without an anchor port), and namingCoin / namingFeeTreasury / namingServiceAgent / pricedSubregistries (spec 431 paid names, which need the town's naming service agent chartered first).",
63
- "deploymentEpoch": "ep_c5dec9f31b782b8a"
13
+ "agentAccountFactory": "0xfe3cf985c43B7815A133aB562D6509b5758EFb73",
14
+ "agentAccountImplementation": "0x3B5ADC4e400D735F6Dc9cb1Fc6c825DB02193d4D",
15
+ "agentNameRegistry": "0x3DBf8B380FBeE9fF2C9669A763ca4Be6A03E989c",
16
+ "agentNameResolver": "0x9B34F1eEcbF53A93C6EFB3fCa24FfEAAf67d9044",
17
+ "agentNameUniversalResolver": "0xd51aBA0438c93dFf06d2FAe07787d3397b999122",
18
+ "agentProfileResolver": "0x17DD386Ecd2844494F96C8829685E4ffde0DF9fd",
19
+ "agentRelationship": "0x147Bfc8736cC01566896442dac46499987C21E0d",
20
+ "agenticGovernance": "0x44fdf0c1aFdFC2B9E8105AB686A59c1fDEBD4A5b",
21
+ "agreementRegistry": "0x0B4B34b21a4E396489344cDFEe1d15F3EDE7AE4E",
22
+ "allowedMethodsEnforcer": "0xc855783ffCf27983E536c5765BF41FDD9a15D568",
23
+ "allowedTargetsEnforcer": "0x916d177Fe3F504d630F172C32fc89328b841d546",
24
+ "approvedHashRegistry": "0xa2Aa30B27BC0432df44C39b5A4E9f058546765c3",
25
+ "attestationRegistry": "0x79347E0FB5958Adc70C59F46808D32216e90d4e1",
26
+ "callDataHashEnforcer": "0x7DEb764670BfB96b97E7FDE5db07BB37A9c90727",
27
+ "chainId": 34349,
28
+ "contractsGeneration": 4,
29
+ "custodyPolicy": "0xcA9f428d8ab9d74B7f3158f21d6b00b018E29908",
30
+ "delegationManager": "0x80Cb228891D354F466E12a93A1726BFE740f9904",
31
+ "deployer": "0x1fcd93189311bedE20a02592cC83f31199A303bF",
32
+ "digestBindingEnforcer": "0x6413C106c0550fFb6D03FB8F2ED550ec9c838724",
33
+ "entryPoint": "0xaF02Ff118442DfD4e98B9Ffc2392647653B72411",
34
+ "entryPointDeployedHere": true,
35
+ "estateProjectionRegistry": "0xAAf63cFbfBf050452334759818eB0f8F36C35F3f",
36
+ "geoFeatureRegistry": "0x7C13635edeA25A93D1c93129d140618bC794525d",
37
+ "governanceGuardian": "0x1fcd93189311bedE20a02592cC83f31199A303bF",
38
+ "mockUsdc": "0x9e24f6d81e801dFceFA9DC15475A411727DCA5Ca",
39
+ "namingInitializer": "0x1fcd93189311bedE20a02592cC83f31199A303bF",
40
+ "namingInitializerPending": "0x0000000000000000000000000000000000000000",
41
+ "ontologyTermRegistry": "0x2758B19B717a13B0943088a3141f3454a90A8C78",
42
+ "payloadClassesEnforcer": "0x3d3b2320A18017538542Eb97bE58401a851e38a8",
43
+ "paymasterDevMode": true,
44
+ "paymentEnforcer": "0x21ea8C741c7496B70aE64efbd763967cD9912C30",
45
+ "paymentReceiptRegistry": "0x63bFc81a4Aecfac24Db5f736E21163ccD299a7Cd",
46
+ "pendingGovernanceCalls": [],
47
+ "permissionlessSubregistries": {
48
+ "church": "0xF67b169d528bfc93eF7b45684CF2429CA6939Bc0",
49
+ "circle": "0x5A11D8ff4E5Ef341c66C98dFD2441b5858d8e293",
50
+ "me": "0x83a9a318e37F482e570B0Dc930b20dfC35B2a247",
51
+ "org": "0xdDBDA5B0f1db34741FDA56E2467f0b537680605E",
52
+ "registry": "0x3BBeCcC7a52E1CE04a3BF7E7404D3BCBF566C490",
53
+ "svc": "0x0ECeE247Ec902A7E024644e783976CECe60138dC",
54
+ "team": "0x95f5DE78F2DE8020CEA417B18bA285D28e456C4a",
55
+ "treasury": "0x107060f796bdf2495C6Ce9074ED49fe785bfFE0b",
56
+ "workspace": "0x9CB1Fdc6A2CEb6dec35CAc20AbD43b2952b12169"
57
+ },
58
+ "permissionlessSubregistryDemoAgent": "0xa31Cf967AA5ec8ade7D41e05dF545fFeFd810BA4",
59
+ "quorumEnforcer": "0x6C5cF260fBBE4ffc27Ae7CC9a387aB0Ec228b01b",
60
+ "receiptAnchorRegistry": "0xb4EF463c14f411767f7dddfAaE440caA37b7dC17",
61
+ "relationshipTypeRegistry": "0x2d1C7730D29Ba8aEE1D02f59eF0BBE88b439560e",
62
+ "relaxedT4Floor": false,
63
+ "shapeRegistry": "0x7230088690E6dd4171D365E1F8B8a336fFD49C7E",
64
+ "skillDefinitionRegistry": "0x5ffc1F2a8002DCb0d38CcC0c9F9454c7B0ed867C",
65
+ "smartAgentPaymaster": "0x2891973D7208b56255130EE66066c0e3d82d6ac7",
66
+ "sourceCommit": "24ff3d45669f9a8b37b6221f2f68e9feb774e68e",
67
+ "timelockAdmin": "0x1fcd93189311bedE20a02592cC83f31199A303bF",
68
+ "timelockController": "0x7CFd6f4Fef71F8E5Cbb51F5d1080BB44EcF776e1",
69
+ "timelockExecutors": [
70
+ "0x1fcd93189311bedE20a02592cC83f31199A303bF"
71
+ ],
72
+ "timelockProposers": [
73
+ "0x1fcd93189311bedE20a02592cC83f31199A303bF"
74
+ ],
75
+ "timestampEnforcer": "0xE46ED59C9AA1e04d42E5C348E66155275358Fa25",
76
+ "treasurySpendPolicy": "0x4a4069a069E8A558DFfC2B8D5145BD263c542804",
77
+ "universalSignatureValidator": "0xC70f4897A92D16a9CF04c1B8646A268cA0fBfE55",
78
+ "upgradeVoucher": "0xB02931a7BE16B12e272F8075f770D952A61e2F9c",
79
+ "valueEnforcer": "0x75620A9576363A10845B3E07B24bE6bfb956Ef08",
80
+ "deploymentEpoch": "ep_baf9bc2b7f2252cd"
64
81
  };
65
82
  export default CONTRACTS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/contracts",
3
- "version": "1.0.0-alpha.47",
3
+ "version": "1.0.0-alpha.49",
4
4
  "type": "module",
5
5
  "description": "Solidity contracts + ABIs + flattened sources + per-network deployment addresses for the agenticprimitives stack.",
6
6
  "homepage": "https://agenticprimitives.dev",
@@ -0,0 +1,38 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
5
+
6
+ /**
7
+ * @title AccountBootstrap
8
+ * @notice Spec 447 §3.2 — the placeholder implementation every new account proxy is first deployed pointing at, so
9
+ * an account's CREATE2 address depends on the factory, this placeholder and the salt, and NEVER on the account
10
+ * code or any system contract (the ENSv2 verifiable-factory property, reached the ERC-8004 way: a
11
+ * placeholder first, the real implementation after). A new generation of account code therefore never
12
+ * changes where a person's account is.
13
+ *
14
+ * In the same transaction that deploys the proxy, the factory calls {bootstrap}, which upgrades the proxy to
15
+ * the real implementation and runs its initializer. Only the factory may, and only once: after it the proxy
16
+ * runs `AgentAccount`, which has no `bootstrap`.
17
+ */
18
+ contract AccountBootstrap {
19
+ /// @notice The factory allowed to bootstrap a proxy pointing here.
20
+ address public immutable factory;
21
+ /// @dev This placeholder's own address, to tell "still pointing at the placeholder" apart under delegatecall.
22
+ address private immutable _self;
23
+
24
+ error NotFactory();
25
+ error AlreadyBootstrapped();
26
+
27
+ constructor(address factory_) {
28
+ factory = factory_;
29
+ _self = address(this);
30
+ }
31
+
32
+ /// @notice Point the proxy (delegatecalling here) at `implementation` and run `initData` on it.
33
+ function bootstrap(address implementation, bytes calldata initData) external {
34
+ if (msg.sender != factory) revert NotFactory();
35
+ if (address(this) == _self || ERC1967Utils.getImplementation() != _self) revert AlreadyBootstrapped();
36
+ ERC1967Utils.upgradeToAndCall(implementation, initData);
37
+ }
38
+ }
@@ -14,6 +14,7 @@ import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
14
14
  import "./IAgentAccount.sol";
15
15
  import "./libraries/SignatureSlotRecovery.sol";
16
16
  import "./libraries/WebAuthnLib.sol";
17
+ import {SignatureVerifier} from "./libraries/SignatureVerifier.sol";
17
18
 
18
19
  /// @dev Minimal subset of AgentAccountFactory's surface used by the
19
20
  /// account to look up factory-scoped capability roles. We avoid a
@@ -133,6 +134,11 @@ contract AgentAccount is
133
134
  /// it is running NOW. Zero / no code ⇒ every upgrade is refused (fail closed) — see
134
135
  /// `upgradeToAndCall` for the migration statement.
135
136
  address private immutable _upgradeVoucher;
137
+ /// @notice Spec 449: the stateless verifier that runs this implementation's WebAuthn assertion check (decode,
138
+ /// authenticator data, client data, low-s, P-256) — moved out of this bytecode for EIP-170 room. Created
139
+ /// by this implementation's constructor, so it is part of what the upgrade voucher vouched; reached by
140
+ /// STATICCALL from `_verifyWebAuthn` only, and it holds no state and no authority.
141
+ address public immutable signatureVerifier;
136
142
 
137
143
  /// @dev Authorized DelegationManager (ERC-7710 executor)
138
144
  address private _delegationManager;
@@ -220,6 +226,31 @@ contract AgentAccount is
220
226
  /// CustodyPolicy's job), regardless of custody mode.
221
227
  bool private transient _delegationExecCtx;
222
228
 
229
+ /// @dev Spec 447 — transient "a vouched upgrade's migration call is running" flag. Set only inside
230
+ /// {upgradeToAndCall}, after the voucher accepted `(newImplementation, keccak256(data))`, around the
231
+ /// delegatecall of `data`. {migrateFactory} runs only while it is set, so the factory an account reads its
232
+ /// canonical custody policy, delegation manager, governance and roles from is moved only by migration data
233
+ /// governance vouched for — never by a standalone call a custodian could make later with any factory
234
+ /// (GC's upgrade rehearsal hazard: a migration also vouched with empty data).
235
+ ///
236
+ /// LAYOUT. Transient variables are APPENDED, never inserted: an upgrade runs old and new code in one
237
+ /// transaction, so the three flags above keep the positions generation 4 gave them and this one takes the
238
+ /// next (slot 0, offset 3). `Generation5Bridge` writes this position by name; `check:storage-layouts` gates
239
+ /// the transient layout.
240
+ bool private transient _upgradeMigrationCtx;
241
+
242
+ /// @dev Audit 2026-12-02 C1-4 — transient "this account was initialized in this transaction". The factory's
243
+ /// one-time module-install exception (`onlySelfOrFactoryInit`) exists only while it is set: the factory
244
+ /// installs a governed account's policy in the transaction that creates it, and a self-governed account —
245
+ /// which the factory never installs anything on — leaves that transaction with the exception gone, as does
246
+ /// an account that moved to a new factory. Appended after `_upgradeMigrationCtx` (slot 0, offset 4).
247
+ bool private transient _initializedThisTx;
248
+
249
+ /// @dev Transient "the custody epoch was bumped in this transaction" (set in `_bumpCustodyEpoch`). On a
250
+ /// custody-governed account `approveDigest` refuses while it is set, outside the custody policy's own
251
+ /// context — see `approveDigest`. Appended after `_initializedThisTx` (slot 0, offset 5).
252
+ bool private transient _epochBumpedThisTx;
253
+
223
254
  /// @dev Spec 007 Phase A.5 — maximum permitted upgrade timelock to
224
255
  /// protect against an owner accidentally setting an absurdly
225
256
  /// large delay that bricks future migrations.
@@ -325,6 +356,13 @@ contract AgentAccount is
325
356
  /// @dev Spec 410 §1 (THESIS-1a): the approved-hash registry is reachable only through
326
357
  /// `approveDigest` / `revokeDigest` / `revokeAllApprovedDigests`, never as an execute target.
327
358
  error ApprovedHashRegistryOnlyViaAccount();
359
+ /// @dev Spec 447: {migrateFactory} outside a vouched upgrade's migration call.
360
+ error MigrationOnly();
361
+ error ApprovalAfterCustodyChange();
362
+ /// @dev Spec 447: the migration target is not a factory (no code, or no custody policy / delegation manager).
363
+ error NotAFactory(address target);
364
+ /// @dev Spec 447: `custodyInit` must be given exactly when the account is custody-governed.
365
+ error CustodyInitMismatch(bool governed);
328
366
 
329
367
  // Spec 445 — generation 4.
330
368
  /// @notice §1.3 (i): the implementation's `UpgradeVoucher` does not vouch for this
@@ -512,6 +550,7 @@ contract AgentAccount is
512
550
  // ─── Constructor / Initializer ──────────────────────────────────
513
551
 
514
552
  constructor(IEntryPoint entryPoint_, address approvedHashRegistry_, address upgradeVoucher_) {
553
+ signatureVerifier = address(new SignatureVerifier());
515
554
  _entryPoint = entryPoint_;
516
555
  _approvedHashRegistry = approvedHashRegistry_;
517
556
  _upgradeVoucher = upgradeVoucher_;
@@ -589,6 +628,7 @@ contract AgentAccount is
589
628
 
590
629
  _delegationManager = dm;
591
630
  _factory = factory_;
631
+ _initializedThisTx = true; // audit C1-4: the factory's install exception lives in this transaction only
592
632
  // Spec 445 §1.3 (ii): a factory-less (legacy / direct-deploy) account has no canonical delegation
593
633
  // manager to compare against, so its initial one is stamped under epoch 0 — and lapses, like any
594
634
  // other non-canonical manager, at the first retirement unless re-affirmed. A factory-born account
@@ -717,10 +757,72 @@ contract AgentAccount is
717
757
  * a generation-4 DelegationManager is a `setDelegationManager` — non-canonical for that account, so
718
758
  * it must be re-affirmed at every rotation; its custody policy keeps the old action set.
719
759
  */
760
+ /// @notice ERC-1822, asked of THIS implementation by an account about to upgrade to it. Answered only for an
761
+ /// account whose running implementation carries this implementation's voucher (spec 448 §0, audit
762
+ /// 2026-12-02 H-2): an account still running code with another voucher — every generation-4 account —
763
+ /// cannot upgrade to this implementation directly, whatever pair its own voucher vouches. Its one way in
764
+ /// is `Generation5Bridge`, whose completion runs `migrateFactory`.
765
+ function proxiableUUID() external view override notDelegated returns (bytes32) {
766
+ if (AgentAccount(payable(msg.sender)).upgradeVoucher() != _upgradeVoucher) revert UpgradeNotVouched(address(this), 0);
767
+ return ERC1967Utils.IMPLEMENTATION_SLOT;
768
+ }
769
+
720
770
  function upgradeToAndCall(address newImplementation, bytes memory data) public payable override onlyProxy {
721
771
  _authorizeUpgrade(newImplementation);
722
772
  _requireVouchedUpgrade(newImplementation, keccak256(data));
773
+ _upgradeMigrationCtx = true;
723
774
  super.upgradeToAndCall(newImplementation, data);
775
+ _upgradeMigrationCtx = false;
776
+ }
777
+
778
+ /// @notice Spec 447 §3.3 — move this account to a new factory, IN PLACE (same address, same custodians,
779
+ /// same storage). Callable only as a vouched upgrade's migration call: the generation-5 move is
780
+ /// `upgradeToAndCall(gen5Implementation, abi.encodeCall(this.migrateFactory, (stableFactory, custodyInit)))`
781
+ /// with that exact pair vouched by governance (and, on a custody-governed account, applied by its own
782
+ /// quorum through `ApplySystemUpdate`). From then on the account reads its canonical custody policy,
783
+ /// delegation manager, governance, bundler and session issuer from the new (stable) factory.
784
+ ///
785
+ /// A CUSTODY-GOVERNED account keeps its custody: when the new factory's canonical policy differs from
786
+ /// the installed one, the new policy is installed with `custodyInit` (the account's own configuration,
787
+ /// the `onInstall` encoding) and the old one is unlisted — it can no longer act on this account; its
788
+ /// stale state stays in the old contract. Without this the account would silently stop being
789
+ /// custody-governed (the old policy is no longer canonical). A self-governed account passes empty
790
+ /// `custodyInit`.
791
+ /// @dev Refused outside a migration (`MigrationOnly`), for a factory with no code or one that names no custody
792
+ /// policy or delegation manager (PR #751: a non-factory `_factory` bricks the account), for a governed
793
+ /// account with no `custodyInit`, and for `custodyInit` on an account that is not governed.
794
+ function migrateFactory(address newFactory, bytes calldata custodyInit) external {
795
+ if (!_upgradeMigrationCtx) revert MigrationOnly();
796
+ if (newFactory.code.length == 0) revert NotAFactory(newFactory);
797
+ address newPolicy = IAgentAccountFactoryView(newFactory).custodyPolicy();
798
+ if (newPolicy == address(0) || IAgentAccountFactoryView(newFactory).delegationManager() == address(0)) {
799
+ revert NotAFactory(newFactory);
800
+ }
801
+ address oldFactory = _factory;
802
+ address oldPolicy = oldFactory == address(0) ? address(0) : IAgentAccountFactoryView(oldFactory).custodyPolicy();
803
+ ModulesStorage storage $ = _modulesStorage();
804
+ bool governed = oldPolicy != address(0) && $.installed[MODULE_TYPE_EXECUTOR][oldPolicy];
805
+ if (governed != (custodyInit.length != 0)) revert CustodyInitMismatch(governed);
806
+
807
+ // Audit H-2 (C1-2 / C3-1): the registry this implementation reads was an ordinary call target for the
808
+ // code the account ran before, so anything approved there (for this or any later custody epoch) was
809
+ // approved outside `approveDigest`. The move voids all of it HERE, in every custody mode — not in a step
810
+ // of the mover's batch.
811
+ _revokeAllApproved();
812
+ emit FactoryMigrated(oldFactory, newFactory);
813
+ _factory = newFactory;
814
+ if (!governed || newPolicy == oldPolicy) return;
815
+
816
+ $.installed[MODULE_TYPE_EXECUTOR][oldPolicy] = false;
817
+ _removeFromList($.installedList[MODULE_TYPE_EXECUTOR], oldPolicy);
818
+ delete _moduleEpochStamp[oldPolicy];
819
+ emit ModuleUninstalled(MODULE_TYPE_EXECUTOR, oldPolicy);
820
+
821
+ $.installed[MODULE_TYPE_EXECUTOR][newPolicy] = true;
822
+ $.installedList[MODULE_TYPE_EXECUTOR].push(newPolicy);
823
+ _moduleEpochStamp[newPolicy] = _custodyEpoch + 1;
824
+ IERC7579ModuleLike(newPolicy).onInstall(custodyInit); // a refusal reverts the whole upgrade
825
+ emit ModuleInstalled(MODULE_TYPE_EXECUTOR, newPolicy);
724
826
  }
725
827
 
726
828
  /// @dev Spec 445 §1.3 (i). See `upgradeToAndCall`. Low-level staticcall so a voucher that reverts or
@@ -1165,7 +1267,7 @@ contract AgentAccount is
1165
1267
  _;
1166
1268
  return;
1167
1269
  }
1168
- if (msg.sender == _factory && !_factoryInitConsumed) {
1270
+ if (msg.sender == _factory && _initializedThisTx && !_factoryInitConsumed) {
1169
1271
  _factoryInitConsumed = true;
1170
1272
  _;
1171
1273
  return;
@@ -1935,53 +2037,35 @@ contract AgentAccount is
1935
2037
  * revert during validation as a banned account — much worse
1936
2038
  * than a clean "this sig is invalid" return.
1937
2039
  *
1938
- * Solidity can't try/catch an internal `abi.decode`, so we
1939
- * route the decode through an external self-call (which CAN
1940
- * be try/catch'd). Gas overhead is ~700 in the success path;
1941
- * the security win is bounded reverts.
2040
+ * The decode runs in an external call (which CAN be
2041
+ * try/catch'd) — since spec 449 the call is to
2042
+ * `signatureVerifier`, which replaced the self-call
2043
+ * `decodeWebAuthnAssertion`.
1942
2044
  */
1943
2045
  function _verifyWebAuthn(bytes32 hash, bytes memory payload) internal view returns (bool) {
1944
- try this.decodeWebAuthnAssertion(payload) returns (WebAuthnLib.Assertion memory a) {
2046
+ // Spec 449: decoding and verification run in `signatureVerifier` (stateless; this implementation's own).
2047
+ // Any revert there — a payload that does not decode, or anything else — is "invalid", never a revert out
2048
+ // of validation (audit C-7; C1-8).
2049
+ SignatureVerifier v = SignatureVerifier(signatureVerifier);
2050
+ try v.credentialOf(payload) returns (bytes32 cid) {
1945
2051
  PasskeyStorage storage $ = _passkeyStorage();
1946
- PasskeyEntry storage key = $.keys[a.credentialIdDigest];
2052
+ PasskeyEntry storage key = $.keys[cid];
1947
2053
  if (key.x == 0 && key.y == 0) return false;
1948
2054
  // H7-C.1 / CON-WEBAUTHN-001: pin per-credential rpIdHash + require UP.
1949
- // R8.2 / ATL-SEC-03: require UV (User Verification) at the library
1950
- // layer. Wave H1 made the JS-side ceremony pass
1951
- // `userVerification: 'required'` for custody-grade flows
1952
- // (demo-sso, demo-sso-next, demo-org, demo-web-recovery); the
1953
- // third-party audit (2026-05-31) correctly observed that the
1954
- // contract still passed `requireUv: false` here. That meant a
1955
- // permissive authenticator could produce a UP-only assertion
1956
- // and we'd accept it. R8.2 makes UV strictly required on every
1957
- // ERC-1271 verify. Browser ceremonies that pass
1958
- // `userVerification: 'preferred'` will be REJECTED at the
1959
- // signature step — those apps (demo-web, demo-web-pro) MUST
1960
- // upgrade to `'required'` for production deployments. Tests
1961
- // exercising lower-assurance flows can install a separate
1962
- // passkey-validator module that relaxes this check.
1963
- bytes32 rpIdHash = $.rpIdHashOf[a.credentialIdDigest];
2055
+ // R8.2 / ATL-SEC-03: User Verification is required on every verify (`verifyWebAuthn` passes
2056
+ // `requireUv = true`); a lower-assurance flow installs a separate validator module.
2057
+ bytes32 rpIdHash = $.rpIdHashOf[cid];
1964
2058
  if (rpIdHash == bytes32(0)) return false;
1965
- return WebAuthnLib.verify(a, hash, key.x, key.y, rpIdHash, /*requireUv*/ true);
2059
+ try v.verifyWebAuthn(payload, hash, key.x, key.y, rpIdHash) returns (bool ok) {
2060
+ return ok;
2061
+ } catch {
2062
+ return false;
2063
+ }
1966
2064
  } catch {
1967
2065
  return false;
1968
2066
  }
1969
2067
  }
1970
2068
 
1971
- /**
1972
- * @notice External decoder wrapper used by `_verifyWebAuthn` to
1973
- * bound `abi.decode` reverts. MUST stay `external` so the
1974
- * caller can wrap it in `try { … } catch { … }`. Marked
1975
- * pure — no state access, just decode.
1976
- */
1977
- function decodeWebAuthnAssertion(bytes calldata payload)
1978
- external
1979
- pure
1980
- returns (WebAuthnLib.Assertion memory)
1981
- {
1982
- return abi.decode(payload, (WebAuthnLib.Assertion));
1983
- }
1984
-
1985
2069
  // ─── Owner Management ───────────────────────────────────────────
1986
2070
 
1987
2071
  /// @inheritdoc IAgentAccount
@@ -2159,6 +2243,8 @@ contract AgentAccount is
2159
2243
  event DigestRevoked(bytes32 indexed digest, uint64 epoch);
2160
2244
  /// @dev Spec 410 §1 — every approval this account ever made is void (registry-side epoch bump).
2161
2245
  event AllDigestsRevoked();
2246
+ /// @notice Spec 447 — the account now reads its system addresses from `newFactory`.
2247
+ event FactoryMigrated(address indexed oldFactory, address indexed newFactory);
2162
2248
 
2163
2249
  /// @notice Register a new WebAuthn credential bound to a specific RP.
2164
2250
  /// `onlySelf` — callable via a UserOp signed by any existing signer
@@ -2267,6 +2353,7 @@ contract AgentAccount is
2267
2353
  function _bumpCustodyEpoch() internal {
2268
2354
  uint64 next = _custodyEpoch + 1;
2269
2355
  _custodyEpoch = next;
2356
+ _epochBumpedThisTx = true;
2270
2357
  emit CustodyEpochBumped(next);
2271
2358
  address pending = _pendingUpgrade.newImplementation;
2272
2359
  if (_pendingUpgrade.readyAt != 0) {
@@ -2284,16 +2371,33 @@ contract AgentAccount is
2284
2371
  /// creating custodian, and the epoch (R917-C-2) plus `revokeAllApprovedDigests` on every
2285
2372
  /// recovery path (spec 410 §1.2) close the persistence risk instead. A delegation stack cannot
2286
2373
  /// reach it (`_isGovernanceSelector`).
2374
+ /// On a custody-governed account no approval is made after a custody-epoch bump in the same
2375
+ /// transaction except by the custody policy itself (`RotateCredential`'s re-approval list): a user
2376
+ /// operation validates before it executes, so a custodian being retired or recovered away could
2377
+ /// otherwise wrap the quorum's applied change in her own batch and approve under the NEW epoch after
2378
+ /// she is out (audit 2026-12-02 H-2 / THESIS-1a). Transient, so it covers every later operation of
2379
+ /// the same bundle too. A mode-0 account rotates in its own batch and is not affected.
2287
2380
  function approveDigest(bytes32 digest) external onlySelf {
2288
2381
  if (_approvedHashRegistry == address(0)) revert ApprovedHashRegistryOnlyViaAccount();
2289
- IApprovedHashRegistryWrite(_approvedHashRegistry).approveHash(approvedHashKey(digest));
2382
+ if (approvalRefused()) revert ApprovalAfterCustodyChange();
2383
+ // The registry derives the key under this account's current epoch itself (audit 2026-12-02 H-2).
2384
+ IApprovedHashRegistryWrite(_approvedHashRegistry).approveHash(digest);
2290
2385
  emit DigestApproved(digest, _custodyEpoch);
2291
2386
  }
2292
2387
 
2388
+ /// @notice Whether an approval made by this account NOW would be refused: a custody-governed account whose
2389
+ /// custody epoch was bumped, or which completed its move to this generation, earlier in this
2390
+ /// transaction, outside the custody policy's own call. `approveDigest` refuses on it, and the
2391
+ /// `ApprovedHashRegistry` asks it of every account signer, so an approval sent to the registry
2392
+ /// directly (a still-running generation-4 call frame after the move) is refused the same way.
2393
+ function approvalRefused() public view returns (bool) {
2394
+ return _epochBumpedThisTx && !_custodyGovCtx && _hasCustodyGovernance();
2395
+ }
2396
+
2293
2397
  /// @notice Revoke one approval made under the current epoch.
2294
2398
  function revokeDigest(bytes32 digest) external onlySelf {
2295
2399
  if (_approvedHashRegistry == address(0)) revert ApprovedHashRegistryOnlyViaAccount();
2296
- IApprovedHashRegistryWrite(_approvedHashRegistry).revokeHash(approvedHashKey(digest));
2400
+ IApprovedHashRegistryWrite(_approvedHashRegistry).revokeHash(digest);
2297
2401
  emit DigestRevoked(digest, _custodyEpoch);
2298
2402
  }
2299
2403
 
@@ -2304,8 +2408,12 @@ contract AgentAccount is
2304
2408
  /// Recovery re-approves nothing: the person re-issues from a reviewed list (spec 410 §1.2).
2305
2409
  function revokeAllApprovedDigests() external onlySelf {
2306
2410
  _requireCustodyGoverned();
2307
- // No registry wired: nothing was ever approvable (the sentinel fails closed, l. ~1388), so there is
2308
- // nothing to void — a no-op, never a revert, so a recovery on such an account still completes.
2411
+ _revokeAllApproved();
2412
+ }
2413
+
2414
+ /// @dev No registry wired: nothing was ever approvable (the sentinel fails closed), so there is nothing to
2415
+ /// void — a no-op, never a revert, so a recovery or a move on such an account still completes.
2416
+ function _revokeAllApproved() internal {
2309
2417
  if (_approvedHashRegistry != address(0)) IApprovedHashRegistryWrite(_approvedHashRegistry).revokeAll();
2310
2418
  emit AllDigestsRevoked();
2311
2419
  }
@@ -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;
@@ -84,7 +87,14 @@ contract AgentAccountFactory is GovernanceManaged {
84
87
  event BundlerSignerChanged(address indexed oldVal, address indexed newVal);
85
88
  event SessionIssuerChanged(address indexed oldVal, address indexed newVal);
86
89
 
87
- uint256[50] private __gap;
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;
88
98
 
89
99
  // ─── Errors ─────────────────────────────────────────────────────────
90
100
 
@@ -155,7 +165,7 @@ contract AgentAccountFactory is GovernanceManaged {
155
165
  address approvedHashRegistry_,
156
166
  bool relaxedT4Floor_,
157
167
  address upgradeVoucher_
158
- ) GovernanceManaged(governance_) {
168
+ ) GovernanceManaged(governance_) initializer {
159
169
  if (custodyPolicy_ == address(0)) revert ZeroAddress();
160
170
  accountImplementation = new AgentAccount(entryPoint_, approvedHashRegistry_, upgradeVoucher_);
161
171
  approvedHashRegistry = approvedHashRegistry_;
@@ -163,12 +173,32 @@ contract AgentAccountFactory is GovernanceManaged {
163
173
  relaxedT4Floor = relaxedT4Floor_;
164
174
  delegationManager = delegationManager_;
165
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 {
166
187
  bundlerSigner = bundlerSigner_;
167
188
  sessionIssuer = sessionIssuer_;
189
+ accountBootstrap = new AccountBootstrap(address(this));
168
190
  emit BundlerSignerChanged(address(0), bundlerSigner_);
169
191
  emit SessionIssuerChanged(address(0), sessionIssuer_);
170
192
  }
171
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
+
172
202
  // ─── Governance-only setters ─────────────────────────────────────────
173
203
 
174
204
  function setBundlerSigner(address newBundler) external onlyGovernance {
@@ -217,11 +247,12 @@ contract AgentAccountFactory is GovernanceManaged {
217
247
  address addr = _getAddressFromSalt(params, deploySalt);
218
248
  if (addr.code.length > 0) return AgentAccount(payable(addr));
219
249
 
220
- ERC1967Proxy proxy = new ERC1967Proxy{salt: deploySalt}(
221
- address(accountImplementation),
222
- _initData(params)
223
- );
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));
224
254
  account = AgentAccount(payable(address(proxy)));
255
+ _created[address(account)] = true;
225
256
 
226
257
  if (params.mode > 0) {
227
258
  bytes memory validatorInit = _buildValidatorInitData(params, timelockOverrides, address(account));
@@ -286,21 +317,29 @@ contract AgentAccountFactory is GovernanceManaged {
286
317
  uint32[7] calldata timelockOverrides,
287
318
  uint256 salt
288
319
  ) internal pure returns (bytes32) {
289
- return keccak256(abi.encode(salt, params.mode, params.trustees, timelockOverrides));
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
+ ));
290
328
  }
291
329
 
292
330
  function _getAddressFromSalt(
293
- AgentAccountInitParams calldata params,
331
+ AgentAccountInitParams calldata,
294
332
  bytes32 deploySalt
295
333
  ) internal view returns (address) {
296
- bytes memory initData = _initData(params);
297
- return _create2Address(initData, deploySalt);
334
+ return _create2Address(deploySalt);
298
335
  }
299
336
 
300
- function _create2Address(bytes memory initData, bytes32 salt) internal view returns (address) {
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) {
301
340
  bytes memory proxyBytecode = abi.encodePacked(
302
341
  type(ERC1967Proxy).creationCode,
303
- abi.encode(address(accountImplementation), initData)
342
+ abi.encode(address(accountBootstrap), bytes(""))
304
343
  );
305
344
  bytes32 bytecodeHash = keccak256(proxyBytecode);
306
345
  return address(uint160(uint256(keccak256(