feat(provenance): v0.0.18 mock runtime integration tests E2E — 9 scenarios canonical own fixtures

Phase 2.1 PROVENANCE pallet — 9 integration tests E2E via FRAME mock runtime
composition (`construct_runtime!` macro + derive_impl + sp_io::TestExternalities).
Cierra honest disclosure sesión 2 ("real chain runtime aún NO arranca"). Pallet
end-to-end validado canonical sin esperar Slice 2e WASM resolution structural.

## 9 integration tests canonical PROV-3 flow

5 scenarios:
- scenario_1_passed_info_anchored_canonical (PROV-2/3/7) ✅
- scenario_2_warning_anchored_canonical (PROV-2/3/6/7) ✅
- scenario_3_failed_critical_rejected_canonical (PROV-6) ❌ NotAnchorable
- scenario_4_passed_block_security_rejected_canonical (PROV-6) ❌ NotAnchorable
- scenario_5_anonymous_level_0_rejected_canonical (PROV-5) ❌ ValidatorTierInsufficient

4 additional:
- additional_idempotency_already_attested_rejected_canonical (PROV-2) ❌ AlreadyAttested
- additional_tampered_signature_rejected_canonical (PROV-4) ❌ InvalidSignature
- additional_tampered_payload_rejected_canonical (PROV-4) ❌ InvalidSignature
- additional_6_step_prov_3_walkthrough_canonical (PROV-3 full) ✅ Pre/post assertions

## Own fixtures canonical

Per audit canonical sesión 3+ (docs/L7_roadmaps/AUDIT_CHARON_SESION_3_STATE_V1.md),
Ergon E2E fixture diary claim aspirational sin shipped commit verified — filesystem
+ git history confirma no source file canonical. Charon construye own fixtures
basados en vendor copy ValidationAttestation real existente. Pattern análogo
Slice 3 mock-WASM + v0.0.16 Ed25519 interim encoding.

## Files canonical

- NEW: crates/origin-chain-provenance/src/mock.rs (75 LOC mock runtime)
- NEW: crates/origin-chain-provenance/src/tests_integration.rs (270 LOC, 9 tests)
- EDIT: crates/origin-chain-provenance/Cargo.toml (sp-core+sp-io+sp-runtime dev-deps)
- EDIT: crates/origin-chain-provenance/src/lib.rs (mod mock + mod tests_integration + docstring v0.0.18)
- EDIT: CHANGELOG.md (v0.0.18 entry canonical pattern Phase 2.1)

## Verification

- cargo test -p origin-chain-provenance — 17 tests verde, 0 failures
  (9 integration + 6 standalone Ed25519 + 2 auto-generated)
- Workspace tests no regressions
- Cero warnings críticos

🎉 Phase 2.1 PROVENANCE pallet validated E2E via mock runtime canonical.

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 22:40:04 -05:00
1 parent f928935989
commit 654cffdf31
6 files changed
+523 -4

No files matched your search

+29 -4
View File
@@ -1,19 +1,34 @@
//! # pallet-origin-provenance — Phase 2.1 scaffold v0.0.14
//! # pallet-origin-provenance — Phase 2.1 COMPLETE + v0.0.18 mock runtime integration tests
//!
//! Asset attestation pallet canonical per CHN-7 + DC PROVENANCE_PALLET_V1
//! (5/10 firmas hoy 2026-05-24, deadline ratificación 2026-05-29).
//! (6/10 firmas sesión 3+ 2026-05-24, deadline ratificación 2026-05-29).
//!
//! ## Status canonical: v0.0.16 — Real Ed25519 verification implementada
//! ## Status canonical: v0.0.18 — Mock runtime integration tests E2E own fixtures
//!
//! Este crate provee:
//! - Storage layout canonical `StorageMap<AssetHash, AssetAttestation>` (PROV-2) ✅
//! - Dispatchable canonical `attest_asset(origin, ValidationAttestation)` (PROV-3) ✅
//! - **Real Ed25519 verify canonical via ed25519-dalek (PROV-4) ✅ v0.0.16**
//! - Real Ed25519 verify canonical via ed25519-dalek (PROV-4) ✅ v0.0.16
//! - OIT Level >= 3 enforcement canonical (PROV-5) ✅
//! - is_anchorable check canonical (PROV-6) ✅
//! - Events canonical `AssetAttested` + `AttestationRejected` (PROV-7) ✅
//! - Errors canonical (PROV-4/5/6) ✅
//! - Pallet Config trait canonical ✅
//! - Runtime API canonical `verify_provenance` (PROV-8) ✅ v0.0.17
//! - **Mock runtime + integration tests E2E own fixtures (v0.0.18 sesión 3+) ✅**
//!
//! ## v0.0.18 sesión 3+ mock runtime integration tests
//!
//! Per audit canonical sesión 3+ (`AUDIT_CHARON_SESION_3_STATE_V1.md`),
//! Ergon E2E fixture diary claim aspirational sin shipped commit verified.
//! Charon construye own fixtures basados en vendor copy ValidationAttestation
//! real existente. 9 integration tests canonical:
//!
//! - 5 scenarios PROV-3 flow: passed_info anchored + warning anchored +
//! failed_critical rejected + passed_block_security rejected + anonymous_level_0 rejected
//! - 4 additional: idempotency + tampered_signature + tampered_payload + 6-step walkthrough
//!
//! Mock runtime composition canonical via `construct_runtime!` macro (System + Provenance).
//!
//! ## Lo que NO funciona aún (post-Ergon sub-crate Cap 42+)
//!
@@ -287,6 +302,16 @@ pub mod pallet {
extern crate alloc;
// v0.0.18 — Mock runtime canonical + integration tests E2E PROV-3 flow.
// Per audit canonical sesión 3+ (`AUDIT_CHARON_SESION_3_STATE_V1.md`),
// own fixtures basados en vendor copy ValidationAttestation real existente
// (no depender de Ergon E2E fixture diary claim aspirational).
#[cfg(test)]
pub mod mock;
#[cfg(test)]
mod tests_integration;
#[cfg(test)]
mod tests {
use super::*;