From 6e9b432de91b540e2393d66b10fc83732b87790b Mon Sep 17 00:00:00 2001 From: mUniKeS Date: Fri, 21 Aug 2026 23:02:25 +0200 Subject: [PATCH] docs: warn that profitMargin overrides don't retroactively update built fee configs --- src/server/config/config-fees.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/config/config-fees.ts b/src/server/config/config-fees.ts index ef7bf6a6..d85c8c15 100644 --- a/src/server/config/config-fees.ts +++ b/src/server/config/config-fees.ts @@ -11,6 +11,16 @@ const feeConfig = ( profit, }); +// IMPORTANT: `profit` defaults to configDefaults.transactionFees.profitMargin, +// but a default parameter is resolved the moment this function is CALLED, +// not read live afterwards. Default network fee configs are built once, at +// module load time in config-networks.ts, using whatever profitMargin holds +// at that point (the built-in default). If you override profitMargin later +// in MY-CONFIG.ts, the fee config already built for a network is NOT +// retroactively updated - setting profitMargin alone silently does nothing +// to fees computed before the override ran. To actually apply a new margin, +// call setFeesForNetworkEVM(chain, feeConfigL1(ratio)) (or feeConfigL2) +// again, AFTER setting profitMargin, so it re-reads the current value. export const feeConfigL1 = ( gasEstimateLimitToActualRatio: number, gasEstimateVarianceBuffer = 0.1,