fix: update user paid fee for cointype ZETA to use correct denomination#4542
fix: update user paid fee for cointype ZETA to use correct denomination#4542
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThis pull request updates denomination handling for ZETA coin type in user-paid gas fees, modifying how fees are recorded in cross-chain transactions. It introduces gas accounting verification utilities and enhances E2E tests to validate outbound gas refund calculations using chain stability pool parameters. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@changelog.md`:
- Line 13: The changelog entry has a mismatched PR reference: the label "[4342]"
does not match the linked URL "https://github.com/zeta-chain/node/pull/4542";
update the markdown so the numeric label matches the URL (change "[4342]" to
"[4542]" in the entry that reads "update user paid fee for cointype ZETA to use
correct denomination") or if the label is correct, change the URL to the PR with
ID 4342 so both parts match.
🧹 Nitpick comments (1)
e2e/utils/zetacore.go (1)
504-569: Add a sanity check forstabilityPoolPercentagebefore refund split.If chain params ever return a value >100,
userRefundAmountcan underflow (math.Uint panic). A clear assertion makes failures easier to diagnose.Proposed fix
totalRemainingFees := userGasFeePaid.Sub(outboundTxFeePaid) usableRemainingFees := crosschainkeeper.PercentOf(totalRemainingFees, crosschaintypes.UsableRemainingFeesPercentage) + require.LessOrEqual(t, stabilityPoolPercentage, uint64(100), "StabilityPoolPercentage must be <= 100") stabilityPoolAmount := crosschainkeeper.PercentOf(usableRemainingFees, stabilityPoolPercentage) userRefundAmount := usableRemainingFees.Sub(stabilityPoolAmount)
Description
Closes https://github.com/zeta-chain/protocol-private/issues/381
How Has This Been Tested?
Note
Medium Risk
Touches cross-chain fee accounting used for stability-pool funding and user refunds; a denomination mismatch could change refund amounts, though the change is small and now enforced by E2E assertions.
Overview
Updates ZETA gas-payment accounting so
OutboundParams.UserGasFeePaidis stored in the outbound gas token denomination (matchingGasLimit * GasPrice) rather than the swapped ZETA amount, aligning it with stability-pool/refund math.Adds E2E coverage for withdrawals (legacy ZETA, ZETA, ETH, ERC20) that fetch chain params (stability pool percentage) and assert outbound gas accounting via a new
utils.VerifyOutboundGasAccountinghelper, logging the computed stability-pool and user-refund amounts.Written by Cursor Bugbot for commit d4f2701. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests