Skip to content

Conversation

@thiagodeev
Copy link
Collaborator

@thiagodeev thiagodeev commented Oct 31, 2025

This PR fix the bug in theutils.FeeEstToResBoundsMap function, which was using the max uint64 value for the L2 gas amount limit instead of the limit defined by Starknet, causing the txn to be rejected by the node when the amount was greater than the limit. Now, the limit is used correctly, and it's returned in the case of overflow.
It also adds a new feature to specify custom limits for the resource bounds.

  • New utils.CustomFeeEstToResBoundsMap function that does the same as utils.FeeEstToResBoundsMap, but accepts a utils.FeeLimits parameter to set custom limits for the resource bounds instead of using the Starknet default limits.
  • New U128.ToBigInt() method to improve the type usage and validation
  • New tests + old tests updated

- Modified the FeeEstToResBoundsMap function to include an optional parameter for custom limits on resource bounds.
- Updated all relevant calls to FeeEstToResBoundsMap across transaction building functions and tests to accommodate the new parameter.
- Enhanced error handling for gas price and amount limits to ensure proper validation and defaulting behavior.
- Added new test cases to TestFeeEstToResBoundsMap to validate behavior with fee limits and multipliers.
- Adjusted expected values to reflect accurate calculations based on the new fee limit logic.
@thiagodeev thiagodeev changed the base branch from thiagodeev/feat-tip-estimation to main October 31, 2025 19:04
@thiagodeev thiagodeev marked this pull request as ready for review October 31, 2025 19:15
- New test case for only one limit value provided, assuring no overflow above the u64 and u128 limits
rodrigo-pino
rodrigo-pino previously approved these changes Nov 3, 2025
Copy link
Contributor

@rodrigo-pino rodrigo-pino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good refactor. Some small comments

@github-project-automation github-project-automation bot moved this to 👀 In review in [Nubia] Starknet.go Nov 3, 2025
@thiagodeev thiagodeev merged commit 0b9c66f into main Nov 4, 2025
8 checks passed
@thiagodeev thiagodeev deleted the thiagodeev/fix-fee-limit branch November 4, 2025 12:08
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in [Nubia] Starknet.go Nov 4, 2025
@thiagodeev
Copy link
Collaborator Author

Thanks to @tarrencev for the report!

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.

3 participants