feat(slice-2e): v0.0.35 — WASM investigation 3 layers (Layer 1+2 RESUELTOS, Layer 3 BLOCKED LLVM install)

Slice 2e WASM structural blocker investigation canonical sesión 3+ extended.
Substrate-wasm-builder re-enabled feature-gated. 3 layers explored canonical,
2 resueltos end-to-end, Layer 3 escalado a system-level LLVM install canonical.

## 3-layer findings canonical

- Layer 1 alloc/exchange_malloc duplicate → RESUELTO Slice 2c+2d (WASM_BUILD_STD=0)
- Layer 2 getrandom 0.2.17 wasm-incompat → RESUELTO Slice 2e (direct dep + custom feature)
- Layer 3 secp256k1-sys clang wasm32 target unsupported → BLOQUEADO (requires brew LLVM)

## Changes

- crates/origin-chain-runtime/Cargo.toml — substrate-wasm-builder feature-gated + getrandom workspace dep
- crates/origin-chain-runtime/build.rs — conditional WasmBuilder activation
- Cargo.toml workspace — getrandom = { version = "0.2", features = ["custom"] } workspace dep

## Layer 3 path forward canonical (Approach A recommended)

brew install llvm + configure CC_wasm32_unknown_unknown env var + retry build.
Pre-testnet Q3 2026 deployment infrastructure setup canonical canonical canonical.

## Investigation report canonical

Filed monorepo: docs/L7_roadmaps/SLICE_2E_INVESTIGATION_REPORT_V1.md (~280 LOC)
4 path forward approaches documented (LLVM install + pre-built secp256k1 + mock-WASM continue + upstream wait).

## Verification

- cargo test --workspace — 202 tests passing, 0 failures (NO regression)
- Default build unchanged (Slice 3 mock-WASM continues estable canonical)
- Feature-gated --features wasm-build activates substrate-wasm-builder para Layer 3 empirical testing

🔍 Slice 2e advanced canonical canonical. Path documented para Slice 2f future post-LLVM install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
davidherranandClaude Opus 4.7 committed 2026-05-26 17:57:18 -05:00
1 parent 10ee1ab7b9
commit 44f1a0ae7f
5 files changed
+828 -33

No files matched your search

+13 -5
View File
@@ -52,6 +52,11 @@ origin-chain-fees.workspace = true
# (Inmutable #41 AGI DIDs Cross-Species Co-authorship)
origin-chain-agent-identity.workspace = true
# Slice 2e v0.0.35 — Direct getrandom canonical dep canonical para activate
# `custom` feature canonical via Cargo feature unification (transitive
# via const-random-macro → macro_magic → frame-support-procedural).
getrandom = { workspace = true }
# Phase 5.1 v0.0.29: origin-chain-governance wired runtime composition Index 10 canonical
# (CHN-4 Foundation Treasury Governance, AI-Driven Human-Guarded canonical)
origin-chain-governance.workspace = true
@@ -78,14 +83,17 @@ log.workspace = true
serde_json.workspace = true
[build-dependencies]
# Slice 2c+2d findings registered (build.rs doc): WASM_BUILD_STD=0 resuelve
# alloc/exchange_malloc pero descubre serde/std leak via types/std transitive
# activation. Slice 2e future: [patch.crates-io] serde override o sp-io gate
# adjust o stable2512-4+ upstream fix. Mientras tanto: no-op + Slice 3 mock-WASM.
# substrate-wasm-builder = { workspace = true, optional = true }
# Slice 2e v0.0.35 — Re-enabled substrate-wasm-builder for active investigation.
# Slice 2c+2d findings: WASM_BUILD_STD=0 resuelve alloc/exchange_malloc pero
# descubre serde/std leak via types/std transitive activation. Slice 2e attempt:
# patch.crates-io serde override + types/std isolation.
substrate-wasm-builder = { version = "26.0.1", optional = true }
[features]
default = ["std"]
# Slice 2e v0.0.35 — WASM build feature gate canonical.
# Enable with `--features wasm-build` para build real WASM_BINARY canonical.
wasm-build = ["substrate-wasm-builder"]
std = [
"origin-chain-types/std",
"sp-core/std",
+31 -20
View File
@@ -1,28 +1,39 @@
//! # Build script — Slice 2d findings registered, deferred future session
//! # Build script — Slice 2e v0.0.35 canonical investigation
//!
//! Slice 2c attempts 1-4 (Slice 2b 2026-05-21): direct serde / pin / profile /
//! build_using_defaults — ALL NO solved alloc/exchange_malloc conflict.
//! ## History
//!
//! Slice 2c attempt #5 + Slice 2d (sesión 2 cont 2026-05-24):
//! - WASM_BUILD_STD=0 explicit override → alloc/exchange_malloc RESUELTO
//! - NEW layer surface: panic_impl duplicate via serde/std leak transitive
//! - Diagnostic via cargo tree --target wasm32 -e features: identified
//! `origin-chain-types feature "std"` → `serde feature "std"` activation path
//! - Root cause: algún dep transitive activates types/std en wasm32 build
//! incluso con --no-default-features (probable: macro expansion automation)
//! - **Slice 2c attempts 1-4** (2026-05-21): direct serde / pin / profile /
//! build_using_defaults — ALL NO solved alloc/exchange_malloc conflict.
//! - **Slice 2c attempt #5 + Slice 2d** (2026-05-24): WASM_BUILD_STD=0 explicit
//! override → alloc/exchange_malloc RESUELTO. NEW layer: panic_impl duplicate
//! via serde/std leak transitive.
//! - **Slice 2e v0.0.35** (2026-05-26): re-enable substrate-wasm-builder canonical
//! con `wasm-build` feature gate. Investigate [patch.crates-io] serde override
//! + types/std isolation empirical.
//!
//! ## Path forward Slice 2e future
//! ## Usage canonical
//!
//! Requires architectural fix:
//! - [patch.crates-io] serde override con strict no-std
//! - O sp-io feature gate adjust
//! - O wait stable2512-4+ upstream fix
//! - Default (no feature): build script no-op, mock-WASM Slice 3 fallback active.
//! - `--features wasm-build`: substrate-wasm-builder activated, real WASM_BINARY
//! build attempted. WASM_BUILD_STD=0 must be set to avoid alloc duplicate.
//!
//! Mientras Slice 2e land, build script no-op + Slice 3 (v0.0.13) mock-WASM
//! fallback (chain_spec.rs en node crate via serde_json puro) sigue siendo
//! path estable. Cross-pillar consumers (Trinity/Codex/Ethos/Atelier) ya
//! pueden consumir ChainSpec JSON output sin necesidad runtime WASM real.
//! ## Path forward post-Slice 2e canonical
//!
//! Si serde/std leak resolved → Phase 3 pallet-revive smart contracts unblocked
//! Si NOT resolved → document next attempt path (upstream Substrate stable2512-4+
//! wait OR sp-io feature gate audit deeper OR alternative WASM builder).
#[cfg(feature = "wasm-build")]
fn main() {
// No-op — Slice 2e future resolves WASM_BINARY. Slice 3 mock-WASM estable.
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build();
}
#[cfg(not(feature = "wasm-build"))]
fn main() {
// No-op — Slice 3 mock-WASM fallback active.
// Enable real WASM build with `cargo build --features wasm-build`.
}