feat(agent-identity): v0.0.26 — register_agent_did impl complete + mock runtime integration tests E2E (10 scenarios)
Phase 2.7 AGENT IDENTITY pallet REAL IMPL canonical. Full 8-step CHN-7 flow canonical register_agent_did dispatchable + storage assertions + Inmutable #41 Cross-Species Co-authorship enforcement compile-detect. Mock runtime + 10 integration tests E2E pattern v0.0.18 + v0.0.22 mirror. ## Real impl canonical 8-step CHN-7 1. ensure_signed(origin) 2. Idempotency check (!Identities::contains_key(&who)) 3. Derive DID canonical via derive_did(public_key) BLAKE3 (Inmutable #16) 4. DID collision check (!DidToAccount::contains_key(&did)) 5. Build AgentChain BoundedVec from co_authors_raw Vec<[u8;32]> (overflow → AgentChainOverflow) 6. Inmutable #41 enforce: Hybrid requires non-empty agent_chain 7. Storage insert: Identities + DidToAccount reverse lookup 8. Emit AgentRegistered + AgentBound (if cross-species) Pure helper Pallet::<T>::query_identity_of() para Runtime API v0.0.27. ## 10 integration tests E2E canonical - scenario_1: Human self-registration → ok + DID + empty chain - scenario_2: AGI self-registration → ok + Inmutable #41 sovereign - scenario_3: Hybrid + 2 co-authors → ok + AgentBound emitted - scenario_4: Hybrid + empty chain → Err::HybridRequiresAgentChain - scenario_5: duplicate account → Err::AlreadyRegistered - scenario_6: same pubkey diff account → Err::DidAlreadyTaken - scenario_7: 11 co-authors → Err::AgentChainOverflow (ConstU32<10>) - scenario_8: DID → Account reverse lookup canonical - scenario_9: Human + AGI both is_sovereign() (Inmutable #41 lobo blanco) - scenario_10: 8-step CHN-7 walkthrough explicit Pre/Post assertions ## Files - EDIT: crates/origin-chain-agent-identity/src/lib.rs (real impl 8-step + query_identity_of helper) - NEW: crates/origin-chain-agent-identity/src/mock.rs (80 LOC mock runtime) - NEW: crates/origin-chain-agent-identity/src/tests_integration.rs (310 LOC, 10 tests) - EDIT: CHANGELOG.md (v0.0.26 entry comprehensive) ## Verification - cargo test -p origin-chain-agent-identity — 16 tests verde canonical, 0 failures (10 integration + 4 standalone + 2 auto-generated) 🛠️ Phase 2.7 real impl canonical. Runtime API v0.0.27 next ship → Phase 2.7 COMPLETE. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
46a0188a1d
commit
2fefe4cf51
4 files changed
+533
-17
No files matched your search
@@ -6,6 +6,65 @@ by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.0.26] — 2026-05-25 — Phase 2.7 impl — Real `register_agent_did` + mock runtime integration tests E2E (10 scenarios)
|
||||
|
||||
**🛠️ Phase 2.7 AGENT IDENTITY pallet REAL IMPL canonical** — Full 8-step
|
||||
`register_agent_did` dispatchable canonical + storage assertions + Inmutable #41
|
||||
Cross-Species Co-authorship enforcement compile-detect. Mock runtime + 10
|
||||
integration tests E2E pattern v0.0.18 + v0.0.22 mirror.
|
||||
|
||||
### Deliverables v0.0.26
|
||||
|
||||
**Real dispatchable canonical 8-step CHN-7 flow**:
|
||||
1. `ensure_signed(origin)` canonical
|
||||
2. Idempotency check canonical (`!Identities::contains_key(&who)`)
|
||||
3. Derive DID canonical via `derive_did(public_key)` BLAKE3 (Inmutable #16)
|
||||
4. DID collision check canonical (`!DidToAccount::contains_key(&did)`)
|
||||
5. Build `AgentChain` BoundedVec canonical from `co_authors_raw: Vec<[u8; 32]>` (overflow → `AgentChainOverflow`)
|
||||
6. Inmutable #41 canonical enforce: Hybrid requires non-empty agent_chain
|
||||
7. Insert storage canonical: `Identities` + `DidToAccount` reverse lookup
|
||||
8. Emit `AgentRegistered` + `AgentBound` (if cross-species) events canonical
|
||||
|
||||
**Pure helper canonical**:
|
||||
- `Pallet::<T>::query_identity_of(&account) -> Option<AgentIdentity>` para Runtime API v0.0.27
|
||||
|
||||
**Mock runtime canonical (NEW file)**:
|
||||
- `crates/origin-chain-agent-identity/src/mock.rs` — 80 LOC pattern v0.0.18 mirror
|
||||
- `construct_runtime!`: `System` + `AgentIdentity` (minimal testing)
|
||||
- Helpers: `alice_origin/account` + `bob_origin/account` + `ALICE_PUBKEY/BOB_PUBKEY/CHARLIE_PUBKEY` deterministic test pubkeys
|
||||
|
||||
**Integration tests canonical E2E (NEW file)**:
|
||||
- `crates/origin-chain-agent-identity/src/tests_integration.rs` — 310 LOC, **10 tests verde canonical**
|
||||
|
||||
**10 integration tests CHN-7 flow canonical**:
|
||||
|
||||
| # | Scenario | Kind | Co-authors | Expected outcome |
|
||||
|---|----------|------|------------|------------------|
|
||||
| 1 | Human self-registration | Human | [] | ✅ AgentRegistered + DID derived + empty chain |
|
||||
| 2 | AGI self-registration | AGI | [] | ✅ Inmutable #41 sovereign AGI canonical |
|
||||
| 3 | Hybrid with co-authors | Hybrid | [BOB, CHARLIE] | ✅ AgentRegistered + AgentBound (cross-species) |
|
||||
| 4 | Hybrid without chain | Hybrid | [] | ❌ Error::HybridRequiresAgentChain (Inmutable #41) |
|
||||
| 5 | Idempotency duplicate | Human | [] | ❌ Error::AlreadyRegistered |
|
||||
| 6 | DID collision | Human | [] same pubkey | ❌ Error::DidAlreadyTaken |
|
||||
| 7 | AgentChain overflow | Hybrid | 11 co-authors | ❌ Error::AgentChainOverflow (ConstU32<10>) |
|
||||
| 8 | DID → Account reverse lookup | Human | [] | ✅ DidToAccount canonical resolves |
|
||||
| 9 | All AgentKind sovereign | Human + AGI | [] | ✅ Both is_sovereign() Inmutable #41 |
|
||||
| 10 | 8-step CHN-7 walkthrough | Hybrid | [BOB] | ✅ Explicit Pre/Post-flight canonical |
|
||||
|
||||
### Verification end-to-end canonical
|
||||
|
||||
- ✅ `cargo test -p origin-chain-agent-identity` — **16 tests verde canonical, 0 failures**:
|
||||
- 10 integration tests E2E (`tests_integration` module)
|
||||
- 4 standalone scaffold tests (`tests` module)
|
||||
- 2 auto-generated (mock genesis + runtime integrity)
|
||||
|
||||
### Roadmap canonical post-v0.0.26
|
||||
|
||||
| Version | Trigger |
|
||||
|---------|---------|
|
||||
| **v0.0.27** | **Runtime API canonical `AgentIdentityApi.query_identity` impl en runtime → Phase 2.7 COMPLETE (sesión 3+ shipping ahora)** |
|
||||
| v0.1.0 | Slice 2e WASM resolved + full testnet Q3 2026 launch |
|
||||
|
||||
## [0.0.25] — 2026-05-25 — Phase 2.7 wired — AgentIdentity pallet runtime composition Index 9
|
||||
|
||||
**🔌 Phase 2.7 AGENT IDENTITY pallet WIRED runtime composition canonical** —
|
||||
|
||||
Reference in new issue
Block a user