Skip to content

feat(ops): go 100% ACE API for the ACE-owned surface - #2

Draft
magiodev-cll wants to merge 5 commits into
feat/ace-v1.2.0from
feat/ace-api-configuration
Draft

feat(ops): go 100% ACE API for the ACE-owned surface#2
magiodev-cll wants to merge 5 commits into
feat/ace-v1.2.0from
feat/ace-api-configuration

Conversation

@magiodev-cll

@magiodev-cll magiodev-cll commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Stacked on #1. Reconciles the sample with how ACE is actually operated offchain: everything ACE-owned (PolicyEngine, identity/credential registries, policy instances, policy attachment, extractor registration) is created and wired through the ACE Coordinator API (ace.api.chain.link/v1, surface per the bundled OpenAPI doc), while hardhat deploys only Commertize's own infra contracts. Same split as the Caliber control-plane pattern.

What changes

  • scripts/configure-ace.ts — full validate | plan | apply | verify pipeline over the real API surface: extractors → PolicyEngine (API-deployed via CRE Connect signing)registries (API-deployed) → policy implementations → policy instances → targets → protections. Every resource is polled until its onchain status is created; apply persists the created addresses back into the manifest (needed by the factory phase); verify reconciles API state against onchain readback (getExtractor, getPolicies).
  • scripts/ace-configuration.json — v2 desired-state manifest: 3 extractors (incl. our custom AccountExtractor), 3 policy implementations, engine/registries/policies/targets desired state, and an outputs write-back block. Policy config schemas (policyImplementations[*].configSchema) are flagged as platform-provided (GET /policy-implementations) — fill from the live API before apply.
  • scripts/deploy.ts — now own-infra only, two phases (DEPLOY_PHASE): extractors (stock + custom extractor contracts, 3 policy implementation contracts → manifest) and factory (PropertyToken implementation + PropertyFactory wired to the API-created engine and RejectPolicy instance; fails fast if the manifest lacks them).
  • scripts/lib/ace-api.ts — extended client: patch, per-chain status polling (statusOf, waitForStatus), Apikey auth, pagination.
  • Deleted scripts/local-e2e.ts + scripts/e2e-local.sh — superseded: the hardhat tests cover the stack via scripts/lib/ace-core.ts, now an explicit test-only harness that simulates the API's end state.
  • .env.example — all script env vars documented (ACE_API_KEY, ACE_CONFIG_*, DEPLOY_PHASE, CCIP/sync vars).
  • README — control-plane section: the hardhat/API split, the 4-step flow (deploy:extractorsconfig-ace:plan/applydeploy:factoryconfig-ace:verify), identity/credential issuance via the IDV partner (SumSub/Persona) or your backend through the Identity Manager API, and the Beta caveats.

Operation flow

pnpm deploy:extractors   # own infra, phase 1 (extractor + implementation contracts)
pnpm config-ace:plan     # ACE API dry run (needs ACE_API_KEY + org access)
pnpm config-ace:apply    # creates PolicyEngine, registries, policies, targets, protections
pnpm deploy:factory      # own infra, phase 2 (factory + token implementation)
pnpm config-ace:verify   # API state vs onchain readback

Beta caveats (documented in README)

  • Self-deployed contracts aren't visible in the platform UI/API during Beta — the fully managed path deploys through the API via CRE Connect.
  • Custom extractors (our escrow AccountExtractor) are beyond the Beta platform surface (ERC-20/ERC-3643 signatures only) — they work onchain, just not platform-manageable yet.
  • Attestation-only credential checks — already aligned (the stack uses no Credential Data Validator).

Verification

  • pnpm config-ace:validate passes (offline manifest check)
  • 70 hardhat tests pass (stack exercised via the test harness)
  • plan/apply/verify require a real ACE_API_KEY + org access against the live API — exercise on testnet once provisioned

Production policy configuration is control-plane-driven, not raw onchain
calls. Adds a plan/apply/verify client for the ACE Coordinator API
(ace.api.chain.link/v1), ported from the semantics proven in the Caliber
repo, with a desired-state manifest and onchain readback reconciliation:

- scripts/lib/ace-api.ts: typed client (engine/extractor/target/protection
  endpoints, Apikey auth, pagination) + apply confirmations
- scripts/ace-configuration.json: desired state mirroring the engine
  extractor association and registry writer protections deployAceCore wires
  onchain for tests; product/escrow wiring stays factory-owned
- scripts/configure-ace.ts: validate (offline) | plan | apply | verify
  (API state vs onchain getExtractor/getPolicies readback); hardhat run
  takes no positional args, so the command is env-driven
- README: control-plane configuration section

Contract deployment (scripts/deploy.ts) and CCIP identity-sync tooling are
unaffected; the API only manages configuration.
Hardhat now deploys only Commertize's own infra (extractor contracts,
policy implementations, factory, token implementation); the PolicyEngine,
identity/credential registries, policy instances and policy attachment are
created and wired through the ACE Coordinator API (surface per the bundled
OpenAPI doc), matching the Caliber control-plane pattern.

- configure-ace.ts: full plan/apply/verify pipeline — extractors, engine
  (API-deployed), registries (API-deployed), implementations, policies,
  targets, protections — each polled until onchain status is created;
  apply persists the created addresses back into the manifest; verify
  reconciles against onchain readback
- ace-configuration.json: v2 desired-state manifest + outputs write-back;
  policy config schemas flagged as platform-provided (GET /policy-implementations)
- deploy.ts: two-phase own-infra deployer (DEPLOY_PHASE=extractors|factory),
  factory phase requires the API-created engine + RejectPolicy addresses
- ace-api.ts: patch(), status polling; drop local-e2e/e2e-local (tests
  cover the stack via the harness); ace-core.ts is now an explicit
  test-only harness simulating the API end state
- README + .env.example: control-plane flow, Beta caveats, env vars
@magiodev-cll magiodev-cll changed the title feat(ops): configure the ACE stack via the Coordinator API feat(ops): go 100% ACE API for the ACE-owned surface Aug 14, 2026
The local-e2e script was removed with the move to API-driven ACE
configuration; the unit suites already exercise the full stack through
the local-node harness.
- ace-api: drop dead sameStrings/requireApplyConfirmation/patch/findPolicyEngine
- configure-ace: halve validateManifest, remove unused converged flags,
  dedup the five write-then-resolve blocks into writeAndResolve, merge
  apply write-back + manifest persist, drop unused writeBack param
- deploy: import invariant instead of redefining it, loop the manifest
  address writes
- isAddress/zeroAddress from viem instead of the hand-rolled regex and
  string constant; assert from node:assert instead of a reimplemented
  invariant (removes the checksum-agnostic address check too)
- process.loadEnvFile replaces the bespoke .env parser (ace-api
  loadDotEnv) and the dotenv package fallback in hardhat.config
- inline the single-use statusOf into waitForStatus; deploy.ts reuses
  readJson
- remove the dotenv dependency (Node 22 native)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant