datahaven/operator/runtime/testnet/tests
Gonza Montiel 782321e5d0
feat: Implement dynamic fee adjustment (#251)
#  Implement Dynamic Fee Adjustment Mechanism

## Overview
Implements a dynamic fee adjustment mechanism, replacing the constant
fee multiplier with an adaptive multiplier that responds to network
congestion, following Moonbeam's pattern.

## Changes
- Replaces `ConstFeeMultiplier` with `TargetedFeeAdjustment` across all
runtime configurations (mainnet, stagenet, testnet)
- Implements an EIP-1559-like slow-adjusting fee mechanism that prevents
DoS attacks by adjusting fees based on block fullness
- **Configurable Parameters**: 
  - Target block fullness: 35%
- Adjustment variable: 4/1000 (responds in ~1 hour at extreme
congestion)
  - Two modes:
    -  `SlowAdjustingFeeUpdate` for mainnet and testnet.
    - `FastAdjustingFeeUpdate` for stagenet.
- Adds tests coverage for different fee scenarios

## Technical Details

The fee adjustment algorithm works as follows:
```
diff = (previous_block_weight - target) / maximum_block_weight
next_multiplier = prev_multiplier * (1 + (v * diff) + ((v * diff)^2 / 2))
assert(next_multiplier > min)
```
**Where:**
- `v` = AdjustmentVariable
- `target` = TargetBlockFullness  
- `min` = MinimumMultiplier

`SlowAdjustingFeeUpdate` sets a minimum multiplier of `1x` for a
conservative fee adjustment, while `FastAdjustingFeeUpdate` sets it to
`0.1x`, which is mainly used for dev networks / testing.
2025-10-28 10:06:45 +00:00
..
governance feat: Add proxy Precompile (#155) 2025-09-12 09:45:26 +02:00
common.rs feat: Implement Moonbeam-style OpenGov governance (#131) 2025-09-02 22:46:35 +02:00
fee_adjustment.rs feat: Implement dynamic fee adjustment (#251) 2025-10-28 10:06:45 +00:00
lib.rs feat: Implement dynamic fee adjustment (#251) 2025-10-28 10:06:45 +00:00
native_token_transfer.rs feat: Standardize currency system to HAVE token with Wei-based units (#130) 2025-08-18 13:26:30 +02:00
proxy.rs feat: Add proxy Precompile (#155) 2025-09-12 09:45:26 +02:00
safe_mode_tx_pause.rs feat: Add SafeMode and TxPause Pallets (#192) 2025-10-06 17:00:10 +00:00
treasury.rs fix: change pallet_evm alias to EVM to fix eth_getCode (#213) 2025-10-10 17:48:52 +00:00