一键导入
consensus-math-correctness
// L1 trigger - audits consensus arithmetic for truncation, unused bounds, EMA direction, and threshold edge errors.
// L1 trigger - audits consensus arithmetic for truncation, unused bounds, EMA direction, and threshold edge errors.
| name | consensus-math-correctness |
| description | L1 trigger - audits consensus arithmetic for truncation, unused bounds, EMA direction, and threshold edge errors. |
L1 trigger:
CONSENSUSflag AND (adjust_difficultyORdifficulty_adjustORemaORmoving_averageORreward_curveORtarget_timedetected) Inject Into:depth-consensus-invariantordepth-edge-caseLanguage: Go and Rust Finding prefix:[CM-N]
Consensus math bugs are small, deterministic, and load-bearing. They rarely need fancy exploit chains: one wrong operator, one dead bound, or one flipped EMA direction can permanently skew the chain.
For every expression of the form (A / B) * C, test whether A < B is
possible. If so, the intermediate division truncates to zero before the
multiplication and the protocol silently loses precision.
Questions:
A < B happen at runtime?(A * C) / B?Tag: [CONSENSUS-MATH:DIV-FIRST]
Consensus configs often declare bounds that never influence runtime math.
Questions:
max_difficulty_adjustment_factor, min_reward, max_step_count.Tag: [CONSENSUS-MATH:UNUSED-BOUND]
For each moving-average implementation, identify the prior sample, current sample, and smoothing factor.
Questions:
Tag: [CONSENSUS-MATH:EMA-DIRECTION]
Consensus edge cases often live at threshold-1, threshold, and
threshold+1.
Questions:
> / >= / < / <= gate in consensus math, what does the
protocol text say should happen exactly at the threshold?threshold-1, threshold, and threshold+1?Tag: [CONSENSUS-MATH:BOUNDARY-OP]
Difficulty and reward math often expresses "increase/decrease by X%" using integer ratios or fixed-point factors. Enumerate the exact vectors:
| Input | Expected | Observed |
|---|---|---|
| no change | factor = 1.0 | |
| minimum decrease | factor just below 1.0 | |
| maximum decrease | e.g. 50% decrease | |
| maximum increase | configured cap | |
| denominator near zero | reject / clamp |
Mandatory checks:
max_*_adjustment_factor, prove it clamps both
upward and downward movement at runtime.> vs >= at every clamp boundary.Tag: [CONSENSUS-MATH:RATIO-EDGE]
If consensus math uses f32, f64, log, log10, pow, platform C math,
SIMD, CUDA, or FFI:
Tag: [CONSENSUS-MATH:NONDET-FP]
[CONFORMANCE-PASS] > [NON-DET-PASS] >
[LSP-TRACE] > [CODE-TRACE]Launch the Plamen deterministic L1 infrastructure audit pipeline
Run the Plamen L1 infrastructure audit wizard in Codex
Launch the Plamen deterministic Web3 security audit pipeline
Run the Plamen smart-contract audit wizard in Codex
L1 trigger - audits BLS signature aggregation: subgroup check, rogue-key attack defense, aggregation order, signing-domain separation.
L1 trigger - audits configuration constants, documented bounds, feature-gated values, and unused protocol limits for semantic drift.