!5102odin-dyn-fee-improvements → developc9d58dd20c

Dynamic L1 fee rework: gate, signal, bracket search, modes

29commits
58files
27.0klines changed
1.6klines to read
v21→22consensus version
100%logic lines narrated

Where the diff is

5-minute explainer

What changed

Why

Controller stepped on noise: ~4 swaps/epoch vs ~70 needed.

Liquidity gate

Seal only with enough data; cap rolling at ~7 days.

epoch end ≥ 30 swaps≥ $100k vol seal ✓ roll ↻ ≥ 7 days rolling?seal · capped ↓ only

Signal

Revenue measured against everyone else's volume.

fees ÷ (pool − own) own volumeothers ✓ others < 10% of pool → recorded, not measured

Bracket search

Big jumps first, then ±1 tracking.

120101557869→ 8

try it ↓

Modes + reset

Whitelist value picks the mode.

0off1per-pair 2global *|*3monitor4monitor *|*

any value change ⟶ wipe state ⟶ fresh search

Accounting fixes

Counting and attribution bugs.

  • stream / limit order counts once
  • global double swap counts once
  • largest affiliate only
  • idle epochs fold pool volume
  • Migrate21to22 clears accumulators

Bracket search · live, same rule as nextSearchBps

State + upgrade

Migration

v21→v22

Deletes in-flight dynamic-fee accumulators and sets every record's span_start_height to the upgrade height. Records keep their bps but restart the bracket search (search_done=false). Registered after develop's GAIA 20→21.

Mimirs

  • new…MinSwaps30
  • new…MinVolumeUSD100,000
  • new…MaxEpochBlocks100,800
  • new…MinOtherFlowBPS1000
  • new…ProbeEpochs1
  • changed…DeadbandBPS1000 on raw fees → 1000
  • changedDYNAMICFEE-WHITELIST-<THORNAME>1 active, 2 monitor → 1–4

Proto fields added

DynamicFeeRecord
+ search_done+ probes+ span_start_height+ pairs
DynamicFeeEpochRecord
+ swap_count+ pool_volume_tor+ own_pool_volume_tor+ blocks+ capped
DynamicFeeAccumulator
+ swap_count+ pool_volume_tor+ own_pool_volume_tor+ pairs
DynamicFeeProbe (new)
+ bps+ signal_sum+ epochs+ capped
DynamicFeePoolAccumulator (new)
+ pair_asset_a+ pair_asset_b+ volume_tor
GenesisState
+ dynamic_fee_pool_accumulators
Query entries (REST)
+ phase+ probes+ blocks+ capped+ swap_count+ pool_volume_tor+ own_pool_volume_tor+ span_blocks

Line by line · every changed logic line, narrated

15:17runtime
18code chapters
100%logic lines narrated (1353/1353)
8flagged spots
speed

Chapters

What to check