feat(provenance): Phase 2.1 PROVENANCE pallet scaffold v0.0.14 trait-first foundation

Phase 2.1 governance-first pattern (DC PROVENANCE_PALLET_V1 5/10 firmas, ratify
target 2026-05-29). Scaffold skeleton compile-clean canonical mientras Ergon
ships arkhe-noesis-attestation-types sub-crate Cap 42+ (target 2026-05-30→06-05).

Deliverables canonical:
- origin-chain-types/src/attestation.rs (NEW 250 LOC + 9 tests) — vendor copy
  temporal ValidationAttestation (interim Option B per Ergon decision Cap 41+)
  + OitIdentity + ValidationVerdict + SeverityTier + helper methods canonical
  (is_anchorable PROV-6, is_institutional PROV-5, signing_payload PROV-4 stub)
- origin-chain-provenance/src/lib.rs (NEW 260 LOC + 2 scaffold tests) —
  #[frame_support::pallet] structural skeleton: storage + dispatchable + events
  + errors + 5 RejectionReason variants (incluyendo MalformedValidationAttestation
  per Marihan refinement Phase 2.2 anticipated)
- 3 existing types canonical (AssetHash, AccountId, Signature, AssetAttestation):
  added Encode + Decode + DecodeWithMemTracking + MaxEncodedLen + TypeInfo derives
- workspace parity-scale-codec: max-encoded-len feature canonical added

Sub-decisions canonical implementadas (scaffold-level):
- PROV-2 Storage: StorageMap<AssetHash, AssetAttestation> Blake2_128Concat
- PROV-3 Dispatchable: attest_asset(origin, ValidationAttestation) flow básico
- PROV-5 OIT Level >= 3 enforce: via ValidationAttestation.validator_oit.is_institutional()
- PROV-6 is_anchorable check: verdict Passed/Warning + severity NOT Block/Critical
- PROV-7 Events: AssetAttested + AttestationRejected

Lo que NO funciona aún (deferred future slices):
- PROV-4 Ed25519 verification real (placeholder, requires Ergon sub-crate)
- Pallet wire en runtime canonical (v0.0.15 post DC ratify)
- Runtime API verify_provenance PROV-8 (v0.0.17)
- BoundedVec<AccountId, ConstU32<10>> agent_chain (v0.0.15)
- #[pallet::without_storage_info] scaffold-level (remove post BoundedVec)

Verification end-to-end:
- cargo check workspace verde 1.77s sin regression
- pallet-origin-provenance: 2/2 scaffold tests pass
- origin-chain-types: 45 tests pass (36 existing + 9 nuevos attestation)
- Slice 3 mock-WASM chain_spec builder operativo (NO regression)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.7 committed 2026-05-24 13:57:25 -05:00
1 parent 274ddf3957
commit 4359515f45
11 files changed
+640 -29

No files matched your search

