Skip to content

chore: benchmark EMA reciprocal averaging path - #1553

Merged
enthusiastmartin merged 6 commits into
masterfrom
fix/direction-independent-slow-ema
Oct 17, 2026
Merged

enthusiastmartin merged 6 commits into
masterfrom
fix/direction-independent-slow-ema

Conversation

@mrq1911

@mrq1911 mrq1911 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

The direction-independent EMA change added a reciprocal averaging branch, but the existing benchmark fixtures fed equal prices and measured only the legacy path. This follow-up makes on_finalize_multiple_tokens and stale get_entry exercise a rising price, so generated weights cover the more expensive branch.

It regenerates the EMA weights, bumps the runtime to 455, fixes the dispatched benchmark workflow master fetch, and makes the benchmark skip marker evaluate the checked-out commit and skip all expensive steps.

Benchmark impact:

  • get_entry: 34.424 -> 39.327 us compute (+14.2%); 84.424 -> 89.327 us including two database reads (+5.8%).
  • on_finalize_multiple_tokens: per-pair compute slope 58.095 -> 68.346 us (+17.6%); including four reads and four writes per pair, total charged weight increases by about 1.8-2.3%.
  • EMA trade and liquidity hook weights increase by about 1.4%; their complete AMM extrinsics increase by less than 1%.
  • Existing helpers with nine EMA projections have a conservative total increase of 6.2-6.9%.
  • Storage reads, writes, and proof sizes are unchanged.

Validation:

  • cargo fmt --all -- --check
  • RUSTFLAGS="-D warnings" SKIP_WASM_BUILD=1 cargo check -p hydradx-runtime --features runtime-benchmarks
  • RUSTFLAGS="-D warnings" SKIP_WASM_BUILD=1 cargo test -p hydradx-runtime --features runtime-benchmarks benchmarking::ema_oracle --lib
  • Full runner benchmark, 50 steps x 20 repeats
  • CI make check with the generated weights

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Weight Diff Report

⚠️ 1 pallet(s) have changes exceeding ±10% threshold

14 extrinsic(s) changed across 1 pallet(s). New: 0. Removed: 0.

pallet_ema_oracle

Extrinsic RefTime Proof Size Reads Writes
add_oracle -2.4% (30.5M → 29.8M) — — —
remove_oracle -2.5% (53.6M → 52.3M) — — —
on_finalize_no_entry +4.5% (4.4M → 4.6M) — — —
on_finalize_multiple_tokens +9.3% (33.5M → 36.6M) — — —
on_trade_multiple_tokens +1.2% (43.7M → 44.2M) — — —
on_liquidity_changed_multiple_tokens +1.7% (43.6M → 44.4M) — — —
get_entry ⚠️ +14.2% (34.4M → 39.3M) — — —
update_bifrost_oracle +0.4% (61.1M → 61.3M) — — —
set_external_oracle +0.1% (60.9M → 61.0M) — — —
set_external_oracle_by_ids -1.4% (44.1M → 43.5M) — — —
register_external_source -0.6% (27.0M → 26.8M) — — —
remove_external_source -1.3% (46.9M → 46.3M) — — —
add_authorized_account -0.2% (31.2M → 31.1M) — — —
remove_authorized_account -0.9% (31.4M → 31.1M) — — —

Threshold: ±10%. Base Weight::from_parts(ref_time, proof_size) compared; per-unit components ignored.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Crate versions that have been updated:

  • hydradx-runtime: v454.0.0 -> v455.0.0

Runtime version has been increased.

@enthusiastmartin
enthusiastmartin merged commit 3d01c4c into master Oct 17, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants