Skip to content

feat(contracts): add agent identity registry per ADR-0002 - #56

Merged
XxHugheadxX merged 3 commits into
mainfrom
feat/identity-registry
Sep 26, 2026
Merged

XxHugheadxX merged 3 commits into
mainfrom
feat/identity-registry

Conversation

@moises-cisneros

Copy link
Copy Markdown

Closes #13

Summary

  • New identity-registry Soroban contract implementing the ADR-0002 interface (sequential IDs from 0, unique URIs, owner metadata, dual-auth payment wallet).
  • Typed IdentityError enum (codes frozen, 9–11 reserved), Registered/UriUpdated/MetadataSet events, TTL extend-on-write.
  • Hardened .gitignore files (env, keys, secrets, Stellar identities).

Acceptance criteria

  • Every public function from ADR-0002 exists, with the same name and signature
  • Happy-path test for each public function
  • Auth test without mock_all_auths()
  • Duplicate registration returns the defined error, with test
  • Events asserted in tests (topics and data)
  • TTL extension test on the keys the ADR says
  • stellar contract build, cargo test and cargo clippy --all-targets -- -D warnings pass

Verification evidence

cd contracts
stellar contract build          # pass, identity_registry.wasm 13268 bytes
cargo test -p identity-registry # pass, 15/15
cargo clippy --all-targets -- -D warnings  # pass
cargo fmt --all -- --check       # pass

moises-cisneros and others added 3 commits September 25, 2026 19:34
set_agent_uri wrote UriIndex(new_uri) without extending its TTL, so the index could be archived long before the URI it points to (4,095 vs 1,036,800 ledgers in tests). ADR-0002 requires every write to extend the keys it writes. The test now asserts the index TTL.
openspec/ is tooling configuration unrelated to #13; keep this PR scoped to the contract.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Deploying puls3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2654019
Status: ✅  Deploy successful!
Preview URL: https://31252e31.puls3-4lw.pages.dev
Branch Preview URL: https://feat-identity-registry.puls3-4lw.pages.dev

View logs

@XxHugheadxX XxHugheadxX left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against ADR-0002 and #13. The contract is in good shape: all 23 public functions, the error codes (1–8, 9–11 reserved, 100), the three events with their topics, the storage keys and types, and extend_ttl match the ADR. The auth test runs without mock_all_auths(), and the TTL tests follow the ADR's method.

Gates, run locally (CI does not build contracts yet, #29)

stellar contract build                        ✅ identity_registry.wasm (12 KB)
cargo test                                    ✅ 15/15 (+ placeholder 1/1)
cargo clippy --all-targets -- -D warnings     ✅
cargo fmt --all -- --check                    ✅

Fixed in this branch (2 commits on top of yours, no force-push)

  1. eb8a4a7 — TTL of the new URI index. set_agent_uri wrote UriIndex(new_uri) but did not extend its TTL, while ADR-0002 requires every write to extend the keys it writes. In tests the new index was left at 4,095 ledgers while AgentUri got 1,036,800, so the index could be archived long before the URI, breaking agent_id_by_uri and the duplicate check. The fix extends it, and set_agent_uri_updates_lookup_and_frees_old_uri now asserts the index TTL. The new assertion fails on the original code (left: 4095, right: 1036800) and passes with the fix.
  2. 2654019 — removed openspec/. It is tooling configuration unrelated to #13 (scope rule in CONTRIBUTING). Feel free to propose it in its own PR.

All four gates pass again after both commits.

Optional, your call

  • After unset_agent_wallet, get_metadata("agentWallet") returns Some(empty bytes) (asserted in test.rs). Stellar 8004 returns None there, since it reads the wallet slot. Returning None would keep clients written for Stellar 8004 working unchanged.
  • MAX_METADATA_KEYS counts agentWallet, so 99 keys are left for the builder; Stellar 8004 does not count it. Fine either way, but worth a line in ADR-0002.
  • The identity*.json pattern in contracts/.gitignore would silently ignore any deployment artifact named like that (#15). A narrower pattern may be safer.

@moises-cisneros please confirm the two commits look right to you; after that this is good to merge.

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.

feat: Agent Identity Registry contract

2 participants