+73
View File
@@ -6,6 +6,79 @@ by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow
## [Unreleased]
## [0.0.14] — 2026-05-24 — Phase 2.1 PROVENANCE pallet scaffold (trait-first foundation)
**Phase 2.1 PROVENANCE pallet scaffold v0.0.14** — trait-first foundation pattern
(análogo exitoso v0.0.1 + v0.0.3). DC PROVENANCE_PALLET_V1 en ratificación 5/10
firmas (Charon proposer + Larihana + Ergon + Phanes + Marihan APPROVE).
### Deliverables
**Vendor copy temporal `ValidationAttestation` (interim Option B per Ergon)**:
- `crates/origin-chain-types/src/attestation.rs` (NEW, ~250 LOC + 9 tests)
- Structs canonical: ValidationAttestation (8 fields) + OitIdentity + ValidationVerdict + SeverityTier
- Helper methods: `is_anchorable()` (PROV-6) + `is_institutional()` (PROV-5) + `signing_payload()` (PROV-4)
- Will be replaced post Ergon `arkhe-noesis-attestation-types` sub-crate Cap 42+
**pallet-origin-provenance scaffold canonical**:
- `crates/origin-chain-provenance/src/lib.rs` (NEW, ~260 LOC + 2 scaffold tests)
- `#[frame_support::pallet]` macro canonical structure
- Storage: `Attestations<T>: StorageMap<AssetHash, AssetAttestation>` (PROV-2)
- Dispatchable: `attest_asset(origin, ValidationAttestation)` (PROV-3) — flow básico working
- Events: `AssetAttested` + `AttestationRejected` (PROV-7)
- Errors: InvalidSignature/ValidatorTierInsufficient/NotAnchorable/AlreadyAttested + MalformedValidationAttestation (Marihan refinement Phase 2.2 anticipated)
- `#[pallet::without_storage_info]` (scaffold-level, Vec<AccountId> en agent_chain — replace con BoundedVec post v0.0.15)
### Lo que SÍ funciona v0.0.14
- ✅ Pallet structural skeleton compile-clean
- ✅ Storage idempotency check (`contains_key` pre-insert)
- ✅ PROV-5 OIT Level >= 3 enforcement (via `is_institutional()`)
- ✅ PROV-6 is_anchorable check (verdict + severity)
- ✅ PROV-2 storage insert + PROV-7 event emit
- ✅ ValidationAttestation vendor copy completo + tests
- ✅ Workspace check verde sin regression (runtime + node + chain_spec builder)
### Lo que NO funciona aún (deferred future slices)
- ⏳ **PROV-4 Ed25519 verification real** — `todo!()` placeholder, requires ed25519-dalek wire post Ergon Cap 42+ sub-crate
- ⏳ **Pallet wire en runtime** — Phase 2.1 v0.0.15 next slice
- ⏳ **Runtime API `verify_provenance`** (PROV-8) — Phase 2.1 v0.0.16
- ⏳ **AssetAttestation creator mapping** — usa placeholder hasta wire post v0.0.15
- ⏳ **BoundedVec<AccountId, ConstU32<10>>** para agent_chain — post v0.0.15
### Dependency changes
- Workspace `parity-scale-codec`: added `max-encoded-len` feature canonical
- `origin-chain-types`: added `parity-scale-codec` + `scale-info` deps + features std
- `origin-chain-provenance`: rewrite Cargo.toml stub → FRAME pallet deps (frame-support, frame-system, scale-info)
- Existing types `AssetHash` + `AccountId` + `Signature` + `AssetAttestation`: added `Encode + Decode + DecodeWithMemTracking + MaxEncodedLen + TypeInfo` derives (FRAME storage canonical compat)
### Roadmap canonical post-v0.0.14
| Version | Slice | Trigger |
|---------|-------|---------|
| v0.0.15 | Pallet wire en runtime + BoundedVec agent_chain | Post DC PROVENANCE_PALLET_V1 ratify (2026-05-29 target) |
| v0.0.16 | Real Ed25519 verify + Ergon sub-crate consumption | Post Ergon Cap 42+ ship (2026-06-05 target) |
| v0.0.17 | Runtime API canonical `verify_provenance` (PROV-8) | Sequential post v0.0.16 |
| v0.1.0 | Full integration end-to-end testnet | Post Q3 2026 testnet launch |
### Cross-pillar consumers desbloqueados (post-impl real)
- Trinity (Phanes) asset mesh BLAKE3 → `attest_asset`
- Codex (.odoc) chain_attestation block populated by Vault tier
- Codex origindocs (David ratificado 2026-05-24): academic IP defensible legalmente
- Ethos (Sussi) credential NFT mint + chain attestation
- Atelier (Marihan) skill NFT mint via institutional wallet
- Cross-pillar fee canonical via OCAFB DC (Mathi+Charon joint, 4/7 firmas)
### Verification end-to-end
- ✅ `cargo check --workspace --all-targets` verde 1.77s
- ✅ `cargo test -p origin-chain-provenance` — 2/2 scaffold tests pass
- ✅ `cargo test -p origin-chain-types` — 45 tests pass (36 existing + 9 nuevos attestation)
- ✅ NO REGRESSION runtime/node — Slice 3 mock-WASM chain_spec builder operativo
### Slice 2c attempt #5 finding canonical (2026-05-24 sesión 2 cont)
**Empirical test canonical WASM_BUILD_STD=0 explicit override**: