Skip to content

fix: Overall Fee calculation#820

Merged
thiagodeev merged 1 commit intomainfrom
thiagodeev/fix-overallfee-estimation
Nov 4, 2025
Merged

fix: Overall Fee calculation#820
thiagodeev merged 1 commit intomainfrom
thiagodeev/fix-overallfee-estimation

Conversation

@thiagodeev
Copy link
Copy Markdown
Collaborator

@thiagodeev thiagodeev commented Nov 4, 2025

Fixes the overall fee calculation to include the tip amount.

Problem:

The utils.ResBoundsMapToOverallFee function was not considering the tip when calculating the overall fee, causing incorrect fee calculations.
Ref: https://docs.starknet.io/learn/protocol/fees#overall-fee

Solution:

  • Added a tip parameter (rpc.U64) to ResBoundsMapToOverallFee
  • Updated the L2 gas fee calculation to include the tip: (L2GasPrice + tip) * L2GasAmount.

Changes:

  • Modified utils.ResBoundsMapToOverallFee to accept and use the tip parameter
  • Updated fee calculation logic to properly incorporate tip in L2 gas fee computation
  • Added test cases covering tip scenarios

This ensures the overall fee calculation matches the Starknet fee formula, including the tip component.

- Updated the ResBoundsMapToOverallFee function to accept an additional tip parameter, fixing fee calculation accuracy.
- Modified related function calls in transaction_test.go and main.go to accommodate the new tip parameter.
- Enhanced unit tests for ResBoundsMapToOverallFee to validate behavior with various tip values, ensuring comprehensive coverage of fee scenarios.
@thiagodeev thiagodeev changed the title fix: change ResBoundsMapToOverallFee to include tip parameter fix: Overall Fee calculation Nov 4, 2025
@thiagodeev thiagodeev marked this pull request as ready for review November 4, 2025 15:18
@thiagodeev thiagodeev merged commit 269178c into main Nov 4, 2025
8 checks passed
@thiagodeev thiagodeev deleted the thiagodeev/fix-overallfee-estimation branch November 4, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant