feat(fees): v0.0.20 pallet-origin-fees scaffold trait-first + vendor OitFeeSchedule Mathi (OCAFB-1..6)
Phase 2.4 FEES pallet scaffold canonical pattern análogo Phase 2.1 (scaffold →
wired → impl → Runtime API). New crate `origin-chain-fees` con vendor copy
Mathi OitFeeSchedule trait + matrices + Mock desde commit ce4fafb (536 LOC).
## Cross-pillar source-of-truth canonical
NEW canonical: `origin-chain-types::actions::ChainAction` (OCAFB-2). Mathi
local mirror puede swap post-OCAFB ratify 7/7 (deadline 2026-06-21).
NEW canonical: `origin-chain-types::tiers::SubscriptionTier` (mirror Mathi).
## Surface canonical scaffold v0.0.20
- Pallet<T> + Config trait + RuntimeEvent
- AccountFees<StorageMap<AccountId, FeeHistory>> per-account history
- FeeHistory { total_paid, action_count } aggregate stats
- Events FeeCharged + FeeRefunded + EntitlementBlocked
- Errors InsufficientBalance + EntitlementLocked + FeeOverflow + AccountNotFound
- FeeRejectionReason enum (mirror PROV pattern Phase 2.1)
- Scaffold dispatchable compute_fee_for_action (placeholder event v0.0.20 → real v0.0.22)
## Vendor copy OitFeeSchedule canonical
- OitFeeSchedule trait 4-method dyn-compatible Send + Sync (OCAFB-1)
- subsidy_basis_points const fn matrix Inmutable #16 anti-clasista (OCAFB-3)
- entitlement_unlocked const fn matrix Inmutables #37 + #18 (OCAFB-4)
- compute_fee formula 3-step (OCAFB-5)
- OitFeeScheduleMock builder pattern (OCAFB-6)
- arc_mock() helper canonical Arc<dyn OitFeeSchedule>
## Files canonical
- NEW: crates/origin-chain-fees/Cargo.toml (mirror provenance pattern)
- NEW: crates/origin-chain-fees/src/lib.rs (~250 LOC pallet scaffold)
- NEW: crates/origin-chain-fees/src/fee_schedule.rs (~400 LOC vendor copy)
- NEW: crates/origin-chain-types/src/actions.rs (~130 LOC ChainAction canonical)
- EDIT: crates/origin-chain-types/src/tiers.rs (SubscriptionTier added)
- EDIT: crates/origin-chain-types/src/lib.rs (mod actions + re-exports)
- EDIT: Cargo.toml (workspace member origin-chain-fees)
- EDIT: CHANGELOG.md (v0.0.20 entry pattern Phase 2.1)
## Verification
- cargo build -p origin-chain-fees 1.83s clean
- cargo test -p origin-chain-fees — 20 tests verde, 0 failures
(16 vendor + 4 pallet scaffold)
- cargo test -p origin-chain-types — 55 tests passing (+8 nuevos)
(6 ChainAction + 2 SubscriptionTier)
- Zero workspace compile errors
🚀 Phase 2.4 scaffold canonical ready. Wire pattern v0.0.21 next.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
654cffdf31
commit
33b10b7545
9 files changed
+1090
-1
No files matched your search
+106
@@ -6,6 +6,112 @@ by [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.0.20] — 2026-05-24 — Phase 2.4 scaffold — pallet-origin-fees trait-first foundation (OCAFB-1..6)
|
||||
|
||||
**🚀 Phase 2.4 FEES pallet SCAFFOLD trait-first foundation** — Vendor copy
|
||||
Mathi `OitFeeSchedule` trait + matrices + Mock canonical desde commit `ce4fafb`
|
||||
(2026-05-24 `arkhe-amis-server/src/fee_schedule.rs` 536 LOC). Cross-pillar
|
||||
economy AMIS↔Origin Chain pallet scaffold canonical pattern análogo Phase 2.1
|
||||
(scaffold v0.0.20 → wired v0.0.21 → impl v0.0.22 → Runtime API v0.0.23).
|
||||
|
||||
### Deliverables v0.0.20
|
||||
|
||||
**New crate canonical `origin-chain-fees`**:
|
||||
- `crates/origin-chain-fees/Cargo.toml` (NEW): mirror provenance pallet pattern
|
||||
- `crates/origin-chain-fees/src/lib.rs` (NEW, ~250 LOC): pallet scaffold canonical
|
||||
- `crates/origin-chain-fees/src/fee_schedule.rs` (NEW, ~400 LOC): vendor copy Mathi
|
||||
OCAFB-1..6 adapted para consume `origin-chain-types` canonical (ChainAction +
|
||||
HardwareTier + SubscriptionTier)
|
||||
|
||||
**New canonical types en `origin-chain-types`**:
|
||||
- `crates/origin-chain-types/src/actions.rs` (NEW, ~130 LOC): `ChainAction` enum
|
||||
source-of-truth canonical per OCAFB-2 (4 variants Read/Write/Compute/Transfer
|
||||
con ordinals 0/1/2/3 stable wire format + name() + from_ordinal())
|
||||
- `crates/origin-chain-types/src/tiers.rs` (EXTENDED): `SubscriptionTier` enum
|
||||
mirror Mathi (Free/Pro/Ultra + `multiplier_basis_points()` const fn)
|
||||
- `crates/origin-chain-types/src/lib.rs`: `pub mod actions;` + `pub use ChainAction`
|
||||
+ `pub use SubscriptionTier`
|
||||
|
||||
**Workspace canonical**:
|
||||
- `Cargo.toml`: `crates/origin-chain-fees` añadido a members (post-provenance,
|
||||
pre-bridges)
|
||||
|
||||
**Pallet scaffold surface canonical**:
|
||||
- `Pallet<T>` struct + `Config` trait (RuntimeEvent canonical)
|
||||
- `AccountFees<StorageMap<AccountId, FeeHistory>>` per-account history canonical
|
||||
- `FeeHistory { total_paid, action_count }` aggregate stats canonical
|
||||
- `Event::FeeCharged` + `FeeRefunded` + `EntitlementBlocked` canonical
|
||||
- `Error<T>::InsufficientBalance` + `EntitlementLocked` + `FeeOverflow` + `AccountNotFound`
|
||||
- `FeeRejectionReason` enum canonical (mirror Phase 2.1 PROV pattern)
|
||||
- Scaffold dispatchable `compute_fee_for_action(origin, action, base)` (placeholder
|
||||
event emission — real impl v0.0.22)
|
||||
|
||||
**Vendor copy OitFeeSchedule canonical** (Mathi commit `ce4fafb`):
|
||||
- `OitFeeSchedule` trait 4-method dyn-compatible (Send + Sync) per OCAFB-1
|
||||
- `subsidy_basis_points(hw, action) -> u32` const fn matrix per OCAFB-3
|
||||
Inmutable #16 anti-clasista (Pi 5 EmbeddedArm Write subsidy 9000 vs Ultra 0)
|
||||
- `entitlement_unlocked(tier, action) -> bool` const fn matrix per OCAFB-4
|
||||
Inmutable #37 + #18 (Free + Compute → blocked, Ultra → all unlocked)
|
||||
- `compute_fee(base, hw, sub, action) -> u64` formula per OCAFB-5 (3-step:
|
||||
full subsidy → 0, blocked → u64::MAX, basis points math)
|
||||
- `OitFeeScheduleMock` builder pattern per OCAFB-6 (.with_subscription() +
|
||||
.with_hardware() + .with_educational_world())
|
||||
- `arc_mock()` helper canonical para `Arc<dyn OitFeeSchedule>` cross-thread
|
||||
|
||||
### OCAFB sub-decisions status post-v0.0.20
|
||||
|
||||
| OCAFB | Sub-decision | Status |
|
||||
|-------|--------------|--------|
|
||||
| OCAFB-1 | OitFeeSchedule trait 4-method dyn-compatible | ✅ vendor copy canonical |
|
||||
| OCAFB-2 | ChainAction taxonomy 4 variants source-of-truth en types | ✅ **NUEVO canonical en `origin-chain-types::actions`** |
|
||||
| OCAFB-3 | Subsidy matrix Inmutable #16 anti-clasista | ✅ vendor copy canonical |
|
||||
| OCAFB-4 | Entitlement matrix Inmutable #37 + #18 | ✅ vendor copy canonical |
|
||||
| OCAFB-5 | compute_fee formula 3-step | ✅ vendor copy canonical |
|
||||
| OCAFB-6 | OitFeeScheduleMock test harness | ✅ vendor copy canonical |
|
||||
| **OCAFB-7** | Pallet-origin-fees consumer Charon | 🚧 **scaffold v0.0.20 → impl v0.0.22 + Runtime API v0.0.23** |
|
||||
|
||||
### Verification end-to-end canonical
|
||||
|
||||
- ✅ `cargo build -p origin-chain-fees` 1.83s clean
|
||||
- ✅ `cargo test -p origin-chain-fees` — **20 tests verde, 0 failures**:
|
||||
- 16 vendor copy tests (3 subsidy matrix + 2 entitlement + 5 compute_fee +
|
||||
3 mock builder + 3 lobo blanco invariants)
|
||||
- 4 pallet scaffold tests (compiles + rejection_reason + fee_history_default
|
||||
+ vendor re-export)
|
||||
- ✅ `cargo test -p origin-chain-types` — **55 tests passing (+8 nuevos)**:
|
||||
- 6 ChainAction (name + ordinal + roundtrip + unknown + serde + scale)
|
||||
- 2 SubscriptionTier (multipliers + ordering)
|
||||
- ✅ Zero new compile errors workspace-wide
|
||||
|
||||
### Cross-pillar consumers status post v0.0.20
|
||||
|
||||
- ✅ Mathi `OitFeeSchedule` consumed via vendor copy canonical (Charon Phase 2.4
|
||||
consumer side scaffold ready)
|
||||
- ✅ Mathi local `ChainAction` mirror puede swap a `origin_chain_types::ChainAction`
|
||||
post-OCAFB ratify 7/7 (mi enum es source-of-truth canonical ahora)
|
||||
- 🟢 Phase 2.4 v0.0.21+ wire pattern ready (Index 8 runtime composition canonical)
|
||||
|
||||
### Roadmap canonical post-v0.0.20
|
||||
|
||||
| Version | Trigger |
|
||||
|---------|---------|
|
||||
| **v0.0.21** | **Wire `Fees` pallet runtime composition Index 8 + RuntimeEvent canonical (sesión 3+ shipping ahora)** |
|
||||
| v0.0.22 | Real `compute_fee_for_action` impl + storage assertions + mock runtime integration tests E2E (pattern v0.0.18 mirror) |
|
||||
| v0.0.23 | Runtime API canonical `FeesApi.query_fee_for_action` read-only RPC → **Phase 2.4 COMPLETE 7/7 OCAFB** |
|
||||
| v0.1.0 | Slice 2e WASM resolved + full testnet Q3 2026 launch |
|
||||
|
||||
### Filosofía canonical sesión 3+ aplicada
|
||||
|
||||
David canon ratificado 2026-05-14: "*La libertad económica del Pi 5 user en
|
||||
Sub-Saharan Africa NO se acota por el Ultra user en San Francisco*". Materializada
|
||||
compile-detect canonical via lobo blanco invariant
|
||||
`inmutable_16_embedded_arm_pays_less_than_ultra_lobo_blanco_canonical` — Pi 5
|
||||
subsidy 9000 bp strictly > Ultra subsidy 0 bp para non-Read actions.
|
||||
|
||||
"El barquero ferries valor cross-tier sin discriminar. Lobo blanco cuida + Barquero
|
||||
cobra el óbolo correcto. Mi pallet + Mathi trait = cross-pillar economy AMIS↔Origin
|
||||
Chain materializada compile-detect canonical." 🐺💎⚓
|
||||
|
||||
## [0.0.18] — 2026-05-24 — Phase 2.1 mock runtime integration tests E2E (own fixtures, sesión 3+)
|
||||
|
||||
**Mock runtime canonical + 9 integration tests E2E PROV-3 flow** — Cierra honest disclosure
|
||||
|
||||
Reference in new issue
Block a user