Skip to content

Comments

fix gas calculation#1224

Draft
alexcos20 wants to merge 2 commits intomainfrom
feature/fix_gas_costs
Draft

fix gas calculation#1224
alexcos20 wants to merge 2 commits intomainfrom
feature/fix_gas_costs

Conversation

@alexcos20
Copy link
Member

Fixes # .

Changes proposed in this PR:

@alexcos20
Copy link
Member Author

/run-security-scan

Copy link
Member Author

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

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

AI automated code review (Gemini 3).

Overall risk: medium

Summary:
This pull request refactors the getGasOptions method in src/utils/blockchain.ts to improve clarity and standardize gas fee calculations. The changes consolidate the logic for applying a gasFeeMultiplier and introduce a minFee variable for Polygon/Mumbai and Sapphire networks. However, it removes the explicit minimum gas fee handling for Sepolia, which needs clarification.

Comments:
• [WARNING][bug] The MIN_GAS_FEE_SEPOLIA constant has been commented out, and its corresponding usage for SEPOLIA_NETWORK_ID has been removed from the getGasOptions logic. This means transactions on Sepolia will no longer have a enforced minimum maxPriorityFeePerGas or maxFeePerGas.

Could you please clarify the reasoning behind removing Sepolia's specific gas fee handling? Is Sepolia no longer a target network, or is there a new strategy for managing gas fees on this network? Without a minimum, transactions might get stuck or fail more often on Sepolia during periods of network congestion.
• [INFO][style] The return type hint for getGasOptions was previously Promise<{}> and is now implicitly Promise<any>. While the refactored code clearly returns an object with gasLimit, maxPriorityFeePerGas, and maxFeePerGas (or gasLimit and gasPrice), it would be beneficial for type safety to define a more specific return type interface (e.g., Promise<{ gasLimit: bigint; maxPriorityFeePerGas?: bigint; maxFeePerGas?: bigint; gasPrice?: bigint; }>).
• [INFO][performance] The minFee is now set to 0n for any chain that is not Polygon/Mumbai or in KNOWN_CONFIDENTIAL_EVMS. While this might be the desired behavior to allow networks to dictate their own minimums or use dynamic fee market rates, it's a significant change from previously hardcoded minimums for specific testnets like Sepolia.

Confirming that setting minFee = 0n for all other chains (where we previously had specific values for Sepolia) is the intended behavior and does not lead to unexpected transaction failures on other supported networks would be good.

@alexcos20
Copy link
Member Author

On sepolia we had a minimum of 4 gwei.
But the average now is 14 wei !!
image

so we ended up paying a lot more than we should

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.

1 participant