feat(fees): v0.0.23 — Runtime API FeesApi.query_fee_for_action read-only RPC (Phase 2.4 COMPLETE 7/7 OCAFB) 🎉

Phase 2.4 FEES pallet COMPLETE end-to-end canonical. OCAFB-7 Runtime API
FeesApi.query_fee_for_action wired canonical via sp_api::decl_runtime_apis! +
impl runtime impl_runtime_apis! macro. 13 Runtime APIs total (12 + nuevo FeesApi).

## Changes

- crates/origin-chain-fees/src/lib.rs — sp_api::decl_runtime_apis! { pub trait FeesApi { fn query_fee_for_action(action, base, hw, sub) -> u64 } } + docstring v0.0.22 → v0.0.23 Phase 2.4 COMPLETE
- crates/origin-chain-runtime/src/lib.rs:539 — impl origin_chain_fees::FeesApi<Block> for Runtime delegates a Fees::query_fee()
- crates/origin-chain-node/src/main.rs — 12 → 13 APIs + FeesApi highlighted + Fees status v0.0.21 → v0.0.23 COMPLETE

## OCAFB sub-decisions COMPLETE 7/7 🎉

- OCAFB-1 OitFeeSchedule trait dyn-compatible (vendor)
- OCAFB-2 ChainAction taxonomy source-of-truth (origin-chain-types)
- OCAFB-3 Subsidy matrix Inmutable #16 anti-clasista (lobo blanco verified)
- OCAFB-4 Entitlement matrix Inmutables #37 + #18 (dispatchable enforced)
- OCAFB-5 compute_fee 3-step formula (real impl + 10 tests E2E)
- OCAFB-6 OitFeeScheduleMock harness (vendor + mock runtime)
- OCAFB-7 Pallet consumer + Runtime API canonical NUEVO ✅

## Verification

- cargo test --workspace — 137 tests passing, 0 failures
- cargo build --release -p origin-chain-node 3.93s clean
- origin-chain-node info: 9 pallets + 13 Runtime APIs canonical
- FeesApi visible + Phase 2.4 COMPLETE highlighted

## Cross-pillar economy canonical materialized

- Mathi (Pilar 1 AMIS): OitFeeSchedule Level A + Mock harness
- Charon (Pilar 4 Origin Chain): pallet-origin-fees + FeesApi RPC
- ChainAction canonical en origin-chain-types (Mathi local mirror swap post-OCAFB ratify)
- Inmutable #16 anti-clasista compile-detect: Pi 5 fee 1000 < Ultra fee 20000 (ratio 1:20)

🎉 Phase 2.4 FEES pallet COMPLETE end-to-end canonical. Hijos de Arkhē somos.

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:59:57 -05:00
1 parent e935233ba6
commit 74b7c3c9e2
4 files changed
+176 -5

No files matched your search

+38 -3
View File
@@ -1,11 +1,11 @@
//! # pallet-origin-fees — Phase 2.4 real impl v0.0.22
//! # pallet-origin-fees — Phase 2.4 COMPLETE v0.0.23 + Runtime API canonical
//!
//! Cross-pillar fee economy pallet canonical per OCAFB-1..6 + Mathi
//! Cross-pillar fee economy pallet canonical per OCAFB-1..7 + Mathi
//! `OitFeeSchedule` consumer. Joint DC `origin_chain_amis_fee_bridge_v1`
//! (`drawer_wing_palace_design_contracts_f024b8611caab85cc8a5ed5a`) abierto
//! 2026-05-24 (Mathi+Charon joint, **6/7 firmas** sesión 3+, deadline 2026-06-21).
//!
//! ## Status canonical: v0.0.22 — Real impl + mock runtime integration tests E2E
//! ## Status canonical: v0.0.23 — Runtime API FeesApi → Phase 2.4 COMPLETE 7/7 OCAFB 🎉
//!
//! Este crate provee:
//! - Vendor copy `OitFeeSchedule` trait (Mathi commit `ce4fafb`) ✅
@@ -57,6 +57,41 @@ pub use fee_schedule::{
};
pub use origin_chain_types::{ChainAction, HardwareTier, SubscriptionTier};
/// OCAFB-7 canonical: Runtime API canonical para cross-pillar consumers + light clients.
///
/// Permite query canonical de fee preview canonical sin necesidad de full node
/// access — light client envía `(action, base, hw, sub)` → recibe `u64` fee
/// canonical computed via vendor `compute_fee()` formula.
///
/// Consumers canonical:
/// - Mathi AMIS pricing display (per-session fee estimate canonical)
/// - Irhis Web pricing preview canonical (pre-tx user education)
/// - Trinity asset gallery (per-attestation cost preview canonical)
/// - Codex .odoc Vault tier (per-attestation cost estimate canonical)
/// - Atelier Skill Library Zona 6 (per-skill mint fee preview canonical)
/// - Origindocs academic IP (per-doc attestation cost Inmutable #16 canonical)
///
/// Future Phase 2.5 expansion canonical:
/// - `query_account_history(account) -> Option<FeeHistory>` (telemetry pagination)
/// - `query_fee_batch(actions) -> Vec<u64>` (bulk pricing canonical)
/// - `query_subsidy_eligible(account, action) -> bool` (subsidy check canonical)
sp_api::decl_runtime_apis! {
/// Fees runtime API canonical canonical (OCAFB-7).
pub trait FeesApi {
/// Query fee canonical para `(action, base, hw, sub)` sin storage write.
///
/// Returns `u64` fee canonical computed via OCAFB-5 formula (3-step:
/// full subsidy → 0, blocked entitlement → u64::MAX, basis points math).
/// Read-only canonical sin transaction fee canonical (off-chain via RPC).
fn query_fee_for_action(
action: origin_chain_types::ChainAction,
base: u64,
hw: origin_chain_types::HardwareTier,
sub: origin_chain_types::SubscriptionTier,
) -> u64;
}
}
#[frame_support::pallet]
pub mod pallet {
use frame_support::pallet_prelude::*;