Skip to content

fix: apply configured gas and capital discount percents - #1533

Open
devtechedge wants to merge 1 commit into
across-protocol:masterfrom
devtechedge:fix/apply-discount-percents-1449
Open

fix: apply configured gas and capital discount percents#1533
devtechedge wants to merge 1 commit into
across-protocol:masterfrom
devtechedge:fix/apply-discount-percents-1449

Conversation

@devtechedge

Copy link
Copy Markdown

Summary

gasDiscountPercent and capitalDiscountPercent were accepted on RelayFeeCalculatorConfig, validated in the constructor, and echoed on RelayerFeeDetails, but the fee path never multiplied them in. A non-zero config therefore left gasFeeTotal, capitalFeeTotal, and relayFeeTotal unchanged.

This applies the discounts multiplicatively as (100 - discount) / 100 with BigNumber integer division (round down) on the gas and capital fee percents before totals are derived from them. Auxiliary native fees share the gas discount, matching auxNativeDiscountPercent. Downstream aggregates (relayFee*, minDeposit, maxGasFeePercent) then use the discounted values.

Test plan

  • Added unit coverage for mid-range (50%) and full (100%) gas discounts, plus a 50% capital discount against a flat capital fee config
  • yarn hardhat test test/relayFeeCalculator.test.ts (21 passing)

Fixes #1449

gasDiscountPercent and capitalDiscountPercent were validated and returned
but never used in fee math. Apply them multiplicatively as
(100 - discount) / 100 with BigNumber round-down on gas, capital, and
aux native fee percents (aux shares the gas discount) so totals and
relayFee aggregates reflect the configured discounts.

Fixes across-protocol#1449
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.

Configured discount percentages are validated and returned but do not appear applied in fee calculations

1 participant