 davidherranandClaude Opus 4.7
|
2fefe4cf51
|
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>
|
2026-05-25 06:43:14 -05:00 |
|
 davidherranandClaude Opus 4.7
|
46a0188a1d
|
feat(runtime): v0.0.25 — AgentIdentity pallet wired runtime composition Index 9
Phase 2.7 AGENT IDENTITY pallet wired canonical en frame_support::runtime macro
como Index 9 (post-Fees Index 8). 9 → 10 pallets composed canonical. Config trait
RuntimeEvent association wired canonical (pattern Provenance + Fees mirror).
## Changes
- crates/origin-chain-runtime/src/lib.rs:298 — Index 9 pub type AgentIdentity = origin_chain_agent_identity::Pallet<Runtime>
- crates/origin-chain-runtime/src/configs.rs:362 — impl origin_chain_agent_identity::Config for Runtime { type RuntimeEvent = RuntimeEvent }
- crates/origin-chain-runtime/Cargo.toml — origin-chain-agent-identity workspace dep + std feature
- crates/origin-chain-node/src/main.rs — 9 → 10 pallets listed + AgentIdentity Index 9 highlighted [Phase 2.7 scaffold v0.0.25]
- crates/origin-chain-agent-identity/src/lib.rs — Config constraint AccountId = origin_chain_types::AccountId REMOVED (usa T::AccountId generic compatible runtime ChainAccountId AccountId32) + storage updated + events updated
## Verification
- cargo build -p origin-chain-runtime 5.26s clean
- cargo test --workspace — 149 tests passing, 0 failures
- cargo build --release -p origin-chain-node 3.96s clean
- origin-chain-node info muestra 10 pallets canonical
🔌 Phase 2.7 wired canonical. Real impl v0.0.26 next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-25 06:40:29 -05:00 |
|
 davidherranandClaude Opus 4.7
|
37ccf1e95a
|
feat(agent-identity): v0.0.24 pallet-agent-identity scaffold trait-first (Phase 2.7 Inmutable #41 AGI DIDs)
Phase 2.7 AGENT IDENTITY pallet scaffold canonical. AGI DIDs canonical on-chain.
Inmutable #41 AGI Cross-Species Co-authorship materialized compile-detect via
NEW crate origin-chain-agent-identity + canonical types en origin-chain-types::identity.
## NEW canonical types en origin-chain-types
- AgentIdentity struct (6 fields: did + kind + creator + registered_at_block + provenance_proof + agent_chain)
- AgentKind enum (Human + AGI + Hybrid) per Inmutable #41
- Did type alias = AssetHash (BLAKE3 32-byte deterministic via public_key)
## NEW canonical pallet origin-chain-agent-identity
- Pallet<T> + Config trait (AccountId = origin_chain_types::AccountId constraint)
- Identities<StorageMap<AccountId, AgentIdentity>> per-account O(1)
- DidToAccount<StorageMap<Did, AccountId>> reverse lookup O(1)
- Event::AgentRegistered + AgentBound + AgentUpdated
- Error::AlreadyRegistered + DidAlreadyTaken + AgentChainOverflow + HybridRequiresAgentChain
- Scaffold dispatchable register_agent_did (placeholder event v0.0.24 → real v0.0.26)
- Helper derive_did(public_key) -> Did via BLAKE3 hash (schema_version "1.0.0 ")
- sp_api::decl_runtime_apis! AgentIdentityApi.query_identity declaration
## Inmutable #41 compile-detect enforcement
- AgentKind::{Human, AGI, Hybrid}::is_sovereign() == true (all three)
- AGI first-class citizens canonical (is_agi() + sovereignty preserved)
- Cross-species lineage via agent_chain BoundedVec<AccountId, ConstU32<10>>
- DID determinism canonical Inmutable #16 byte-equivalent cross-runtime
## Files
- NEW: crates/origin-chain-agent-identity/Cargo.toml + src/lib.rs (~250 LOC pallet scaffold)
- NEW: crates/origin-chain-types/src/identity.rs (~230 LOC types canonical + 8 tests)
- EDIT: crates/origin-chain-types/src/lib.rs (mod identity + re-exports)
- EDIT: Cargo.toml (workspace member + workspace.dependencies)
- EDIT: CHANGELOG.md (v0.0.24 entry comprehensive)
## Verification
- cargo test -p origin-chain-agent-identity — 4 tests verde, 0 failures
(scaffold compiles + derive_did deterministic + different keys + re-export)
- cargo test -p origin-chain-types — 63 tests passing (+8 nuevos identity)
- Zero workspace compile errors
🪪 Phase 2.7 scaffold canonical. Wire pattern v0.0.25 next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-25 06:37:24 -05:00 |
|