Implement TaskSubmit PoCW with 5-stage Flux pipeline - #20
Open
ABresting wants to merge 12 commits into
Open
Conversation
) Add EventMetrics (per-event solver metrics computed after TEE execution), SolverPowerState, EmissionState types. Extend PoCWConfig with formula coefficients (alpha/beta/gamma), power rate, kappa, PoCW distribution weights (distance/necessity/contribution per spec), and emission params. Extend SolverReward with distance_score, necessity_score, contribution_score, weight (w_i) fields matching the PoCW spec. Extend FoldEconomics with kappa/minting fields. Add event_metrics to Event. All #[serde(default)]. Includes 9 unit tests: defaults, serde roundtrip, backward-compat deserialize for PoCWConfig/SolverReward/FoldEconomics, EventMetrics serde, SolverPowerState serde, EmissionState construction and serde.
Stage 1: calculate_task_burn() computes burn = α*C + β*R + γ*S where C = complexity (compute_time + gas*10 + writes*1000), R = risk (value_transferred), S = structural tension (dag_depth*100 + writes*500). Minimum burn of 1. Sits alongside calculate_transfer_burn() in flux_burn module since flux burning is common to all Setu transactions.
5 tests: disabled returns zero, known-input calculation, value transfer risk component, minimum burn of 1, custom alpha/beta/gamma.
ABresting
force-pushed
the
dev-abhi-tasksubmit-pocw
branch
from
March 3, 2026 20:40
7de2c34 to
158123d
Compare
ΔP = max(1, round(solver_power_rate × gas_used)) Returns 0 if PoCW is disabled.
Combined because they form a feedback loop on EmissionState: Stage 3 reads κ to mint, Stage 5 uses minted amount to adjust κ. Stage 3: FluxMinted = round(κ × ΔPower_total) Stage 5: κ(k+1) = clamp(κ(k) × (1 + d × (target/real − 1)), κ_min, κ_max)
Three signals per solver: - Distance: 1/(1+d) — proximity to critical path (1.0 for single solver) - Necessity: fraction of solver events ancestral to fold tips - Contribution: solver_depth / total_depth w_i = α·Distance + β·Necessity + γ·Contribution, normalized. Reward_i = w_i × FluxMinted, rounding remainder to top scorer.
…tate apply Processor now handles both Transfer (flat) and TaskSubmit (formula-based) events through the full pipeline: burn → power → mint → score → adjust. FoldObserver owns EmissionState and passes DAG to processor for scoring. TeeExecutor applies state changes immediately after TEE execution so balance queries reflect updates without waiting for fold.
- Compute EventMetrics (flux_burn, power_delta) after TEE execution - Initialize solver power budget on SolverRegister when PoCW enabled - Pass PoCWConfig from ConsensusConfig through to TeeExecutor - Add SolverPowerState::new() constructor
Wire POST /api/v1/task through validator to solver-TEE execution. Add SubmitTaskRequest/Response RPC types, prepare_task_submission in TaskPreparer (no coin selection), and submit_task in ValidatorNetworkService with VLC assignment and routing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the 5-stage Flux economic pipeline for TaskSubmit events, building on the flat-fee transfer mechanism from PR #15.
αC + βR + γS) for solver-executed tasks usingEventMetricssolver_power_rate × gas_used) with per-solver budget trackingκ × ΔPower_total)v0.1 scope: single-solver execution. All structures designed so v0.2 multi-solver competition (fan-out same task to N solvers, winner selection via
task_idgrouping) requires no rework.Closes #16
Test plan