galacticcouncil / hydration-node

Hydration node - Cross-chain liquidity protocol built with Polkadot-SDK
https://hydration.net
Apache License 2.0
170 stars 66 forks source link

Faster transaction fee ramp up #879

Closed jak-pan closed 1 month ago

jak-pan commented 1 month ago

From @dmoka

Here is the log of the first 10 consecutive blocks with full congestion:
Spent fee at block 40 with weight 374420035084: 58274116272128 HDX
Spent fee at block 41 with weight 374420035084: 61572651155456 HDX
Spent fee at block 42 with weight 374420035084: 63771674411008 HDX
Spent fee at block 43 with weight 374420035084: 65970697666560 HDX
Spent fee at block 45 with weight 374420035084: 68169720922112 HDX
Spent fee at block 46 with weight 374420035084: 70368744177664 HDX
Spent fee at block 47 with weight 374420035084: 73667279060992 HDX
Spent fee at block 48 with weight 374420035084: 76965813944320 HDX
Spent fee at block 49 with weight 374420035084: 80264348827648 HDX
Spent fee at block 50 with weight 374420035084: 82463372083200 HDX
Spent fee at block 51 with weight 374420035084: 87960930222080 HDX

As you see the the fee is increasing block by block as we have the mechanism to increase the fee multiplier when the chain is fully congested. At the beginning, it increases slowly, but then around block 100-150 block it increases exponentially and maxes out
If we average it out, it takes about 700 HDX to block the next 10 blocks. However, after ~150 blocks of full congestion, we've congigured the fee for a single swap to be $10, making it very costly for an attacker to keep blocking our chain.
Note that the configuration for 10$ swap happened at 0.0266 HDX/USD price on 22th Feb, 2024, maybe we could reconfigure it again based on the current prices. 
dmoka commented 1 month ago

It needs ~200 blocks to reach the max multiplier. We discussed in a Rustatus that it is good enough, so we park it for now.